V_GLOTROS Rosenberg glottal model U=(D,T,P) d is derivative of flow waveform t is in fractions of a cycle p has parameters p(1)=closure time p(2)=+ve/-ve slope ratio
0001 function u=v_glotros(d,t,p) 0002 %V_GLOTROS Rosenberg glottal model U=(D,T,P) 0003 % d is derivative of flow waveform 0004 % t is in fractions of a cycle 0005 % p has parameters 0006 % p(1)=closure time 0007 % p(2)=+ve/-ve slope ratio 0008 0009 0010 0011 % Copyright (C) Mike Brookes 1998 0012 % Version: $Id: v_glotros.m 10865 2018-09-21 17:22:45Z dmb $ 0013 % 0014 % VOICEBOX is a MATLAB toolbox for speech processing. 0015 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0016 % 0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0018 % This program is free software; you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation; either version 2 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % This program is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You can obtain a copy of the GNU General Public License from 0029 % http://www.gnu.org/copyleft/gpl.html or by writing to 0030 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 0033 if nargin < 2 0034 tt=(0:99)'/100; 0035 else 0036 tt=mod(t,1); 0037 end 0038 u=zeros(size(tt)); 0039 de=[0.6 0.5]'; 0040 if nargin < 3 0041 p=de; 0042 elseif length(p)<2 0043 p=[p(:); de(length(p)+1:2)]; 0044 end 0045 pp=p(1)/(1+p(2)); 0046 ta=tt<pp; 0047 tb=tt<p(1) & ~ta; 0048 wa=pi/pp; 0049 wb=0.5*pi/(p(1)-pp); 0050 fb=wb*pp; 0051 if d==0 0052 u(ta)=0.5*(1-cos(wa*tt(ta))); 0053 u(tb)=cos(wb*tt(tb)-fb); 0054 elseif d==1 0055 u(ta)=0.5*wa*sin(wa*tt(ta)); 0056 u(tb)=-wb*sin(wb*tt(tb)-fb); 0057 elseif d==2 0058 u(ta)=0.5*wa^2.*cos(wa*tt(ta)); 0059 u(tb)=-wb^2*cos(wb*tt(tb)-fb); 0060 else 0061 error('Derivative must be 0,1 or 2'); 0062 end 0063