Home > @d_opvt > synth1.m

synth1

PURPOSE ^

SYNTH1 Synthesizes the output from the vocal tract

SYNOPSIS ^

function y = synth1(vtm,varargin)

DESCRIPTION ^

 SYNTH1    Synthesizes the output from the vocal tract
   The function has two different forms:
       1. Y = synth1(vtm,data);
           In this case the input data contains the following
           subfields: Ag0, AgP, F0, Af, dx, fs, duration
       2. Y = synth1(vtm,X,fs,tf,Ag0,AgP,F0);
           In this case, the fields of data are passed individually
           to the funtion
   Please consult Maeda's paper for a better understanding of the inputs

   The typical form of the parameters Ag0, AgP and F0 are of the form:
   [timestamp1 value1 interpolation_scheme1;timestamp2 value2 interpolation_scheme2; ...]
   where interpolation_scheme takes values: 
           0 - set
           1 - linear interpolation
           2 - exponential interpolation

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function y = synth1(vtm,varargin)
0002 % SYNTH1    Synthesizes the output from the vocal tract
0003 %   The function has two different forms:
0004 %       1. Y = synth1(vtm,data);
0005 %           In this case the input data contains the following
0006 %           subfields: Ag0, AgP, F0, Af, dx, fs, duration
0007 %       2. Y = synth1(vtm,X,fs,tf,Ag0,AgP,F0);
0008 %           In this case, the fields of data are passed individually
0009 %           to the funtion
0010 %   Please consult Maeda's paper for a better understanding of the inputs
0011 %
0012 %   The typical form of the parameters Ag0, AgP and F0 are of the form:
0013 %   [timestamp1 value1 interpolation_scheme1;timestamp2 value2 interpolation_scheme2; ...]
0014 %   where interpolation_scheme takes values:
0015 %           0 - set
0016 %           1 - linear interpolation
0017 %           2 - exponential interpolation
0018 
0019 % Satrajit Ghosh, SpeechLab, Boston University. (c)2001
0020 % $Header: /mnt/localhd/cvsdir/MODELLING/NEWDIVA/@d_opvt/synth1.m,v 1.1.1.1 2006/10/06 18:20:23 brumberg Exp $
0021 
0022 % $NoKeywords: $
0023 
0024 % Setup globals
0025 global RELEASE
0026 
0027 % If there are only two inputs, assume that the second input is
0028 % the struct containing information about the production
0029 if nargin == 2,
0030     if isstruct(varargin{1}),
0031         data = varargin{1};
0032         y = diva_synth2(data);
0033         return;
0034     end;
0035 end;
0036 
0037 X = varargin{1};
0038 
0039 % Setup the data structure
0040 % a. sampling rate
0041 if (nargin>2),
0042     data.fs = varargin{2};
0043 else,
0044     data.fs = 10000;
0045 end;
0046 
0047 % b. duration of utterance
0048 if nargin>3,
0049     data.duration = varargin{3};
0050 else,
0051     data.duration = 300;
0052 end;
0053 tf = data.duration;
0054 
0055 % c. Fields, ag0,agP,F0
0056 if nargin >4,
0057     data.Ag0 = varargin{4};
0058     data.AgP = varargin{5};
0059     data.F0 = varargin{6};
0060 else,
0061     data.Ag0 = [0.  0.0   0;tf  0.0   1];
0062     data.AgP = [0.  0.1   0;tf  0.2   1];
0063     data.F0  = [0.  100.  0;tf  100.  1];
0064 end
0065 
0066 % Iterate through inputs.
0067 for i=1:size(X,2),   
0068     [F,B,A,Af] = doAM(X(:,i));
0069     data.Af = [];data.dx = [];
0070     data.Af(:,1) = Af(1,:)';
0071     data.Af(:,2) = Af(1,:)';
0072     data.dx = mean(Af(2,:));
0073     
0074     out = diva_synth2(data);
0075     
0076     % set output to zero if area function is too small
0077     if min(data.Af(:,1))<1e-1,
0078         y(:,i) = zeros(size(out));
0079     else,
0080         y(:,i) = out;
0081     end;    
0082 end

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