1、 %回放语音title(语音信号时域波形图)y=fft(x,3260);f=(FS/3260)*1:1630; subplot(2,1,2);plot(f(1:1630),abs(y(1:1630);语音信号频谱图%产生噪声信号并加到语音信号t=0:length(x)-1;zs0=0.05*cos(2*pi*100*t/22050);figure(2);subplot(2,1,1)plot(zs0)噪声信号波形zs1=fft(zs0,1200);%sound(zs0,FS,bits);%回放噪音 f=(FS/1200)*1:600;subplot(2,1,2)600),abs(zs1(1:60
2、0);噪声信号频谱x1=x+zs0;%sound(x1,FS,bits); %回放加入噪声后的语音y1=fft(x1,1200);figure(3);plot(x1);600),abs(y1(1:加入噪声后的信号波形加入噪声后的信号频谱%加窗滤波wp=0.25*pi;ws=0.3*pi;wdelta=ws-wp;N=ceil(6.6*pi/wdelta); %取整(size(x1)-1);wn=(0.2+0.3)*pi/2;b=fir1(N,wn/pi,hamming(N+1); %选择窗函数,并归一化截止频率f1=fftfilt(b,x1);figure(4)freqz(b,1,512)h1
3、,w1=freqz(b,1);plot(w1*FS/(2*pi),20*log10(abs(h1);figure(5)plot(t,x1)滤波前的时域波形plot(t,f1);滤波后的时域波形sound(f1); %播放滤波后的语音信号F0=fft(f1,1024);f=FS*(0:511)/1024;figure(6)y2=fft(x1,1024);plot(f,abs(y2(1:512); %画出滤波前的频谱图滤波前的频谱xlabel(Hzylabel(fuzhiF1=plot(f,abs(F0(1: %画出滤波后的频谱图滤波后的频谱巴特沃兹低通滤波器:f=(FS/1630)*1:zs=0
4、.05*cos(2*pi*10000*t/22050);zs0=0.05*cos(2*pi*10000*t/22050000);zs1=fft(zs,1200);%sound(zs,FS,bits); %回放噪音 x1=x+zssound(x1,FS,bits);%低通滤波fp=3000;fs=3500;rp=1;rs=10;wp=2*pi*fp/Fs;ws=2*pi*fs/Fs;Fs1=1;wap=2*tan(wp/2);was=2*tan(ws/2);N,wc=buttord(wap,was,rp,rs,sB,A=butter(N,wc,Bz,Az=bilinear(B,A,Fs1);fi
5、gure(4);h,w=freqz(Bz,Az,512,Fs1*22050);plot(w,abs(h);巴特沃斯低通滤波器频率(HZ)耗损(dB)grid on;yd=filter(Bz,Az,x1);figure(5);plot(yd); title(滤波后信号波形ydd=fft(yd,1200);600),abs(ydd(1:滤波后信号频谱%sound(yd,FS,bits);巴特沃兹高通滤波器:zs0=0.25*cos(2*pi*100*t/22050);%高通滤波fp=400;fs=300;T=1;high,巴特沃斯高通滤波器%sound(yd,FS,bits)巴特沃兹带通滤波器:%
6、带通滤波fp=800,9000;fs=700,10000;巴特沃斯带通滤波器Blackman加窗高通滤波器:%高通加窗滤波fp=600,fc=400;wp=2*pi*fp/FS;ws=2*pi*fc/FS;Bt=wp-ws;N0=ceil(11*pi/Bt);N=N0+mod(N0+1,2);wc=(wp+ws)/2/pi;hn=fir1(N-1,wc,blackman(N);X=conv(hn,x);%sound(X,FS,bits);X1=fft(X,1200);subplot(211);plot(X);滤波后的信号波形subplot(212);600),abs(X1(1:滤波后的信号频谱
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1