project2-2.m

来自「training and then recognition of a spesi」· M 代码 · 共 34 行

M
34
字号
% a section of vowel
[x,fs]=wavread('C:\Users\FARZANEH\Desktop\New Folder\bahar.wav');
% fourier transform of windowed signal
Y=fft(x.*hamming(length(x)));
% cepstrum is DFT of log spectrum
C=fft(log(abs(Y)+eps));
% LPC calculation
L=lpc(C,8); 
% getting other sections for training and calculation of cepstrum and LPC
[x1,fs1]=wavread('C:\Users\FARZANEH\Desktop\New Folder\bahar-6.wav');
Y1=fft(x1.*hamming(length(x1)));
C1=fft(log(abs(Y1)+eps));
L1=lpc(C1,8);
[x2,fs2]=wavread('C:\Users\FARZANEH\Desktop\New Folder\bahar-7.wav');
Y2=fft(x2.*hamming(length(x2)));
C2=fft(log(abs(Y2)+eps));
L2=lpc(C2,8);
[x3,fs3]=wavread('C:\Users\FARZANEH\Desktop\New Folder\bahar-8.wav');
Y3=fft(x3.*hamming(length(x3)));
C3=fft(log(abs(Y3)+eps));
L3=lpc(C3,8);
l=(L+L1+L2+L3)/4;
% getting the fifth vowel for recognition
[x4,fs4]=wavread('C:\Users\FARZANEH\Desktop\New Folder\zamin.wav');
Y4=fft(x4.*hamming(length(x4)));
C4=fft(log(abs(Y4)+eps));
L4=lpc(C4,8);
d=(abs(l-L4)).^2;
s=sum(d);
 if (s>0.003)
fprintf('that is not a correct word');
   else 
      fprintf('that is a correct word');
    end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?