资源描述:
《基于matlab语音端点检测》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、短时能量matlab实现:[x]=wavread('song1.wav');x=x/max(abs(x));figure;subplot(3,1,1);plot(x);axis([1length(x)-11]);ylabel('Speech');FrameLen=240;FrameInc=80;yframe=enframe(x,FrameLen,FrameInc);amp1=sum(abs(yframe),2);subplot(3,1,2);plot(amp1);axis([1length(amp1)0max(amp1
2、)]);ylabel('Amplitude');legend('amp1=∑│x│');amp2=sum(abs(yframe.*yframe),2);subplot(3,1,3);plot(amp2);axis([1length(amp2)0max(amp2)]);ylabel('Energy');legend('amp1=∑│x*x│');短时过零率matlab实现:[x]=wavread('song1.wav');figure;subplot(3,1,1);plot(x);axis([1length(x)-11]
3、);ylabel('Speech');FrameLen=240;FrameInc=80;amp=sum(abs(enframe(filter([1-0.9375],1,x),FrameLen,FrameInc)),2);subplot(312)plot(amp);axis([1length(amp)0max(amp)])ylabel('Energy');tmp1=enframe(x(1:end-1),FrameLen,FrameInc);tmp2=enframe(x(2:end),FrameLen,FrameInc);
4、signs=(tmp1.*tmp2)<0;diffs=(tmp1-tmp2)>0.02;zcr=sum(signs.*diffs,2);subplot(3,1,3);plot(zcr);axis([1length(zcr)0max(zcr)])ylabel('ZCR');语音信号的端点检测matlab实现:[x,fs,nbits]=wavread('song1.wav');x=x/max(abs(x));%幅度归一化到[-1,1]%参数设置FrameLen=256;%帧长inc=90;%未重叠部分amp1=10;%短时
5、能量阈值amp2=2;zcr1=10;%过零率阈值zcr2=5;minsilence=6;%用无声的长度来判断语音是否结束minlen=15;%判断是语音的最小长度status=0;%记录语音段的状态count=0;%语音序列的长度silence=0;%无声的长度%计算过零率tmp1=enframe(x(1:end-1),FrameLen,inc);tmp2=enframe(x(2:end),FrameLen,inc);signs=(tmp1.*tmp2)<0;diffs=(tmp1-tmp2)>0.02;zcr=su
6、m(signs.*diffs,2);%计算短时能量amp=sum((abs(enframe(filter([1-0.9375],1,x),FrameLen,inc))).^2,2);%调整能量门限amp1=min(amp1,max(amp)/4);amp2=min(amp2,max(amp)/8);%开始端点检测forn=1:length(zcr)goto=0;switchstatuscase{0,1}%0=静音,1=可能开始ifamp(n)>amp1%确信进入语音段x1=max(n-count-1,1);%记录语音段
7、的起始点status=2;silence=0;count=count+1;elseifamp(n)>amp2
8、
9、zcr(n)>zcr2%可能处于语音段status=1;count=count+1;else%静音状态status=0;count=0;endcase2,%2=语音段ifamp(n)>amp2
10、
11、zcr(n)>zcr2%保持在语音段count=count+1;else%语音将结束silence=silence+1;ifsilence12、seifcount