def __init__(self, mode, input_rate, context): channels = 2 audio_rate = 10000 gr.hier_block2.__init__( self, str('%s demodulator' % (mode,)), gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float * channels)) self.__input_rate = input_rate self.__rec_freq_input = 0.0 self.__signal_type = SignalType(kind='STEREO', sample_rate=audio_rate) # Using agc2 rather than feedforward AGC for efficiency, because this runs at the RF rate rather than the audio rate. agc_block = analog.agc2_cc(reference=dB(-8)) agc_block.set_attack_rate(8e-3) agc_block.set_decay_rate(8e-3) agc_block.set_max_gain(dB(40)) self.connect( self, agc_block) channel_joiner = blocks.streams_to_vector(gr.sizeof_float, channels) self.connect(channel_joiner, self) for channel in xrange(0, channels): self.connect( agc_block, grfilter.fir_filter_ccc(1, design_sawtooth_filter(decreasing=channel == 0)), blocks.complex_to_mag(1), blocks.float_to_complex(), # So we can use the complex-input band filter. TODO eliminate this for efficiency MultistageChannelFilter( input_rate=input_rate, output_rate=audio_rate, cutoff_freq=5000, transition_width=5000), blocks.complex_to_real(), # assuming below 40Hz is not of interest grfilter.dc_blocker_ff(audio_rate // 40, False), (channel_joiner, channel))
def __init__(self, mode, input_rate, context): channels = 2 audio_rate = 10000 gr.hier_block2.__init__( self, str('%s demodulator' % (mode,)), gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float * channels)) self.__input_rate = input_rate self.__rec_freq_input = 0.0 self.__signal_type = SignalType(kind='STEREO', sample_rate=audio_rate) # Using agc2 rather than feedforward AGC for efficiency, because this runs at the RF rate rather than the audio rate. agc_block = analog.agc2_cc(reference=dB(-8)) agc_block.set_attack_rate(8e-3) agc_block.set_decay_rate(8e-3) agc_block.set_max_gain(dB(40)) self.connect( self, agc_block) channel_joiner = blocks.streams_to_vector(gr.sizeof_float, channels) self.connect(channel_joiner, self) for channel in six.moves.range(0, channels): self.connect( agc_block, grfilter.fir_filter_ccc(1, design_sawtooth_filter(decreasing=channel == 0)), blocks.complex_to_mag(1), blocks.float_to_complex(), # So we can use the complex-input band filter. TODO eliminate this for efficiency MultistageChannelFilter( input_rate=input_rate, output_rate=audio_rate, cutoff_freq=5000, transition_width=5000), blocks.complex_to_real(), # assuming below 40Hz is not of interest grfilter.dc_blocker_ff(audio_rate // 40, False), (channel_joiner, channel))