M_pitch = fftshift(rceps(Frame)); subplot(2,1,1),plot(M_pitch);grid; xlabel('speech frame');ylabel('/dB'); title('real cepstrum of original wave'); subplot(2,1,2),plot(pitch);grid; xlabel('speech');ylabel('/dB');
title('real cepstrum of predicted error'); pause
%画出语谱图
ai1 = lpc(I,P); % 计算原始语音lpc系数
LP1 = filter([0 -ai(2:end)],1,I); % 建立原始语音的正则方程 subplot(2,1,1); specgram(I,N,N/2,N);
title('yuan shi yu yin de yu pu tu'); subplot(2,1,2);
specgram(LP1,N,N/2,N);
title('yu ce yu yin de yu pu tu');
(2)、MFCC: close all clear clc
[x]=wavread('1.wav');
bank=melbankm(24,510,8000,0,0.5,'m'); bank=full(bank);
bank=bank/max(bank(:));
for k=1:12 n=0:23;
dctcoef(k,:)=cos((2*n+1)*k*pi/(2*24)); end
w = 1 + 6 * sin(pi * [1:12] ./ 12); w = w/max(w);
% 预加重滤波器 xx=double(x);
xx=filter([1 -0.9375],1,xx);
% 语音信号分帧
xx=enframe(xx,256,80);
% 计算每帧的MFCC参数 for i=1:size(xx,1) y = xx(i,:);
s = y' .* hamming(256); t = abs(fft(s)); t = t.^2;
c1=dctcoef * log(bank * t); c2 = c1.*w'; m(i,:)=c2'; end figure
plot(m);xlabel('frames');ylabel('amplitude');title('MFCC');
六、实验结果与分析 1、LPC
图 2.1
图2.2
图2.3
2、MFCC
图2.4
图2.5
从图中可以看出:在信号能量较大的区域即接近谱的峰值处,LPC谱和信号谱很接近;而在信号能量较低的区域即接近谱的谷底处,则相差比较大。这个特点对于呈现谐波结构的浊音语音谱来说,就是在谐波成分处LPC谱匹配信号谱的效果要远比谐波之间好得多。LPC谱估计的这一特点实际上来自均方误差最小准则。