diff --git a/Tools/FMGenerateFilterCoefficients.py b/Tools/FMGenerateFilterCoefficients.py index 7d8a3db..4eb81d8 100644 --- a/Tools/FMGenerateFilterCoefficients.py +++ b/Tools/FMGenerateFilterCoefficients.py @@ -17,30 +17,30 @@ f2 = 2700 rp = 0.2 # scaling factor in bits, do not change ! -q = 0 +q = 15 # scaling factor as facor... scaling_factor = 2**q # let's generate a sequence of 2nd order IIR filters sos = signal.cheby1(3,rp,[f1, f2],'bandpass', output='sos', fs=fs) -#sos = signal.cheby1(1, rp, 2122, 'lowpass', output='sos', fs=fs) #deemphasis filter +#os = signal.cheby1(4, rp, f2, 'lowpass', output='sos', fs=fs) #deemphasis filter #sos = signal.cheby1(1, rp, 2122, 'highpass', output='sos', fs=fs) #deemphasis filter -#sos = np.round((sos) * scaling_factor) +sosrounded = np.round((sos) * scaling_factor) # print coefficients -for biquad in sos: +for biquad in sosrounded: for coeff in biquad: - #print(int(coeff),",",sep="",end="") - print((coeff),",",sep="",end="") + print(int(coeff),",",sep="",end="") + #print((coeff),",",sep="",end="") print("") # plot the frequency response b,a = signal.sos2tf(sos) -w,h = signal.freqz(b,a) +w,h = signal.freqz(b,a, worN=2048) pl.plot(w/np.pi/2*fs,20*np.log(np.abs(h))) pl.xlabel('frequency/Hz'); pl.ylabel('gain/dB'); -pl.ylim(top=1,bottom=-20); +pl.ylim(top=1,bottom=-30); pl.xlim(left=250, right=12000); pl.show() \ No newline at end of file