clear
load('HW7_bonus.mat')

Wp=;
Ws=;
Rp=;
Rs=;
[N,Wc]=;        
[b,a]=;         


[bz,az]=bilinear(b,a,fs); 
filtered_sound=filter(bz,az,noised_audio);
figure(1) 
freqz(bz,az,1000); 
figure(2)
subplot(121) 
plot(noised_audio) 
title('noisy audio') 
subplot(122) 
plot(filtered_sound) 
title('noise free data')

figure(3)
subplot(121) 
[s,f,t]=spectrogram(noised_audio,512,512*3/4,512,fs);
imagesc(t,f,20*log10(abs(s)))
title('noisy audio')
set(gca, 'YDir','normal')
subplot(122) 
[s,f,t]=spectrogram(filtered_sound,512,512*3/4,512,fs);
imagesc(t,f,20*log10(abs(s)))
set(gca, 'YDir','normal')
title('noise free data')

disp('Playing noisy audio... Press any button after audio is played')
tmp = audioplayer(noised_audio, fs);
play(tmp);
pause
disp('Playing filtered audio')
tmp = audioplayer(filtered_sound, fs);
play(tmp);

