www.pudn.com > SpeechTestDTW.rar > ModelCalc.m


function ModelCalc 
clear; 
for j=1:10 
    fname=sprintf('ref%d.wav',mod(j,10));  
    [y,fs,NBITS]=wavread(fname); 
    [rx1,rx2,rframe]=frameDetect(y,fs); 
%     rvector=ones(12,rx2-rx1+1); 
    for i=1:rx2-rx1+1 
        [rA,rB,rK,rR]=Durbin(rframe(i,:)); 
%         rA=abs(lpc(rframe(i,:),12)); 
%        rC=Cepstrum(rA',60); 
         rvector(:,i)=rA'; 
    end 
    filename=sprintf('%d.mat',mod(j,10)); 
    fid=fopen(filename,'w'); 
    if fid==-1  
        fprintf('Can''t open the file!\n'); 
        return; 
    end 
    rc=size(rvector); 
    if rc(1)*rc(2)==0 
        fprintf('Model Error!\n'); 
        return; 
    end         
    fwrite(fid,rc,'int32'); 
    count=fwrite(fid,rvector,'double'); 
    fclose('all'); 
    if count==0 
        fprintf('Write Error!\n'); 
        return; 
    end 
    clear; 
end