Home > @d_opvt > synth2.m

synth2

PURPOSE ^

SYNTH2 Synthesizes the output from the vocal tract

SYNOPSIS ^

function [Fmts,LPCcoeff,idxValid,F] = synth2(vtm,varargin)

DESCRIPTION ^

 SYNTH2    Synthesizes the output from the vocal tract
   This function behaves very similar to synth1 except for its 
   output. The function returns Fmts, LPC coefficients and a list of
   valid articulator positions.
   Please see synth1 for additional help

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Fmts,LPCcoeff,idxValid,F] = synth2(vtm,varargin)
0002 % SYNTH2    Synthesizes the output from the vocal tract
0003 %   This function behaves very similar to synth1 except for its
0004 %   output. The function returns Fmts, LPC coefficients and a list of
0005 %   valid articulator positions.
0006 %   Please see synth1 for additional help
0007 
0008 % Satrajit Ghosh, SpeechLab, Boston University. (c)2001
0009 % $Header: /mnt/localhd/cvsdir/MODELLING/NEWDIVA/@d_opvt/synth2.m,v 1.1.1.1 2006/10/06 18:20:23 brumberg Exp $
0010 
0011 % $NoKeywords: $
0012 
0013 % Setup globals
0014 global RELEASE
0015 
0016 % if nargin == 2,
0017 %     if isstruct(varargin{1}),
0018 %         y = diva_synth2(data);
0019 %     end;
0020 % end;
0021 
0022 X = varargin{1};
0023 
0024 if (nargin>2),
0025     data.fs = varargin{2};
0026 else,
0027     data.fs = 10000;
0028 end;
0029 
0030 if nargin>3,
0031     data.duration = varargin{3};
0032 else,
0033     data.duration = 300;
0034 end;
0035 tf = data.duration;
0036 
0037 if nargin >4,
0038     data.Ag0 = varargin{4};
0039     data.AgP = varargin{5};
0040     data.F0 = varargin{6};
0041 else,
0042     data.Ag0 = [0.  0.0   0;tf  0.0   1];
0043     data.AgP = [0.  0.1  0;tf  0.2  1];
0044     data.F0 = [0.  100.  0;tf  100.  1];
0045 end
0046 
0047 % file containing formant ranges
0048 diva_data;
0049 
0050 % Setup preemphasis parameters
0051 preemp = -0.95;
0052 
0053 % Iterate through each vocal tract configuration
0054 for i=1:size(X,2),   
0055     [F,B,A,Af] = doAM(X(:,i));
0056     if length(F)<3,
0057         F(length(F)+1:3) = NaN;
0058         F = F(:);
0059     end;
0060     
0061     data.Af = [];data.dx = [];
0062     data.Af(:,1) = Af(1,:)';
0063     data.Af(:,2) = Af(1,:)';
0064     data.dx = mean(Af(2,:));
0065     
0066     % Determine the acoustic signal
0067     out = diva_synth2(data);
0068     
0069     % Preemphasize
0070     y = filter([1 preemp],1,out);    
0071     % Get the LPC coefficients
0072     [A,G]=lpc(hamming(length(y)).*y(:),14);
0073     A = real(A);
0074     
0075     % find the formants
0076     if length(find(isnan(A)))==0,
0077         F1 = frmnts1(A(:),data.fs);
0078     else,
0079         F1 = zeros(3,1);
0080     end;
0081     
0082     F1 = F1(1:3);
0083     F1 = F1(:);
0084     Fmts(:,i) = F1;
0085     LPCcoeff(:,i) = A(:);
0086     
0087     % Determine validity of formants
0088     idxValid(i) = 0;
0089     if ( ...
0090             sum(abs(F1-F(1:3))<[25;50;100])==3 & ...
0091             (F(1)>minF1) & (F(1)<maxF1) & ...
0092             (F(2)>minF2) & (F(2)<maxF2) & ...
0093             (F(3)>minF3) & (F(3)<maxF3)),
0094         idxValid(i) = 1;
0095     end;
0096 end

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