# Pre-Emphasis Filter / CodeSnippet_PEFilter.txt

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37``` ```#Code for Preemphasis filter in fm_emph.py. class fm_preemph(gr.hier_block): """ FM Preemphasis IIR filter. """ def __init__(self, fg, fs, tau1=50e-6, f2): """ @param fg: flow graph @type fg: gr.flow_graph @param fs: sampling frequency in Hz @type fs: float @param tau1: Time constant in seconds (75us in US, 50us in EUR) @type tau1: float @param f2: cutoff frequency in Hz,choose f2 > f1 ( f1 is 2.12KHz in US, 3.2KHz in EUR) @type f2: float """ tau2=tau1/(2*math.pi*f2*tau1-1) w_1=1/tau1 w_2=1/tau2 w_p1=math.tan(w_1/(fs*2)) w_p2=math.tan(w_2/(fs*2)) b0=(w_p2+1)/(1+w_p1+w_p2) b1=(w_p2-1)/(1+w_p1+w_p2) a1=(w_p1+w_p2-1)/(w_p1+w_p2+1) btaps = [b0,b1] ataps = [1,a1] if 0: print "btaps =", btaps print "ataps =", ataps global plot2 plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) preemph = gr.iir_filter_ffd(10*btaps, ataps) gr.hier_block.__init__(self, fg, preemph, preemph) ```
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.