欢迎光临程序员联合开发网(www.pudn.com)
源代码在线查看: 语音的倒谱分析.txt
%求语音的倒谱分析,p231(数字语音处理)。
clc;
tic,
[y,fs]=wavread('d:\MATLAB701\work\sound\A.wav');
L=length(y)/512;
for i=1:L
y1=y(1+(i-1)*512:i*512).*hamming(512);
%y1=y(1:1024).*hamming(1024);
t=(1/fs:1/fs:length(y1)/fs)*1000;
subplot(221);plot(t,y1);axis tight;
x=fft(y1);
for i=1:length(x)-1;
if x(i,1)==0
x(i,1)=x(i+1,1);
end
end
a=2*log2(abs(x));
%a=fftshift(a);%平移频率谱。
%f=((1:(length(a)/2))/fs)*1000;
subplot(222);
%plot(f,a(1:length(a)/2));axis tight;
plot(a(1:length(a)/2));
b=ifft(a);
t=(1/fs:1/fs:length(b)/2/fs)*1000; % ms
subplot(223);plot(t,b(1:length(b)/2));axis tight;
%subplot(224);plot(abs(b));axis tight;
axis tight;
%怎么用升余弦窗???
t=1:size(b)/8;
xy=(1+cos(2*pi*(t-100)/100))/2;
%b2=b(1:length(t)).*xy';
%plot(b);
%figure;plot(b2);axis tight;
pause
clc;
end
toc,