2 # Copyright 2006 Free Software Foundation, Inc.
4 # This file is part of GNU Radio
6 # GNU Radio is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # GNU Radio is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Radio; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street,
19 # Boston, MA 02110-1301, USA.
22 from gnuradio import gr, optfir
24 class am_demod_cf(gr.hier_block):
26 Generalized AM demodulation block with audio filtering.
28 This block demodulates a band-limited, complex down-converted AM
29 channel into the the original baseband signal, applying low pass
30 filtering to the audio output. It produces a float stream in the
34 @param channel_rate: incoming sample rate of the AM baseband
35 @type sample_rate: integer
36 @param audio_decim: input to output decimation rate
37 @type audio_decim: integer
38 @param audio_pass: audio low pass filter passband frequency
39 @type audio_pass: float
40 @param audio_stop: audio low pass filter stop frequency
41 @type audio_stop: float
43 def __init__(self, fg, channel_rate, audio_decim, audio_pass, audio_stop):
44 MAG = gr.complex_to_mag()
45 DCR = gr.add_const_ff(-1.0)
47 audio_taps = optfir.low_pass(0.5, # Filter gain
48 channel_rate, # Sample rate
49 audio_pass, # Audio passband
50 audio_stop, # Audio stopband
51 0.1, # Passband ripple
52 60) # Stopband attenuation
53 LPF = gr.fir_filter_fff(audio_decim, audio_taps)
55 fg.connect(MAG, DCR, LPF)
56 gr.hier_block.__init__(self, fg, MAG, LPF)
58 class demod_10k0a3e_cf(am_demod_cf):
60 AM demodulation block, 10 KHz channel.
62 This block demodulates an AM channel conformant to 10K0A3E emission
63 standards, such as broadcast band AM transmissions.
66 @param channel_rate: incoming sample rate of the AM baseband
67 @type sample_rate: integer
68 @param audio_decim: input to output decimation rate
69 @type audio_decim: integer
71 def __init__(self, fg, channel_rate, audio_decim):
72 am_demod_cf.__init__(self, fg, channel_rate, audio_decim,
73 5000, # Audio passband
74 5500) # Audio stopband