预览加载中,请您耐心等待几秒...
1/5
2/5
3/5
4/5
5/5

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

[转帖]小波去噪matlab程序 ****************************************** clear clc %在噪声环境下语音信号的增强 %语音信号为读入的声音文件 %噪声为正态随机噪声 sound=wavread('c12345.wav'); count1=length(sound); noise=0.05*randn(1,count1); fori=1:count1 signal(i)=sound(i); end fori=1:count1 y(i)=signal(i)+noise(i); end %在小波基'db3'下进行一维离散小波变换 [coefs1,coefs2]=dwt(y,'db3');%[低频高频] count2=length(coefs1); count3=length(coefs2); energy1=sum((abs(coefs1)).^2); energy2=sum((abs(coefs2)).^2); energy3=energy1+energy2; fori=1:count2 recoefs1(i)=coefs1(i)/energy3; end fori=1:count3 recoefs2(i)=coefs2(i)/energy3; end %低频系数进行语音信号清浊音的判别 zhen=160; count4=fix(count2/zhen); fori=1:count4 n=160*(i-1)+1:160+160*(i-1); s=sound(n); w=hamming(160); sw=s.*w; a=aryule(sw,10); sw=filter(a,1,sw); sw=sw/sum(sw); r=xcorr(sw,'biased'); corr=max(r); %为清音(unvoice)时,输出为1;为浊音(voice)时,输出为0 ifcorr>=0.8 output1(i)=0; elseifcorr<=0.1 output1(i)=1; end end fori=1:count4 n=160*(i-1)+1:160+160*(i-1); ifoutput1(i)==1 switchabs(recoefs1(i)) caseabs(recoefs1(i))<=0.002 recoefs1(i)=0; caseabs(recoefs1(i))>0.002&abs(recoefs1(i))<=0.003 recoefs1(i)=sgn(recoefs1(i))*(0.003*abs(recoefs1(i))-0.000003)/0.002; otherwiserecoefs1(i)=recoefs1(i); end elseifoutput1(i)==0 recoefs1(i)=recoefs1(i); end end %对高频系数进行语音信号清浊音的判别 count5=fix(count3/zhen); fori=1:count5 n=160*(i-1)+1:160+160*(i-1); s=sound(n); w=hamming(160); sw=s.*w; a=aryule(sw,10); sw=filter(a,1,sw); sw=sw/sum(sw); r=xcorr(sw,'biased'); corr=max(r); %为清音(unvoice)时,输出为1;为浊音(voice)时,输出为0 ifcorr>=0.8 output2(i)=0; elseifcorr<=0.1 output2(i)=1; end end fori=1:count5 n=160*(i-1)+1:160+160*(i-1); ifoutput2(i)==1 switchabs(recoefs2(i)) caseabs(recoefs2(i))<=0.002 recoefs2(i)=0; caseabs(recoefs2(i))>0.002&abs(recoefs2(i))<=0.003 recoefs2(i)=sgn(recoefs2(i))*(0.003*abs(recoefs2(i))-0.000003)/0.002; otherwiserecoefs2(i)=recoefs2(i); end elseifoutput2(i)==0 recoefs2(i)=recoefs2(i); end end %在小波基'db3'下进行一维离散小波反变换 output3=idwt(re