dc_blocker_plots.py (633B)
1 import numpy as np 2 import matplotlib.pyplot as plt 3 import audio_dspy as adsp 4 5 FS = 48000 6 7 worN = np.logspace(1, 2, 500) 8 9 # 12 dB/Oct filters 10 freq = [45, 40, 35] 11 legend = [] 12 for fc in freq: 13 b, a = adsp.design_HPF2(fc, 0.7071, FS) 14 adsp.plot_magnitude_response(b, a, fs=FS, worN=worN) 15 legend.append(f'12 dB Slope, fc={fc}') 16 17 # 24 dB/Oct fitler 18 freq = 35 19 sos = adsp.design_HPFN(freq, 0.7071, 4, FS) 20 adsp.plot_magnitude_response_sos(sos, fs=FS, worN=worN) 21 legend.append(f'24 dB Slope, fc={freq}') 22 23 plt.grid(which='both') 24 plt.ylim([-30, 3]) 25 26 plt.legend(legend, loc='lower right') 27 plt.title('DC Blockers Comparison') 28 plt.show()