2 # Copyright 2006,2007 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 3, 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_block2):
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
33 @param channel_rate: incoming sample rate of the AM baseband
34 @type sample_rate: integer
35 @param audio_decim: input to output decimation rate
36 @type audio_decim: integer
37 @param audio_pass: audio low pass filter passband frequency
38 @type audio_pass: float
39 @param audio_stop: audio low pass filter stop frequency
40 @type audio_stop: float
42 def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop):
43 gr.hier_block2.__init__(self, "am_demod_cf",
44 gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
45 gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
47 MAG = gr.complex_to_mag()
48 DCR = gr.add_const_ff(-1.0)
50 audio_taps = optfir.low_pass(0.5, # Filter gain
51 channel_rate, # Sample rate
52 audio_pass, # Audio passband
53 audio_stop, # Audio stopband
54 0.1, # Passband ripple
55 60) # Stopband attenuation
56 LPF = gr.fir_filter_fff(audio_decim, audio_taps)
58 self.connect(self, MAG, DCR, LPF, self)
60 class demod_10k0a3e_cf(am_demod_cf):
62 AM demodulation block, 10 KHz channel.
64 This block demodulates an AM channel conformant to 10K0A3E emission
65 standards, such as broadcast band AM transmissions.
67 @param channel_rate: incoming sample rate of the AM baseband
68 @type sample_rate: integer
69 @param audio_decim: input to output decimation rate
70 @type audio_decim: integer
72 def __init__(self, channel_rate, audio_decim):
73 am_demod_cf.__init__(self, channel_rate, audio_decim,
74 5000, # Audio passband
75 5500) # Audio stopband