Home > @d_opvt > private > diva_synth2.m

diva_synth2

PURPOSE ^

DIVA_SYNTH2 Synthesizes the sound

SYNOPSIS ^

function sig = diva_synth2(data)

DESCRIPTION ^

 DIVA_SYNTH2   Synthesizes the sound
   This core function relies on a mex file to provide the output signal
   Input:
   data: The structure data must have the following fields
       Af,Ag0,AgP,F0, duration, dx and optionally fs

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sig = diva_synth2(data)
0002 % DIVA_SYNTH2   Synthesizes the sound
0003 %   This core function relies on a mex file to provide the output signal
0004 %   Input:
0005 %   data: The structure data must have the following fields
0006 %       Af,Ag0,AgP,F0, duration, dx and optionally fs
0007 
0008 % Satrajit Ghosh, SpeechLab, Boston University. (c)2001
0009 % $Header: /mnt/localhd/cvsdir/MODELLING/NEWDIVA/@d_opvt/private/diva_synth2.m,v 1.7 2006/10/25 21:31:49 brumberg Exp $
0010 
0011 % $NoKeywords: $
0012 
0013 % Setup globals
0014 global RELEASE
0015 
0016 global diva_nf;
0017 global diva_af;
0018 global diva_sig;
0019 
0020 if ~isfield(data,'Af') & isfield(data,'X'),
0021     data.Af = [];data.dx = [];
0022     for i=1:size(data.X,2),   
0023         [F,B,A,Af] = doAM(data.X(:,i));
0024         data.Af(:,i) = Af(1,:)';
0025         data.dx(:,i) = Af(2,:)';
0026     end;
0027 end;
0028 
0029 diva_nf=data.Af;
0030 [data.Af,sidx,eidx]=AfRelease(data.Af);
0031 diva_af=data.Af;
0032 
0033 % Determine the dimensionality of the area functions
0034 n = size(data.Af,2);
0035 
0036 % Initialize all parameters for vtsynth - [note the transpose]
0037 Ag0 = data.Ag0';
0038 AgP = data.AgP';
0039 F0  = data.F0';
0040 
0041 TAF1 = [linspace(0,data.duration,n)' [0;2 * ones(n-1,1)] 1*ones(n,1)]';
0042 TAF2 = data.Af;
0043 
0044 % call vtsynth to generate the signal
0045 if isfield(data,'fs'),
0046   [sig] = vtsynth(size(data.Af,1),Ag0,AgP,F0,TAF1,TAF2,data.dx, data.fs,0);
0047   % vtsynth can take 7 or 9 params, if 9, then 9th param follows:
0048   %   1: output tube with min area
0049   %   0: do nothing
0050 else,
0051   data.fs=10000;
0052   [sig] = vtsynth(size(data.Af,1),Ag0,AgP,F0,TAF1,TAF2,data.dx);
0053 end  
0054 
0055 % In order to reduce clicks we are multiplying the signal by a voicing
0056 % component defined by the minimum of the area function at each point
0057 
0058 AV=interp1(linspace(1,length(sig),n),min(data.Af)>0.001,1:length(sig))';
0059 sig = sig.*AV;
0060 diva_sig=sig;
0061 
0062 B=fir1(10,[1000/(data.fs/2) 3000/(data.fs/2)]);
0063 
0064 if(length(sidx)==length(eidx))
0065   for n=1:length(sidx),
0066     %sig((sidx(n)*10):((eidx(n)-16)*10))=0;
0067     sig((sidx(n)*10):(eidx(n)*10))=fftfilt(B,sig((sidx(n)*10):(eidx(n)*10)));
0068   end
0069 end
0070 
0071 
0072 % Voicing only after steady state released (Not beginning of
0073 % production due to movement from initial position)
0074 
0075 %sig(1:(15*10))=0;
0076

Generated on Tue 27-Mar-2007 12:06:24 by m2html © 2003