FRMNTS1 Determine the formants given the LPC coefficients The function determines the formans by taking the roots of the LPC polynomial. For further details, see digital speech processing by Rabiner and Shafer Input: a : LPC coefficients fs : Sampling frequency
0001 function [F]=frmnts1(a,fs) 0002 % FRMNTS1 Determine the formants given the LPC coefficients 0003 % The function determines the formans by taking the roots of the 0004 % LPC polynomial. For further details, see digital speech processing 0005 % by Rabiner and Shafer 0006 % Input: a : LPC coefficients 0007 % fs : Sampling frequency 0008 0009 % Satrajit Ghosh, SpeechLab, Boston University. (c)2001 0010 % $Header: /mnt/localhd/cvsdir/MODELLING/NEWDIVA/@d_opvt/private/frmnts1.m,v 1.1.1.1 2006/10/06 18:20:23 brumberg Exp $ 0011 0012 % $NoKeywords: $ 0013 0014 % Setup globals 0015 global RELEASE 0016 0017 const=fs/(2*pi); 0018 rts=roots(a); 0019 k=1; 0020 save = []; 0021 0022 for i=1:length(a)-1 0023 re=real(rts(i)); 0024 im=imag(rts(i)); 0025 0026 formn=const*atan2(im,re); %formant frequencies 0027 bw=-2*const*log(abs(rts(i))); %formant bandwidth 0028 0029 % If the bandwidths and formants are reasonable, save them 0030 if formn>90 & bw <700 & formn<4000 0031 save(k)=formn; 0032 bandw(k)=bw; 0033 k=k+1; 0034 end 0035 0036 end 0037 0038 [y, ind]=sort(save); 0039 F = [NaN NaN NaN]; 0040 F(1:min(3,length(y))) = y(1:min(3,length(y)));