MFCC程序-Matlab-代码实现对WAV文件MFCC参数提取和图形表示

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

[xfs]=wavread('speech.wav');bank=melbankm(24,256,fs,0,0.4,'m');%Mel滤波器的阶数为24,fft变换的长度为256,采样频率为8000Hz%归一化mel滤波器组系数bank=full(bank);bank=bank/max(bank(:));fork=1:12%归一化mel滤波器组系数n=0:23;dctcoef(k,:)=cos((2*n+1)*k*pi/(2*24));endw=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);%对x256点分为一帧%计算每帧的MFCC参数fori=1:size(xx,1)y=xx(i,:);s=y'.*hamming(256);t=abs(fft(s));%fft快速傅立叶变换t=t.^2;c1=dctcoef*log(bank*t(1:129));c2=c1.*w';m(i,:)=c2';end%求取差分系数dtm=zeros(size(m));fori=3:size(m,1)-2dtm(i,:)=-2*m(i-2,:)-m(i-1,:)+m(i+1,:)+2*m(i+2,:);enddtm=dtm/3;%合并mfcc参数和一阶差分mfcc参数ccc=[mdtm];%去除首尾两帧,因为这两帧的一阶差分参数为0ccc=ccc(3:size(m,1)-2,:);subplot(2,1,1)ccc_1=ccc(:,1);plot(ccc_1);title('MFCC');ylabel('幅值');[h,w]=size(ccc);A=size(ccc);subplot(212)plot([1,w],A);xlabel('维数');ylabel('幅值');title('维数与幅值的关系')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[xfs]=wavread('shibie.wav');bank=melbankm(24,256,fs,0,0.4,'m');bank=full(bank);bank=bank/max(bank(:));fork=1:12n=0:23;dctcoef(k,:)=cos((2*n+1)*k*pi/(2*24));endw=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);fori=1:size(xx,1)y=xx(i,:);s=y'.*hamming(256);t=abs(fft(s));t=t.^2;c1=dctcoef*log(bank*t(1:129));c2=c1.*w';m(i,:)=c2';enddtm=zeros(size(m));fori=3:size(m,1)-2dtm(i,:)=-2*m(i-2,:)-m(i-1,:)+m(i+1,:)+2*m(i+2,:);enddtm=dtm/3;ccc=[mdtm];ccc=ccc(3:size(m,1)-2,:);subplot(2,1,1)ccc_1=ccc(:,1);plot(ccc_1);title('MFCC');ylabel('幅值');[h,w]=size(ccc);A=size(ccc);subplot(2,1,2)plot([1,w],A);xlabel('维数');ylabel('幅值');title('维数与幅值的关系')

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功