# template file for Lab #6, Task #5 import numpy import matplotlib.pyplot as p import lab6 from lab6_1 import freq_res_usr from lab6_2 import zfreqs_to_usr # return unit-sample response for a single-frequency notch # filter at the specified frequency def notch_one_freq(freq): pass # your code here # Using notch_one_freq, create a notch filter at the frequency # of the hum (you'll have to convert 400Hz to the appropriate # omega), and then apply the filter to a numpy array of audio # samples. def eliminate_hum(audio_samples): pass # your code here if __name__ == '__main__': # plot freq response of notch_one_freq @ pi/2 omega_notch, mag_hejw_notch = \ freq_res_usr(notch_one_freq(numpy.pi/2)) lab6.plot_freq_response(omega_notch,mag_hejw_notch, 'notch filter @ $\Omega=\pi/2$') print "Please close plot window to start audio playback." p.show() # Read in the good sound and play without_hum = lab6.read_sound('without_hum.wav') lab6.play_sound(without_hum) # Read in the corrupted sound and play with_hum = lab6.read_sound('with_hum.wav') lab6.play_sound(with_hum) # Filter the sound and play hum_removed = eliminate_hum(with_hum) lab6.play_sound(hum_removed)