如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
短时能量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)]);
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]);
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);
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;%短时能量阈值
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=sum(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;
switchstatus
case{0,1}%0=静音,1=可能开始
ifamp(n)>amp1%确信进入语音段
x1=max(n-count-1,1);%记录语音段的起始点
status=2;
silence=0;
count=count+1;
elseifamp(n)>amp2||zcr(n)>zcr2%可能处于语音段
status=1;
count=count+1;
else%静音状态
status=0;
count=0;
end
case2,%2=语音段
ifamp(n)>amp2||zcr(n)>zcr2%保持在语音段
count=count+1;
else%语音将结束
silence=silence+1;
ifsilence<minsilence%静音还不够长,尚未结束
count=count+1;
elseifcount<minlen%语音长度太短,认为是噪声
status=0;