%filter_demo.m % Demonstration of filtering on speech signals % Yao Wang, 1/19/2001 close all clear all [y,fs]=wavread('morning.wav'); sound(y,fs); pause; figure(1); subplot(3,3,1), plot(y);pause; x=y(10000:12000);pause; subplot(3,3,2),plot(x);axis([1,2000,-0.1,0.1]); pause; subplot(3,3,3),psd(y,256,fs);pause; h1=fir1(10,0.5); %design a filter with cutoff at fs/4 subplot(3,3,4),plot(h1);pause [hf1,w]=freqz(h1,[1],256); %filter frequency response subplot(3,3,5),plot(w,abs(hf1));pause z1=conv(y,h1); sound(z1,fs);pause subplot(3,3,6),psd(z1,256,fs);pause wavwrite(z1,fs,'morning_h1.wav'); h2=fir1(10,0.125); %design a filter with cutoff at fs/8 subplot(3,3,7);plot(h2);pause; [hf2,w]=freqz(h2,[1],256); subplot(3,3,8),plot(w,abs(hf2));pause; z2=conv(y,h2); sound(z2,fs);pause; subplot(3,3,9);psd(z2,256,fs);pause wavwrite(z2,fs,'morning_h2.wav');