def __init__(self, mode, deviation=75000, demod_rate=48000, post_demod_rate=None, band_filter=None, band_filter_transition=None, tau=75e-6, **kwargs): SimpleAudioDemodulator.__init__(self, mode=mode, demod_rate=demod_rate, band_filter=band_filter, band_filter_transition=band_filter_transition, **kwargs) input_rate = self.input_rate audio_rate = self.audio_rate audio_decim = int(demod_rate / post_demod_rate) self.post_demod_rate = demod_rate / audio_decim self.demod_block = analog.fm_demod_cf( channel_rate=demod_rate, audio_decim=audio_decim, deviation=deviation, audio_pass=post_demod_rate * 0.5 - 1000, audio_stop=post_demod_rate * 0.5, tau=tau, ) self.do_connect()
def __init__(self, center_freq=867.4105, find_chan_nums=False, freq_list=[866.0375, 866.2875, 866.5375, 866.7875, 867.0375, 867.2875, 867.5375, 867.7875, 868.0375, 868.2875, 868.5375, 868.7875, 866.0625, 866.3125, 866.5625, 866.8125, 867.0625, 867.3125, 867.5625, 867.8125], noise_threshold=5, sink_rate=48000, source_rate=4000000, talkgroup=1796, tone_threshold=0.1, track_analog=True, track_digital=True, voice_threshold=0.4): gr.hier_block2.__init__( self, "Trunked Radio", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signaturev(2, 2, [gr.sizeof_float*1, gr.sizeof_char*1]), ) ################################################## # Parameters ################################################## self.center_freq = center_freq self.find_chan_nums = find_chan_nums self.freq_list = freq_list self.noise_threshold = noise_threshold self.sink_rate = sink_rate self.source_rate = source_rate self.talkgroup = talkgroup self.tone_threshold = tone_threshold self.track_analog = track_analog self.track_digital = track_digital self.voice_threshold = voice_threshold ################################################## # Variables ################################################## self.baud_rate = baud_rate = 9600 self.samp_per_sym = samp_per_sym = sink_rate / baud_rate self.fp_sel_index = fp_sel_index = 0 ################################################## # Blocks ################################################## self.edacs_handle_eot_0 = edacs.handle_eot(sink_rate, 4800, tone_threshold, noise_threshold) def _fp_sel_index_probe(): while True: val = self.edacs_handle_eot_0.get_sel_index() try: self.set_fp_sel_index(val) except AttributeError: pass time.sleep(1.0 / (100)) _fp_sel_index_thread = threading.Thread(target=_fp_sel_index_probe) _fp_sel_index_thread.daemon = True _fp_sel_index_thread.start() self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=int(sink_rate / 8000), decimation=1, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=int(sink_rate / 1000), decimation=int(source_rate / 1000), taps=None, fractional_bw=None) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(sink_rate / 1000), decimation=int(source_rate / 100000), taps=None, fractional_bw=None) self.low_pass_filter_0 = filter.fir_filter_ccf( 100, firdes.low_pass( 1, source_rate, .00625e6, .002e6, firdes.WIN_HAMMING, 6.76)) self.edacs_proc_msg_0 = edacs.proc_msg(talkgroup, freq_list, center_freq, find_chan_nums, track_analog, track_digital) self.edacs_find_chan_nums_0 = edacs.find_chan_nums(freq_list, center_freq, source_rate, voice_threshold) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_PROVOICE,dsd.dsd_MOD_AUTO_SELECT,3,False,3) self.digital_gfsk_demod_0 = digital.gfsk_demod( samples_per_symbol=int(samp_per_sym), sensitivity=1.0, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False) self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb('010101010101010101010111000100100101010101010101', 0) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_not_xx_0 = blocks.not_bb() self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1-fp_sel_index) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1024) self.blocks_add_xx_0 = blocks.add_vff(1) self.analog_sig_source_x_1 = analog.sig_source_c(source_rate, analog.GR_COS_WAVE, 0, 1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c(source_rate, analog.GR_COS_WAVE, 0, 1, 0, 0) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=sink_rate, audio_decim=1, deviation=7000, audio_pass=6.25e3, audio_stop=10e3, gain=2.0, tau=75e-6, ) ################################################## # Connections ################################################## self.msg_connect((self.edacs_find_chan_nums_0, 'status_out'), (self.edacs_proc_msg_0, 'chan_status_in')) self.msg_connect((self.edacs_handle_eot_0, 'status_out'), (self.edacs_proc_msg_0, 'eot_status_in')) self.msg_connect((self.edacs_proc_msg_0, 'ctrl_freq'), (self.analog_sig_source_x_0, 'freq')) self.msg_connect((self.edacs_proc_msg_0, 'voice_freq'), (self.analog_sig_source_x_1, 'freq')) self.msg_connect((self.edacs_proc_msg_0, 'chan_status_out'), (self.edacs_find_chan_nums_0, 'status_in')) self.msg_connect((self.edacs_proc_msg_0, 'eot_status_out'), (self.edacs_handle_eot_0, 'status_in')) self.connect((self.analog_fm_demod_cf_0, 0), (self.edacs_handle_eot_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_add_xx_0, 0), (self, 0)) self.connect((self.blocks_delay_0, 0), (self.edacs_find_chan_nums_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.blocks_not_xx_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_not_xx_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.digital_correlate_access_code_bb_0, 0)) self.connect((self.digital_correlate_access_code_bb_0, 0), (self.edacs_proc_msg_0, 0)) self.connect((self.digital_gfsk_demod_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.edacs_handle_eot_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.edacs_handle_eot_0, 0), (self.dsd_block_ff_0, 0)) self.connect((self.edacs_proc_msg_0, 0), (self, 1)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self, 0), (self.blocks_delay_0, 0)) self.connect((self, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gfsk_demod_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_add_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "rx APT") Qt.QWidget.__init__(self) self.setWindowTitle("rx APT") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.path_to_save_dir = path_to_save_dir = os.path.expanduser( "~/Desktop") self.samp_rate = samp_rate = 2205000 self.rf_gain = rf_gain = 20 self.if_gain = if_gain = 40 self.freq = freq = 137.62e6 self.file_path = file_path = path_to_save_dir + "/APT_" + datetime.now( ).strftime("%d%m%Y_%H%M") ################################################## # Blocks ################################################## self._rf_gain_range = Range(0, 45, 5, 20, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'RF Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._rf_gain_win) self._if_gain_range = Range(1, 80, 5, 40, 200) self._if_gain_win = RangeWidget(self._if_gain_range, self.set_if_gain, 'IF Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._if_gain_win) self._freq_options = ( 137.62e6, 137.9125e6, 137.1e6, 99.8e6, ) self._freq_labels = ( 'NOAA-15 (137.62MHz)', 'NOAA-18 (137.9125MHz)', 'NOAA-19 (137.1MHz)', 'Test FM', ) self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel('Frequency' + ": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_grid_layout.addWidget(self._freq_tool_bar) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(rf_gain, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.uhd_usrp_source_0.set_bandwidth(samp_rate, 0) self.uhd_usrp_source_0.set_auto_dc_offset(True, 0) self.uhd_usrp_source_0.set_auto_iq_balance(True, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=samp_rate / 44100, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.low_pass_filter_1 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 40000, 4100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff( 1, firdes.low_pass(5, 11025, 2400, 100, firdes.WIN_HAMMING, 6.76)) self.fractional_interpolator_xx_0_0 = filter.fractional_interpolator_ff( 0, 4.8 / 4.16) self.fractional_interpolator_xx_0 = filter.fractional_interpolator_ff( 0, 1.1484375) self.blocks_wavfile_sink_1 = blocks.wavfile_sink( file_path + "_rawIQ.wav", 2, samp_rate, 8) self.blocks_wavfile_sink_0_0 = blocks.wavfile_sink( file_path + ".wav", 1, 4160, 8) self.blocks_wavfile_sink_0 = blocks.wavfile_sink( file_path + ".wav", 1, 11025, 8) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (if_gain, )) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, file_path + ".dat", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_deinterleave_0 = blocks.deinterleave( gr.sizeof_float * 1, 1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.audio_sink_0 = audio.sink(44100, '', False) self.analog_rail_ff_0 = analog.rail_ff(0, 1) self.analog_fm_demod_cf_0_0 = analog.fm_demod_cf( channel_rate=44100, audio_decim=1, deviation=75000, audio_pass=18000, audio_stop=20000, gain=1.0, tau=75e-6, ) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=44100, audio_decim=4, deviation=75000, audio_pass=15000, audio_stop=16000, gain=1.0, tau=75e-6, ) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 255) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_fm_demod_cf_0_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_rail_ff_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_wavfile_sink_1, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_wavfile_sink_1, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.fractional_interpolator_xx_0_0, 0)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.fractional_interpolator_xx_0, 0), (self.blocks_deinterleave_0, 0)) self.connect((self.fractional_interpolator_xx_0_0, 0), (self.analog_rail_ff_0, 0)) self.connect((self.fractional_interpolator_xx_0_0, 0), (self.blocks_wavfile_sink_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fractional_interpolator_xx_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_fm_demod_cf_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self, win, sat_name, mode_name, nbfm = True): gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" FM", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_gr_complex)) self.trans_fm = trans_fm = 1500 self.samp_rate = samp_rate = 2048000 self.mode = mode = 1 self.decim = decim = 8 self.low_pass_filter = filter.fir_filter_ccf(4, filter.firdes.low_pass( 1, samp_rate/decim, 10000, trans_fm, filter.firdes.WIN_HAMMING, 6.76)) if nbfm: self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=5000, audio_pass=4500, audio_stop=4900, gain=1.0, tau=75e-6, ) else: if mode_name == 'APT': self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=17000, audio_pass=5300, audio_stop=5500, gain=1.0, tau=75e-6, ) else: self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=45000, audio_pass=17000, audio_stop=18000, gain=1.0, tau=75e-6, ) self.fftsink_audio = fftsink2.fft_sink_f( win, baseband_freq=0, y_per_div=5, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=32000, fft_size=1024, fft_rate=15, average=True, avg_alpha=None, title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")", peak_hold=True, ) self.connect(self, (self.low_pass_filter, 0)) self.connect((self.low_pass_filter, 0), (self.fm_demod, 0)) self.connect((self.fm_demod, 0), (self.fftsink_audio, 0)) self.connect((self.fm_demod, 0), self)
def __init__(self, win, sat_name, mode_name, nbfm = True): gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" FM", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_gr_complex)) self.trans_fm = trans_fm = 1500 self.samp_rate = samp_rate = 2048000 self.mode = mode = 1 self.decim = decim = 8 self.low_pass_filter = filter.fir_filter_ccf(4, filter.firdes.low_pass( 1, samp_rate/decim, 10000, trans_fm, filter.firdes.WIN_HAMMING, 6.76)) if nbfm: self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=5000, audio_pass=4500, audio_stop=4900, gain=1.0, tau=75e-6, ) else: if mode_name == 'APT': self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=17000, audio_pass=5300, audio_stop=5500, gain=1.0, tau=75e-6, ) else: self.fm_demod = analog.fm_demod_cf( channel_rate=64000, audio_decim=2, deviation=45000, audio_pass=17000, audio_stop=18000, gain=1.0, tau=75e-6, ) self.fftsink_audio = fftsink2.fft_sink_f( win, baseband_freq=0, y_per_div=5, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=32000, fft_size=1024, fft_rate=15, average=True, avg_alpha=None, title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")", peak_hold=True, ) self.connect(self, (self.low_pass_filter, 0)) self.connect((self.low_pass_filter, 0), (self.fm_demod, 0)) self.connect((self.fm_demod, 0), (self.fftsink_audio, 0)) self.connect((self.fm_demod, 0), self)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="NBFM Receiver/Deviation Meter") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.volume = volume = .4 self.thresh = thresh = -24 self.samp_rate = samp_rate = 2.40e6 self.ramp = ramp = 1 self.alpha = alpha = .01 self.RF_Gain = RF_Gain = 50 self.Freq = Freq = 144.39 ################################################## # Blocks ################################################## _volume_sizer = wx.BoxSizer(wx.VERTICAL) self._volume_text_box = forms.text_box( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, label="Volume", converter=forms.float_converter(), proportion=0, ) self._volume_slider = forms.slider( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, minimum=0, maximum=3, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_volume_sizer, 1, 1, 1, 1) _thresh_sizer = wx.BoxSizer(wx.VERTICAL) self._thresh_text_box = forms.text_box( parent=self.GetWin(), sizer=_thresh_sizer, value=self.thresh, callback=self.set_thresh, label="Squelch", converter=forms.float_converter(), proportion=0, ) self._thresh_slider = forms.slider( parent=self.GetWin(), sizer=_thresh_sizer, value=self.thresh, callback=self.set_thresh, minimum=-70, maximum=0, num_steps=70, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_thresh_sizer, 2, 1, 1, 1) self._ramp_text_box = forms.text_box( parent=self.GetWin(), value=self.ramp, callback=self.set_ramp, label="Ramp", converter=forms.float_converter(), ) self.GridAdd(self._ramp_text_box, 3, 0, 1, 1) self._alpha_text_box = forms.text_box( parent=self.GetWin(), value=self.alpha, callback=self.set_alpha, label="alpha", converter=forms.float_converter(), ) self.GridAdd(self._alpha_text_box, 3, 1, 1, 1) _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL) self._RF_Gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_RF_Gain_sizer, value=self.RF_Gain, callback=self.set_RF_Gain, label="RF Gain", converter=forms.float_converter(), proportion=0, ) self._RF_Gain_slider = forms.slider( parent=self.GetWin(), sizer=_RF_Gain_sizer, value=self.RF_Gain, callback=self.set_RF_Gain, minimum=0, maximum=50, num_steps=50, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_RF_Gain_sizer, 2, 0, 1, 1) self._Freq_text_box = forms.text_box( parent=self.GetWin(), value=self.Freq, callback=self.set_Freq, label="Frequency (MHz)", converter=forms.float_converter(), ) self.GridAdd(self._Freq_text_box, 1, 0, 1, 1) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=48000, v_scale=2, v_offset=0, t_scale=2e-3, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="KHz Deviation", ) self.GridAdd(self.wxgui_scopesink2_0.win, 0, 0, 1, 1) self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(38.55e-3, 1) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(Freq*1e6, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(0, 0) self.rtlsdr_source_0.set_gain(RF_Gain, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(1, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.low_pass_filter_0 = filter.fir_filter_ccf(50, firdes.low_pass( 1, samp_rate, 7.5e3, 3e3, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((6.5, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, )) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(thresh, alpha, ramp, False) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=48000, audio_decim=1, deviation=10000, audio_pass=3500, audio_stop=4000,gnu gain=1.0, tau=1e-6, ) ################################################## # Connections ################################################## self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.single_pole_iir_filter_xx_0, 0)) self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 60000 self.symbol_period = symbol_period = pow(symbol_rate,-1) self.samp_rate = samp_rate = 300e3 self.samp_per_sym = samp_per_sym = 5 self.packet_len = packet_len = 256 self.decimation = decimation = 1 self.bits_per_sym = bits_per_sym = 1 self.Sq_Thresh = Sq_Thresh = -30 self.RF_Gain = RF_Gain = 20 self.Fc = Fc = 175e6 ################################################## # Blocks ################################################## _Sq_Thresh_sizer = wx.BoxSizer(wx.VERTICAL) self._Sq_Thresh_text_box = forms.text_box( parent=self.GetWin(), sizer=_Sq_Thresh_sizer, value=self.Sq_Thresh, callback=self.set_Sq_Thresh, label="Squelch Threshold", converter=forms.float_converter(), proportion=0, ) self._Sq_Thresh_slider = forms.slider( parent=self.GetWin(), sizer=_Sq_Thresh_sizer, value=self.Sq_Thresh, callback=self.set_Sq_Thresh, minimum=-50, maximum=20, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_Sq_Thresh_sizer, 0, 2, 1, 1) _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL) self._RF_Gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_RF_Gain_sizer, value=self.RF_Gain, callback=self.set_RF_Gain, label="RF Gain", converter=forms.float_converter(), proportion=0, ) self._RF_Gain_slider = forms.slider( parent=self.GetWin(), sizer=_RF_Gain_sizer, value=self.RF_Gain, callback=self.set_RF_Gain, minimum=0, maximum=50, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_RF_Gain_sizer, 0, 0, 1, 1) _Fc_sizer = wx.BoxSizer(wx.VERTICAL) self._Fc_text_box = forms.text_box( parent=self.GetWin(), sizer=_Fc_sizer, value=self.Fc, callback=self.set_Fc, label="Center Frequency", converter=forms.float_converter(), proportion=0, ) self._Fc_slider = forms.slider( parent=self.GetWin(), sizer=_Fc_sizer, value=self.Fc, callback=self.set_Fc, minimum=50e6, maximum=1700e6, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_Fc_sizer, 0, 1, 1, 1) self.osmosdr_source_0_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'rtl_tcp=10.0.0.13:1234' ) self.osmosdr_source_0_0.set_sample_rate(samp_rate) self.osmosdr_source_0_0.set_center_freq(Fc+10e6, 0) self.osmosdr_source_0_0.set_freq_corr(0, 0) self.osmosdr_source_0_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0_0.set_gain_mode(False, 0) self.osmosdr_source_0_0.set_gain(RF_Gain, 0) self.osmosdr_source_0_0.set_if_gain(0, 0) self.osmosdr_source_0_0.set_bb_gain(0, 0) self.osmosdr_source_0_0.set_antenna("", 0) self.osmosdr_source_0_0.set_bandwidth(0, 0) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'rtl_tcp=10.0.0.12:1234' ) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(Fc, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(0, 0) self.osmosdr_source_0.set_if_gain(0, 0) self.osmosdr_source_0.set_bb_gain(0, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.blocks_skiphead_0_0 = blocks.skiphead(gr.sizeof_gr_complex*1, int(samp_rate)*5) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, int(samp_rate)*5) self.blocks_pack_k_bits_bb_0_0 = blocks.pack_k_bits_bb(8) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_float_to_char_0_0 = blocks.float_to_char(1, 1) self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) self.blks2_tcp_sink_0_0_0 = grc_blks2.tcp_sink( itemsize=gr.sizeof_char*1, addr="127.0.0.1", port=3493, server=True, ) self.blks2_tcp_sink_0_0 = grc_blks2.tcp_sink( itemsize=gr.sizeof_char*1, addr="127.0.0.1", port=3491, server=True, ) self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_cc(Sq_Thresh, 0.01, 5, True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(-10, 0.01, 5, True) self.analog_fm_demod_cf_0_0 = analog.fm_demod_cf( channel_rate=samp_rate, audio_decim=decimation, deviation=75e3, audio_pass=120e3, audio_stop=140e3, gain=1.0, tau=75e-6, ) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=samp_rate, audio_decim=decimation, deviation=75e3, audio_pass=120e3, audio_stop=140e3, gain=1.0, tau=75e-6, ) self.RPi_Rx_RPi_Rx_0_0 = RPi_Rx.RPi_Rx(bits_per_sym, samp_per_sym, packet_len, 65) self.RPi_Rx_RPi_Rx_0 = RPi_Rx.RPi_Rx(bits_per_sym, samp_per_sym, packet_len, 65) ################################################## # Connections ################################################## self.connect((self.analog_fm_demod_cf_0, 0), (self.RPi_Rx_RPi_Rx_0, 0)) self.connect((self.RPi_Rx_RPi_Rx_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.RPi_Rx_RPi_Rx_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.blocks_skiphead_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blks2_tcp_sink_0_0, 0)) self.connect((self.blocks_float_to_char_0_0, 0), (self.blocks_pack_k_bits_bb_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0_0, 0), (self.blks2_tcp_sink_0_0_0, 0)) self.connect((self.analog_fm_demod_cf_0_0, 0), (self.RPi_Rx_RPi_Rx_0_0, 0)) self.connect((self.RPi_Rx_RPi_Rx_0_0, 0), (self.blocks_null_sink_0_0, 0)) self.connect((self.RPi_Rx_RPi_Rx_0_0, 0), (self.blocks_float_to_char_0_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.analog_fm_demod_cf_0_0, 0)) self.connect((self.blocks_skiphead_0_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) self.connect((self.osmosdr_source_0_0, 0), (self.blocks_skiphead_0_0, 0))
def __init__(self): gr.top_block.__init__(self) options = get_options() self.ifreq = options.frequency self.rfgain = options.gain self.src = osmosdr.source(options.args) self.src.set_center_freq(self.ifreq) self.src.set_sample_rate(int(options.sample_rate)) if self.rfgain is None: self.src.set_gain_mode(1) self.iagc = 1 self.rfgain = 0 else: self.iagc = 0 self.src.set_gain_mode(0) self.src.set_gain(self.rfgain) # may differ from the requested rate sample_rate = self.src.get_sample_rate() sys.stderr.write("sample rate: %d\n" % (sample_rate)) bitrate = 8000 first_decim = 125 out_sample_rate = sample_rate / first_decim sys.stderr.write("output sample rate: %d\n" % (out_sample_rate)) sps = out_sample_rate / bitrate sys.stderr.write("samples per symbol: %d\n" % (sps)) self.offset = options.offset sys.stderr.write("offset is: %dHz\n" % self.offset) taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, filter.firdes.WIN_HANN) self.tuner = filter.freq_xlating_fir_filter_ccf( first_decim, taps, self.offset, sample_rate) self.demod = digital.gmsk_demod(samples_per_symbol=sps) self.output = blocks.file_sink(gr.sizeof_char, options.output_file) self.connect((self.src, 0), (self.tuner, 0)) self.connect((self.tuner, 0), (self.demod, 0)) self.connect((self.demod, 0), (self.output, 0)) self.fm_demod = analog.fm_demod_cf(sample_rate / first_decim, 1, 5000, 3000, 4000) self.integrate = blocks.integrate_ff(32000) self.probe = blocks.probe_signal_f() self.connect((self.tuner, 0), (self.fm_demod, 0)) self.connect((self.fm_demod, 0), (self.integrate, 0)) self.connect((self.integrate, 0), (self.probe, 0)) def _variable_function_probe_0_probe(): while True: freq = self.tuner.center_freq() freq2 = freq + 0.2 * self.probe.level() print "Autotune: fix=%f old=%i new=%i" % ( self.probe.level(), self.ifreq + freq, self.ifreq + freq2) self.tuner.set_center_freq(freq2) time.sleep(5.0) _variable_function_probe_0_thread = threading.Thread( target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start()
def configure_blocks(self, protocol): if protocol == 'provoice' or protocol == 'analog_edacs': protocol = 'analog' self.log.debug('configure_blocks(%s)' % protocol) if not (protocol == 'p25' or protocol == 'p25_tdma' or protocol == 'p25_cqpsk' or protocol == 'p25_cqpsk_tdma' or protocol == 'provoice' or protocol == 'dsd_p25' or protocol == 'analog' or protocol == 'none'): raise Exception('Invalid protocol %s' % protocol) if self.protocol == protocol: return True self.lock() if self.protocol == 'analog': self.disconnect(self.source, self.signal_squelch, self.audiodemod, self.high_pass, self.resampler, self.sink) self.signal_squelch = None self.audiodemod = None self.high_pass = None self.resampler = None elif self.protocol == 'p25' or 'p25_tdma': try: self.disconnect(self.source, self.prefilter, self.fm_demod) #, (self.subtract,0)) self.disconnect(self.fm_demod, self.symbol_filter, self.demod_fsk4, self.slicer, self.decoder, self.float_conversion, self.sink) self.disconnect(self.slicer, self.decoder2, self.qsink) self.demod_watcher.keep_running = False except: pass #self.disconnect(self.fm_demod, self.avg, self.mult, (self.subtract,1)) self.prefilter = None self.fm_demod = None #self.avg = None #self.mult = None #self.subtract = None self.symbol_filter = None self.demod_fsk4 = None self.slicer = None self.decoder = None self.decoder2 = None self.qsink = None self.imbe = None self.float_conversion = None self.resampler = None elif self.protocol == 'p25_cqpsk' or self.protocol == 'p25_cqpsk_tdma': self.disconnect(self.source, self.resampler, self.agc, self.symbol_filter_c, self.clock, self.diffdec, self.to_float, self.rescale, self.slicer, self.decoder2, self.qsink) #, (self.subtract,0)) self.disconnect(self.slicer, self.decoder, self.float_conversion, self.sink) self.prefilter = None self.resampler = None self.agc = None self.symbol_filter_c = None self.clock = None self.diffdec = None self.to_float = None self.rescale = None self.slicer = None self.imbe = None self.decodequeue3 = None self.decodequeue2 = None self.decodequeue = None self.demod_watcher = None self.decoder = None self.decoder2 = None self.qsink = None self.float_conversion = None elif self.protocol == 'provoice': self.disconnect(self.source, self.fm_demod, self.resampler_in, self.dsd, self.out_squelch, self.sink) self.fm_demod = None self.resampler_in = None self.dsd = None self.out_squelch = None elif self.protocol == 'dsd_p25': self.disconnect(self.source, self.fm_demod, self.resampler_in, self.dsd, self.sink) self.fm_demod = None self.resampler_in = None self.dsd = None self.protocol = protocol if protocol == 'analog': self.signal_squelch = analog.pwr_squelch_cc(-100, 0.01, 0, True) #self.tone_squelch = gr.tone_squelch_ff(audiorate, 4800.0, 0.05, 300, 0, True) #tone squelch is EDACS ONLY self.audiodemod = analog.fm_demod_cf( channel_rate=self.input_rate, audio_decim=1, deviation=15000, audio_pass=(self.input_rate * 0.25), audio_stop=((self.input_rate * 0.25) + 2000), gain=8, tau=75e-6) self.high_pass = filter.fir_filter_fff( 1, firdes.high_pass(1, self.input_rate, 300, 30, firdes.WIN_HAMMING, 6.76)) self.resampler = filter.rational_resampler_fff( interpolation=8000, decimation=self.input_rate, taps=None, fractional_bw=None, ) self.connect(self.source, self.signal_squelch, self.audiodemod, self.high_pass, self.resampler, self.sink) elif protocol == 'p25' or protocol == 'p25_tdma': self.symbol_deviation = symbol_deviation = 600.0 if protocol == 'p25_tdma': symbol_rate = 6000 else: symbol_rate = 4800 channel_rate = self.input_rate self.prefilter = filter.freq_xlating_fir_filter_ccc( 1, (1, ), 0, self.input_rate) fm_demod_gain = channel_rate / (2.0 * pi * symbol_deviation) self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) #self.avg = blocks.moving_average_ff(1000, 1, 4000) #self.mult = blocks.multiply_const_vff((0.001, )) #self.subtract = blocks.sub_ff(1) symbol_decim = 1 samples_per_symbol = channel_rate // symbol_rate symbol_coeffs = (1.0 / samples_per_symbol, ) * samples_per_symbol self.symbol_filter = filter.fir_filter_fff(symbol_decim, symbol_coeffs) autotuneq = gr.msg_queue(2) self.demod_fsk4 = op25.fsk4_demod_ff(autotuneq, channel_rate, symbol_rate) # symbol slicer levels = [-2.0, 0.0, 2.0, 4.0] self.slicer = op25.fsk4_slicer_fb(levels) self.imbe = repeater.vocoder(False, True, 0, "", 0, False) self.decodequeue3 = decodequeue3 = gr.msg_queue(10000) self.decodequeue2 = decodequeue2 = gr.msg_queue(10000) self.decodequeue = decodequeue = gr.msg_queue(10000) self.demod_watcher = None #demod_watcher(decodequeue2, self.adjust_channel_offset) self.decoder = repeater.p25_frame_assembler( '', 0, 0, True, True, False, decodequeue2, True, (True if protocol == 'p25_tdma' else False)) self.decoder2 = repeater.p25_frame_assembler( '', 0, 0, False, True, False, decodequeue3, False, False) self.qsink = blocks.message_sink(gr.sizeof_char, self.decodequeue, False) self.float_conversion = blocks.short_to_float(1, 8192) self.connect(self.source, self.prefilter, self.fm_demod) #, (self.subtract,0)) #self.connect(self.fm_demod, self.symbol_filter, self.demod_fsk4, self.slicer, self.decoder, self.imbe, self.float_conversion, self.sink) self.connect(self.fm_demod, self.symbol_filter, self.demod_fsk4, self.slicer, self.decoder, self.float_conversion, self.sink) self.connect(self.slicer, self.decoder2, self.qsink) #self.connect(self.fm_demod, self.avg, self.mult, (self.subtract,1)) elif protocol == 'p25_cqpsk' or protocol == 'p25_cqpsk_tdma': self.symbol_deviation = symbol_deviation = 600.0 self.resampler = blocks.multiply_const_cc(1.0) self.agc = analog.feedforward_agc_cc(1024, 1.0) self.symbol_filter_c = blocks.multiply_const_cc(1.0) gain_mu = 0.025 if protocol == 'p25_cqpsk_tdma': symbol_rate = 6000 else: symbol_rate = 4800 omega = float(self.input_rate) / float(symbol_rate) gain_omega = 0.1 * gain_mu * gain_mu alpha = 0.04 beta = 0.125 * alpha * alpha fmax = 1200 # Hz fmax = 2 * pi * fmax / float(self.input_rate) self.clock = repeater.gardner_costas_cc(omega, gain_mu, gain_omega, alpha, beta, fmax, -fmax) self.diffdec = digital.diff_phasor_cc() self.to_float = blocks.complex_to_arg() self.rescale = blocks.multiply_const_ff((1 / (pi / 4))) # symbol slicer levels = [-2.0, 0.0, 2.0, 4.0] self.slicer = op25.fsk4_slicer_fb(levels) #self.imbe = repeater.vocoder(False, True, 0, "", 0, False) self.decodequeue3 = decodequeue3 = gr.msg_queue(2) self.decodequeue2 = decodequeue2 = gr.msg_queue(2) self.decodequeue = decodequeue = gr.msg_queue(10000) #self.demod_watcher = demod_watcher(decodequeue2, self.adjust_channel_offset) self.decoder = repeater.p25_frame_assembler( '', 0, 0, True, True, False, decodequeue2, True, (False if protocol == 'p25_cqpsk' else True)) self.decoder2 = repeater.p25_frame_assembler( '', 0, 0, False, True, True, decodequeue3, False, False) #temp for debug #self.debug_sink = blocks.file_sink(1, '/dev/null') #self.connect(self.slicer, self.debug_sink) self.qsink = blocks.message_sink(gr.sizeof_char, self.decodequeue, False) self.float_conversion = blocks.short_to_float(1, 8192) self.connect(self.source, self.resampler, self.agc, self.symbol_filter_c, self.clock, self.diffdec, self.to_float, self.rescale, self.slicer, self.decoder2, self.qsink) #, (self.subtract,0)) self.connect(self.slicer, self.decoder, self.float_conversion, self.sink) elif protocol == 'provoice': fm_demod_gain = 0.6 self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) self.resampler_in = filter.rational_resampler_fff( interpolation=48000, decimation=self.input_rate, taps=None, fractional_bw=None, ) self.dsd = dsd.block_ff(dsd.dsd_FRAME_PROVOICE, dsd.dsd_MOD_AUTO_SELECT, 3, 0, False) self.out_squelch = analog.pwr_squelch_ff(-100, 0.01, 0, True) self.connect(self.source, self.fm_demod, self.resampler_in, self.dsd, self.out_squelch, self.sink) elif protocol == 'dsd_p25': symbol_deviation = 600.0 fm_demod_gain = 0.4 #self.input_rate / (2.0 * pi * symbol_deviation) self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) self.resampler_in = filter.rational_resampler_fff( interpolation=48000, decimation=self.input_rate, taps=None, fractional_bw=None, ) self.dsd = dsd.block_ff(dsd.dsd_FRAME_P25_PHASE_1, dsd.dsd_MOD_AUTO_SELECT, 3, 3, False) self.connect(self.source, self.fm_demod, self.resampler_in, self.dsd, self.sink) self.unlock()
def __init__(self, sample_rate, freq_offset, sys_id, chan, group_id, save_dir): gr.hier_block2.__init__( self, "SmartZone Audio Channel", gr.io_signature(1, 1, gr.sizeof_gr_complex), # input signature gr.io_signature(0, 0, 0), # output signature ) # audio constants self._audio_sample_rate = 8000 self._audio_passband = 3.6e3 self._audio_stopband = 4e3 self._audio_gain = 1.0 # fm constants self._deviation = 2.5e3 self._fm_passband = self._audio_stopband + self._deviation self._fm_stopband = self._fm_passband + 8e3 # 3 * audio_bw # fm channel values desired_channel_rate = 40e3 channel_decimation = int(round(sample_rate / desired_channel_rate)) channel_rate = sample_rate / channel_decimation # audio channel values desired_audio_rate = 8e3 audio_decimation = int(round(channel_rate / desired_audio_rate)) audio_rate = channel_rate / audio_decimation # translate desired fm audio frequency to baseband; decimate to channel rate channel_taps = optfir.low_pass(1, sample_rate, self._fm_passband, self._fm_stopband, 0.1, 60) channel_filter = filter.freq_xlating_fir_filter_ccf( channel_decimation, optfir.low_pass(1, sample_rate, self._fm_passband, self._fm_stopband, 0.1, 60), freq_offset, sample_rate, ) # power squelch squelch = analog.pwr_squelch_cc(-50, alpha=1, ramp=0, gate=True) # fm demodulation audio_demod = analog.fm_demod_cf( channel_rate, audio_decimation, self._deviation, self._audio_passband, self._audio_stopband, self._audio_gain, 75e-6, ) # remove sub-audible data XXX demodulate sa_filter = filter.fir_filter_fff(1, firdes.band_pass(1, audio_rate, 400, 3900, 100, filter.firdes.WIN_HANN)) # audio output # ensure directory exists create_directory(save_dir, sys_id) # asink = audio.sink(audio_rate) wavfile_sink = blocks.wavfile_sink( "%s/%x/%s" % (save_dir, sys_id, audio_name(group_id, chan)), 1, int(round(audio_rate)), 8 ) self.connect(self, channel_filter, squelch, audio_demod, sa_filter, wavfile_sink)
def __init__(self): gr.top_block.__init__(self, "VOR Decoder") Qt.QWidget.__init__(self) self.setWindowTitle("VOR Decoder") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "vor_playback_sigmf_3") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250e3 self.throttle_rate = throttle_rate = 1 self.nfft = nfft = 512 self.fine = fine = 1e3 self.delay = delay = 440 self.avg = avg = 100.0 self.audio_rate = audio_rate = samp_rate / 5 / 25 * 24 self.audio_gain = audio_gain = 1 ################################################## # Blocks ################################################## self._throttle_rate_tool_bar = Qt.QToolBar(self) self._throttle_rate_tool_bar.addWidget( Qt.QLabel("throttle_rate" + ": ")) self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate)) self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit) self._throttle_rate_line_edit.returnPressed.connect( lambda: self.set_throttle_rate( eng_notation.str_to_num( str(self._throttle_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num( str(self._samp_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._delay_tool_bar = Qt.QToolBar(self) self._delay_tool_bar.addWidget(Qt.QLabel('delay' + ": ")) self._delay_line_edit = Qt.QLineEdit(str(self.delay)) self._delay_tool_bar.addWidget(self._delay_line_edit) self._delay_line_edit.returnPressed.connect(lambda: self.set_delay( int(str(self._delay_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._delay_tool_bar, 2, 4, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._avg_tool_bar = Qt.QToolBar(self) self._avg_tool_bar.addWidget(Qt.QLabel('avg' + ": ")) self._avg_line_edit = Qt.QLineEdit(str(self.avg)) self._avg_tool_bar.addWidget(self._avg_line_edit) self._avg_line_edit.returnPressed.connect(lambda: self.set_avg( eng_notation.str_to_num(str(self._avg_line_edit.text().toAscii()))) ) self.top_grid_layout.addWidget(self._avg_tool_bar, 1, 6, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self.sigmf_source_0 = gr_sigmf.source( '/captures/20191228/VOR_2019-12-28T19:07:15Z.sigmf-data', "cf32" + ("_le" if sys.byteorder == "little" else "_be"), True) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=24, decimation=25 * 5, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc audio_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4, 0, 4, 4) for r in range(4, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 512, #size audio_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.0010) self.qtgui_time_sink_x_0_0.set_y_axis(-180, 180) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['Reference', 'Variable', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 5, 4, 2, 4) for r in range(5, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 8192, #size audio_rate, #samp_rate "30 Hz Signals", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.0010) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0, 0, 1, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['var', 'ref', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 3, 4, 2, 4) for r in range(3, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc audio_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.10) self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(False) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_1_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, audio_rate, 750, 250, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_1 = filter.fir_filter_ccf( 1, firdes.low_pass(1, audio_rate, 500, 250, firdes.WIN_HAMMING, 6.76)) self._fine_tool_bar = Qt.QToolBar(self) self._fine_tool_bar.addWidget(Qt.QLabel('Fine [Hz]' + ": ")) self._fine_line_edit = Qt.QLineEdit(str(self.fine)) self._fine_tool_bar.addWidget(self._fine_line_edit) self._fine_line_edit.returnPressed.connect(lambda: self.set_fine( eng_notation.str_to_num(str(self._fine_line_edit.text().toAscii())) )) self.top_grid_layout.addWidget(self._fine_tool_bar, 1, 4, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_0_0 = fft.fft_vfc(nfft, True, (window.blackmanharris(nfft)), 1) self.fft_vxx_0 = fft.fft_vfc(nfft, True, (window.blackmanharris(nfft)), 1) self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True) self.dc_blocker_xx_0 = filter.dc_blocker_ff(256, True) self.blocks_vector_to_stream_1 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, nfft) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, nfft) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * throttle_rate, True) self.blocks_stream_to_vector_1 = blocks.stream_to_vector( gr.sizeof_float * 1, nfft) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_float * 1, nfft) self.blocks_skiphead_0_0 = blocks.skiphead(gr.sizeof_gr_complex * 1, 30) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex * 1, 30) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (180 / math.pi, )) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff( int(avg), 1 / avg, 4000, 1) self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, nfft) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, nfft) self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex * 1, delay) self.blocks_complex_to_arg_0_0_0 = blocks.complex_to_arg(1) self.band_pass_filter_0_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, audio_rate, 25, 35, 5, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, audio_rate, 25, 35, 5, firdes.WIN_HAMMING, 6.76)) self._audio_gain_tool_bar = Qt.QToolBar(self) self._audio_gain_tool_bar.addWidget(Qt.QLabel('vol30' + ": ")) self._audio_gain_line_edit = Qt.QLineEdit(str(self.audio_gain)) self._audio_gain_tool_bar.addWidget(self._audio_gain_line_edit) self._audio_gain_line_edit.returnPressed.connect( lambda: self.set_audio_gain( eng_notation.str_to_num( str(self._audio_gain_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_gain_tool_bar, 1, 7, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 8): self.top_grid_layout.setColumnStretch(c, 1) self.analog_sig_source_x_1 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 9960, 1, 0) self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc( math.pi / 200, math.pi / 10, -math.pi / 10) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=audio_rate, audio_decim=1, deviation=480, audio_pass=30, audio_stop=100, gain=1.0, tau=75e-6, ) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=48e3, audio_decim=1, audio_pass=35, audio_stop=100, ) self.analog_agc2_xx_0_0_0 = analog.agc2_ff(1e-3, 1e-3, .65, 1) self.analog_agc2_xx_0_0_0.set_max_gain(65536) self.analog_agc2_xx_0_0 = analog.agc2_ff(1e-1, 1e-2, .65, 1) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.analog_pll_carriertracking_cc_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.analog_agc2_xx_0_0_0, 0), (self.blocks_stream_to_vector_1, 0)) self.connect((self.analog_agc2_xx_0_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.band_pass_filter_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.dc_blocker_xx_0_0, 0)) self.connect((self.blocks_complex_to_arg_0_0_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_delay_2, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.blocks_moving_average_xx_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_moving_average_xx_0_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_1_0, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_skiphead_0_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_1, 0), (self.fft_vxx_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.blocks_skiphead_0_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.dc_blocker_xx_0_0, 0), (self.analog_agc2_xx_0_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.low_pass_filter_1, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.low_pass_filter_1_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.blocks_delay_2, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "RX logic") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 192000 self.mode = mode = 2 self.bw = bw = 3200 self.aud_rate = aud_rate = 22050 self.visualsq = visualsq = 1 self.st = st = 1 self.sq = sq = -700 self.sb_pos = sb_pos = ((bw*mode==2)-(bw*mode==3)) self.rec = rec = 1 self.laj_0 = laj_0 = 0 self.laj = laj = 0 self.lai_0 = lai_0 = 0 self.lai = lai = 0 self.freq = freq = 98500000 self.device = device = "fcd=0,type=2" self.dev = dev = 19000 self.decimation = decimation = samp_rate/aud_rate self.batswitch = batswitch = 0 self.batido = batido = 2950 self.VEC = VEC = 1280 ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="nchan=" + str(1) + " " + device ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(7, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(0, 0) self.rtlsdr_source_0.set_gain(14, 0) self.rtlsdr_source_0.set_if_gain(14, 0) self.rtlsdr_source_0.set_bb_gain(14, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.probe_st = analog.probe_avg_mag_sqrd_f(10, 1) self.low_pass_filter_0_2 = filter.fir_filter_ccf(decimation, firdes.low_pass( 1, samp_rate, bw*(2+(mode==2)+(mode==3)), 500, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_1_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.low_pass( 30, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass( visualsq, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass( 1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76)) self.fractional_resampler_xx_0_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0) self.fractional_resampler_xx_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0) self.fractional_resampler_xx_0 = filter.fractional_resampler_ff(0, (samp_rate/decimation)/48000.0) self.fft_vxx_0 = fft.fft_vcc(VEC, True, (window.blackmanharris(1024)), True, 1) self.fft_probe = blocks.probe_signal_vf(VEC) self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/tmp/CAPTURE.WAV", 2, 48000, 16) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, VEC) self.blocks_multiply_xx_0_1_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_complex_to_real_0_0_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(VEC) self.blocks_add_xx_0 = blocks.add_vff(1) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-complex(lai,laj), )) self.blks2_valve_0_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec)) self.blks2_valve_0_0_1 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=5)) self.blks2_valve_0_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(0)) self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=4)) self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec)) self.blks2_selector_0_1_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=2, num_outputs=1, input_index=(mode==3), output_index=0, ) self.blks2_selector_0_0_1_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=3, num_outputs=1, input_index=(mode>3)+(mode>4), output_index=0, ) self.blks2_selector_0_0_1 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=3, num_outputs=1, input_index=(mode>3)+(mode>4), output_index=0, ) self.blks2_selector_0_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=4, num_outputs=1, input_index=mode, output_index=0, ) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=1, num_outputs=4, input_index=0, output_index=mode, ) self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass( 250, samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass( 120, samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(48000, "dmix:CARD=Pro,DEV=0", False) self.analog_wfm_rcv_1 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=1, ) self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate/decimation, analog.GR_COS_WAVE, -bw, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, dev+(bw*mode==2)+(bw*mode==3), 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.25) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=samp_rate, audio_decim=samp_rate/48000, deviation=50000, audio_pass=15000, audio_stop=16000, gain=3.0, tau=50e-6, ) self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=50e-6) self.analog_fm_deemph_0 = analog.fm_deemph(fs=48000, tau=50e-6) self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(64, 0.9) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=samp_rate/decimation, audio_decim=samp_rate/decimation/aud_rate, audio_pass=(samp_rate/decimation/2)-500, audio_stop=(samp_rate/decimation/2)-100, ) self.analog_agc3_xx_0 = analog.agc3_cc(0.0001, 0.0001, 0.9, 0.1) self.analog_agc3_xx_0.set_max_gain(200) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.fft_probe, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blks2_valve_0_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_1_0, 0)) self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_deemph_0, 0)) self.connect((self.analog_fm_deemph_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.low_pass_filter_0_1, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.low_pass_filter_0_1_0_0_0, 0), (self.analog_fm_deemph_0_0, 0)) self.connect((self.analog_agc3_xx_0, 0), (self.analog_wfm_rcv_1, 0)) self.connect((self.blks2_valve_0_0_1, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_1, 0)) self.connect((self.blocks_multiply_xx_0_1_0, 0), (self.low_pass_filter_0_1_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 1)) self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 2)) self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.analog_fm_deemph_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.fractional_resampler_xx_0_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.fractional_resampler_xx_0_0, 0)) self.connect((self.blks2_valve_0_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_2, 0)) self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 3)) self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 2)) self.connect((self.blks2_selector_0_1_0, 0), (self.blocks_multiply_xx_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_complex_to_real_0_0_0_0, 0)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1)) self.connect((self.analog_am_demod_cf_0, 0), (self.blks2_selector_0_0, 0)) self.connect((self.blks2_selector_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blks2_selector_0_0, 1)) self.connect((self.blks2_selector_0, 1), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.blks2_selector_0_0, 0), (self.low_pass_filter_0_0_0_0, 0)) self.connect((self.blks2_selector_0, 2), (self.high_pass_filter_0, 0)) self.connect((self.blks2_selector_0, 3), (self.low_pass_filter_0_0_0, 0)) self.connect((self.high_pass_filter_0, 0), (self.blks2_selector_0_1_0, 0)) self.connect((self.low_pass_filter_0_0_0, 0), (self.blks2_selector_0_1_0, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1_0, 1)) self.connect((self.fractional_resampler_xx_0_0_0, 0), (self.blks2_selector_0_0_1_0, 2)) self.connect((self.fractional_resampler_xx_0_0, 0), (self.blks2_selector_0_0_1, 2)) self.connect((self.blks2_selector_0_0_1_0, 0), (self.audio_sink_0, 1)) self.connect((self.blks2_selector_0_0_1, 0), (self.audio_sink_0, 0)) self.connect((self.blks2_valve_0, 0), (self.blocks_wavfile_sink_0, 1)) self.connect((self.blks2_selector_0_0_1_0, 0), (self.blks2_valve_0, 0)) self.connect((self.blks2_selector_0_0_1, 0), (self.blks2_valve_0_1, 0)) self.connect((self.blks2_valve_0_1, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1_0, 0)) self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1, 0)) self.connect((self.low_pass_filter_0_2, 0), (self.analog_feedforward_agc_cc_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.low_pass_filter_0_0_0_0, 0), (self.fractional_resampler_xx_0, 0)) self.connect((self.analog_feedforward_agc_cc_0, 0), (self.blks2_selector_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.probe_st, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Vor Receive Realtime Clean") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.morse_vol = morse_vol = 10 self.samp_rate = samp_rate = 32000 self.rtl_gain = rtl_gain = 42 self.rtl_freq = rtl_freq = 115.5e6+64 self.morse_gain = morse_gain = pow(10,morse_vol/10) self.morse_amp_level = morse_amp_level = 0 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f( self.GetWin(), title='Morse', sample_rate=samp_rate/(1600), v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_STRIPCHART, y_axis_label='Amp', ) self.Add(self.wxgui_scopesink2_1_0_0.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title='Scope Plot', sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0.02, ac_couple=False, xy_mode=False, num_inputs=2, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label='Counts', ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_numbersink2_1 = numbersink2.number_sink_f( self.GetWin(), unit='Units', minval=0, maxval=360, factor=1.0, decimal_places=10, ref_level=0, sample_rate=1, number_rate=15, average=False, avg_alpha=None, label='Number Plot', peak_hold=False, show_gauge=False, ) self.Add(self.wxgui_numbersink2_1.win) _morse_vol_sizer = wx.BoxSizer(wx.VERTICAL) self._morse_vol_text_box = forms.text_box( parent=self.GetWin(), sizer=_morse_vol_sizer, value=self.morse_vol, callback=self.set_morse_vol, label='Morse Volume (dB):', converter=forms.float_converter(), proportion=0, ) self._morse_vol_slider = forms.slider( parent=self.GetWin(), sizer=_morse_vol_sizer, value=self.morse_vol, callback=self.set_morse_vol, minimum=-25, maximum=25, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_morse_vol_sizer) def _morse_amp_level_probe(): while True: val = self.morse_amp.level() try: self.set_morse_amp_level(val) except AttributeError: pass time.sleep(1.0 / (25)) _morse_amp_level_thread = threading.Thread(target=_morse_amp_level_probe) _morse_amp_level_thread.daemon = True _morse_amp_level_thread.start() self.low_pass_filter_0_1_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 1000, 500, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_1 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, 1000, 500, firdes.WIN_HAMMING, 6.76)) self.iio_modulo_const_ff_0 = iio.modulo_const_ff(360, 1) self.goertzel_fc_0_0 = fft.goertzel_fc(samp_rate, 3200, 30) self.goertzel_fc_0 = fft.goertzel_fc(samp_rate, 3200, 30) self.fir_filter_xxx_0_0 = filter.fir_filter_fff(1, (filter.optfir.low_pass(1, samp_rate, 100, 200, 0.1, 60))) self.fir_filter_xxx_0_0.declare_sample_delay(0) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((-180/pi, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((morse_gain, )) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_integrate_xx_1 = blocks.integrate_ff(1600, 1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_source_0_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/tmp/vor_simulation.cfile', False) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.blocks_add_const_vxx_1 = blocks.add_const_vff((360, )) self.band_pass_filter_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass( 1, samp_rate, 1010, 1030, 100, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0_0 = audio.sink(samp_rate, '', True) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -9960, 1, 0) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=samp_rate, audio_decim=1, deviation=1000, audio_pass=100, audio_stop=200, gain=1.0, tau=75e-6, ) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=samp_rate, audio_decim=1, audio_pass=12000, audio_stop=13000, ) ################################################## # Connections ################################################## self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.low_pass_filter_0_1_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.goertzel_fc_0_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.wxgui_scopesink2_0, 1)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.iio_modulo_const_ff_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_integrate_xx_1, 0), (self.wxgui_scopesink2_1_0_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.goertzel_fc_0, 0)) self.connect((self.fir_filter_xxx_0_0, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.goertzel_fc_0, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.goertzel_fc_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.iio_modulo_const_ff_0, 0), (self.wxgui_numbersink2_1, 0)) self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.low_pass_filter_0_1_0, 0), (self.fir_filter_xxx_0_0, 0))
def __init__(self): gr.top_block.__init__(self) options = get_options() self.ifreq = options.frequency self.rfgain = options.gain self.src = osmosdr.source(options.args) self.src.set_center_freq(self.ifreq) self.src.set_sample_rate(int(options.sample_rate)) if self.rfgain is None: self.src.set_gain_mode(1) self.iagc = 1 self.rfgain = 0 else: self.iagc = 0 self.src.set_gain_mode(0) self.src.set_gain(self.rfgain) # may differ from the requested rate sample_rate = self.src.get_sample_rate() sys.stderr.write("sample rate: %d\n" % (sample_rate)) bitrate = 8000 first_decim=125 out_sample_rate=sample_rate/first_decim sys.stderr.write("output sample rate: %d\n" % (out_sample_rate)) sps=out_sample_rate/bitrate sys.stderr.write("samples per symbol: %d\n" % (sps)) self.offset = options.offset sys.stderr.write("offset is: %dHz\n" % self.offset) taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, filter.firdes.WIN_HANN) self.tuner = filter.freq_xlating_fir_filter_ccf(first_decim, taps, self.offset, sample_rate) self.demod = digital.gmsk_demod(samples_per_symbol=sps) self.output = blocks.file_sink(gr.sizeof_char, options.output_file) self.connect((self.src, 0), (self.tuner, 0)) self.connect((self.tuner, 0), (self.demod, 0)) self.connect((self.demod, 0), (self.output, 0)) self.fm_demod = analog.fm_demod_cf(sample_rate/first_decim, 1, 5000, 3000, 4000) self.integrate = blocks.integrate_ff(32000) self.probe = blocks.probe_signal_f() self.connect((self.tuner, 0), (self.fm_demod,0)) self.connect((self.fm_demod, 0), (self.integrate,0)) self.connect((self.integrate, 0), (self.probe, 0)) def _variable_function_probe_0_probe(): while True: freq = self.tuner.center_freq() freq2 = freq + 0.2*self.probe.level() print "Autotune: fix=%f old=%i new=%i"%(self.probe.level(), self.ifreq+freq, self.ifreq+freq2) self.tuner.set_center_freq(freq2) time.sleep(5.0) _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start()
def __init__(self): gr.top_block.__init__(self, "vor_record_sigmf") Qt.QWidget.__init__(self) self.setWindowTitle("vor_record_sigmf") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "vor_playback_sigmf") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.throttle_rate = throttle_rate = 1 self.samp_rate = samp_rate = 250e3 self.fine = fine = 0 self.decim = decim = 5 self.audio_gain_30hz = audio_gain_30hz = 1 self.alpha = alpha = .02 ################################################## # Blocks ################################################## self._throttle_rate_tool_bar = Qt.QToolBar(self) self._throttle_rate_tool_bar.addWidget( Qt.QLabel("throttle_rate" + ": ")) self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate)) self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit) self._throttle_rate_line_edit.returnPressed.connect( lambda: self.set_throttle_rate( eng_notation.str_to_num( str(self._throttle_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num( str(self._samp_rate_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._fine_tool_bar = Qt.QToolBar(self) self._fine_tool_bar.addWidget(Qt.QLabel('Fine [Hz]' + ": ")) self._fine_line_edit = Qt.QLineEdit(str(self.fine)) self._fine_tool_bar.addWidget(self._fine_line_edit) self._fine_line_edit.returnPressed.connect(lambda: self.set_fine( eng_notation.str_to_num(str(self._fine_line_edit.text().toAscii())) )) self.top_grid_layout.addWidget(self._fine_tool_bar, 1, 4, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.sigmf_source_0 = gr_sigmf.source( '/captures/20191216/VOR_2019-12-16T18:51:17Z.sigmf-data', "cf32" + ("_le" if sys.byteorder == "little" else "_be"), False) self.rational_resampler_xxx_2 = filter.rational_resampler_fff( interpolation=66, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=66, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=24, decimation=25, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4, 0, 4, 4) for r in range(4, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size samp_rate / decim / 25 * 24, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.0010) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 6, 4, 2, 4) for r in range(6, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 8192, #size samp_rate / decim / 25 * 24, #samp_rate "30 Hz Variable", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.0010) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 4, 4, 2, 4) for r in range(4, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim / 25 * 24, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "float" == "float" or "float" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_fff( 1, firdes.low_pass(10, samp_rate / decim / 25 * 24, 1e3, 500, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_fff( 1, firdes.low_pass(1, 48e3, 1, 1, firdes.WIN_HAMMING, 6.76)) self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True) self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate * throttle_rate, True) self.blocks_multiply_xx_3 = blocks.multiply_vff(1) self.blocks_multiply_xx_2 = blocks.multiply_vff(1) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_integrate_xx_2 = blocks.integrate_ff(66, 1) self.blocks_integrate_xx_0 = blocks.integrate_ff(66, 1) self.blocks_float_to_complex_2 = blocks.float_to_complex(1) self.blocks_float_to_complex_1 = blocks.float_to_complex(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_divide_xx_0_0 = blocks.divide_ff(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_1 = blocks.delay(gr.sizeof_float * 1, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 0) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.band_pass_filter_0_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5, firdes.WIN_HAMMING, 6.76)) self._audio_gain_30hz_tool_bar = Qt.QToolBar(self) self._audio_gain_30hz_tool_bar.addWidget(Qt.QLabel('vol30' + ": ")) self._audio_gain_30hz_line_edit = Qt.QLineEdit( str(self.audio_gain_30hz)) self._audio_gain_30hz_tool_bar.addWidget( self._audio_gain_30hz_line_edit) self._audio_gain_30hz_line_edit.returnPressed.connect( lambda: self.set_audio_gain_30hz( eng_notation.str_to_num( str(self._audio_gain_30hz_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._audio_gain_30hz_tool_bar, 1, 7, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 8): self.top_grid_layout.setColumnStretch(c, 1) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 9960, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * fine, 1, 0) self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc( math.pi / 200, math.pi / 10, -math.pi / 10) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=samp_rate / decim / 25 * 24, audio_decim=1, deviation=1e3, audio_pass=100, audio_stop=200, gain=1.0, tau=75e-6, ) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=48e3, audio_decim=1, audio_pass=12000, audio_stop=13000, ) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) self._alpha_tool_bar = Qt.QToolBar(self) self._alpha_tool_bar.addWidget(Qt.QLabel('alpha' + ": ")) self._alpha_line_edit = Qt.QLineEdit(str(self.alpha)) self._alpha_tool_bar.addWidget(self._alpha_line_edit) self._alpha_line_edit.returnPressed.connect(lambda: self.set_alpha( eng_notation.str_to_num(str(self._alpha_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._alpha_tool_bar, 1, 6, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_fm_demod_cf_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.band_pass_filter_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.dc_blocker_xx_0_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0_0, 1)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_3, 0)) self.connect((self.blocks_delay_1, 0), (self.blocks_multiply_xx_2, 1)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_float_to_complex_2, 0)) self.connect((self.blocks_divide_xx_0_0, 0), (self.blocks_float_to_complex_2, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_float_to_complex_1, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_float_to_complex_2, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_integrate_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_integrate_xx_2, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_integrate_xx_0, 0)) self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_integrate_xx_2, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_delay_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_xx_2, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_delay_1, 0)) self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_multiply_xx_3, 1)) self.connect((self.dc_blocker_xx_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_pll_carriertracking_cc_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_float_to_complex_1, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_divide_xx_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_float_to_complex_1, 1)) self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "FM Reciever") Qt.QWidget.__init__(self) self.setWindowTitle("FM Reciever") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "RTL_SDR") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.rf_gain = rf_gain = 50 self.audio_decim = audio_decim = 5 self.Volume = Volume = 300m self.Tuning = Tuning = 100.3M self.Samp_rate = Samp_rate = 240k self.Presets = Presets = 102.1M self.Deviation = Deviation = 75k ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "rtl=0" ) self.rtlsdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.rtlsdr_source_0.set_sample_rate(Samp_rate) self.rtlsdr_source_0.set_center_freq(100.3e6, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_gain(50, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(200k, 0) self._rf_gain_range = Range(0, 70, 1, 50, 200) self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'RF Gain', "slider", int) self.top_grid_layout.addWidget(self._rf_gain_win) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(300m) self.audio_sink_0 = audio.sink(48000, '', True) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=Samp_rate, audio_decim=audio_decim, deviation=Deviation, audio_pass=16k, audio_stop=20k, gain=1.0, tau=75e-6, ) self._Volume_range = Range(0, 1, 50m, 300m, 200) self._Volume_win = RangeWidget(self._Volume_range, self.set_Volume, 'VolumeTuner', "counter_slider", float) self.top_grid_layout.addWidget(self._Volume_win) self._Tuning_range = Range(87.9M, 108.1M, 100k, 100.3M, 200) self._Tuning_win = RangeWidget(self._Tuning_range, self.set_Tuning, 'tuning', "counter_slider", float) self.top_grid_layout.addWidget(self._Tuning_win) # Create the options list self._Presets_options = (102.1M, 96.9M, 89.3M, 99.1M, ) # Create the labels list self._Presets_labels = ('WDRM', 'WRSA', 'WLRH', 'WAHR', ) # Create the combo box self._Presets_tool_bar = Qt.QToolBar(self) self._Presets_tool_bar.addWidget(Qt.QLabel('Station' + ": ")) self._Presets_combo_box = Qt.QComboBox() self._Presets_tool_bar.addWidget(self._Presets_combo_box) for _label in self._Presets_labels: self._Presets_combo_box.addItem(_label) self._Presets_callback = lambda i: Qt.QMetaObject.invokeMethod(self._Presets_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Presets_options.index(i))) self._Presets_callback(self.Presets) self._Presets_combo_box.currentIndexChanged.connect( lambda i: self.set_Presets(self._Presets_options[i])) # Create the radio buttons self.top_grid_layout.addWidget(self._Presets_tool_bar) ################################################## # Connections ################################################## self.connect((self.analog_fm_demod_cf_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.analog_fm_demod_cf_0, 0))
def __init__(self,infile, outfile, input_rate, channel_rate, codec_provoice, codec_p25, sslevel, svlevel): gr.top_block.__init__(self, "Top Block") self.input_rate = input_rate self.channel_rate = channel_rate self.source = blocks.file_source(gr.sizeof_gr_complex*1, infile, False) self.lp1_decim = int(input_rate/(channel_rate*1.6)) print self.lp1_decim self.lp1 = filter.fir_filter_ccc(self.lp1_decim,firdes.low_pass( 1.0, self.input_rate, (self.channel_rate/2), ((self.channel_rate/2)*0.6), firdes.WIN_HAMMING)) #self.audiodemod = gr.quadrature_demod_cf(1) audio_pass = (input_rate/self.lp1_decim)*0.25 audio_stop = audio_pass+2000 self.audiodemod = analog.fm_demod_cf(channel_rate=(input_rate/self.lp1_decim), audio_decim=1, deviation=15000, audio_pass=audio_pass, audio_stop=audio_stop, gain=8, tau=75e-6) self.throttle = blocks.throttle(gr.sizeof_gr_complex*1, self.input_rate) self.signal_squelch = analog.pwr_squelch_cc(sslevel,0.01, 0, True) self.vox_squelch = analog.pwr_squelch_ff(svlevel, 0.0005, 0, True) self.audiosink = blocks.wavfile_sink(outfile, 1, 8000) if codec_provoice: self.dsd = dsd.block_ff(dsd.dsd_FRAME_PROVOICE,dsd.dsd_MOD_AUTO_SELECT,1,0,False) channel_rate = input_rate/self.lp1_decim self.resampler_in = filter.rational_resampler_fff(interpolation=48000, decimation=channel_rate, taps=None, fractional_bw=None, ) output_rate = 8000 resampler = filter.rational_resampler_fff( interpolation=(input_rate/self.lp1_decim), decimation=output_rate, taps=None, fractional_bw=None, ) elif codec_p25: symbol_deviation = 600.0 symbol_rate = 4800 channel_rate = input_rate/self.lp1_decim fm_demod_gain = channel_rate / (2.0 * pi * symbol_deviation) fm_demod = analog.quadrature_demod_cf(fm_demod_gain) symbol_decim = 1 samples_per_symbol = channel_rate // symbol_rate symbol_coeffs = (1.0/samples_per_symbol,) * samples_per_symbol symbol_filter = filter.fir_filter_fff(symbol_decim, symbol_coeffs) autotuneq = gr.msg_queue(2) demod_fsk4 = op25.fsk4_demod_ff(autotuneq, channel_rate, symbol_rate) # symbol slicer levels = [ -2.0, 0.0, 2.0, 4.0 ] slicer = op25.fsk4_slicer_fb(levels) imbe = repeater.vocoder(False, True, 0, "", 0, False) self.decodequeue = decodequeue = gr.msg_queue(10000) decoder = repeater.p25_frame_assembler('', 0, 0, True, True, False, decodequeue) float_conversion = blocks.short_to_float(1, 8192) resampler = filter.rational_resampler_fff( interpolation=8000, decimation=8000, taps=None, fractional_bw=None, ) #Tone squelch, custom GRC block that rips off CTCSS squelch to detect 4800 hz tone and latch squelch after that if not codec_provoice and not codec_p25: #self.tone_squelch = gr.tone_squelch_ff(audiorate, 4800.0, 0.05, 300, 0, True) #tone squelch is EDACS ONLY self.high_pass = filter.fir_filter_fff(1, firdes.high_pass(1, (input_rate/self.lp1_decim), 300, 30, firdes.WIN_HAMMING, 6.76)) #output_rate = channel_rate resampler = filter.rational_resampler_fff( interpolation=8000, decimation=(input_rate/self.lp1_decim), taps=None, fractional_bw=None, ) if(codec_provoice): self.connect(self.source, self.throttle, self.lp1, self.audiodemod, self.resampler_in, self.dsd, self.audiosink) elif(codec_p25): self.connect(self.source, self.throttle, self.lp1, fm_demod, symbol_filter, demod_fsk4, slicer, decoder, imbe, float_conversion, resampler, self.audiosink) else: self.connect(self.source, self.throttle, self.lp1, self.signal_squelch, self.audiodemod, self.high_pass, self.vox_squelch, resampler, self.audiosink) self.time_open = time.time() self.time_tone = 0 self.time_activity = 0
def __init__(self): # Call the initialization method from the parent class gr.top_block.__init__(self) # Setup the parser for command line arguments parser = OptionParser(option_class=eng_option) parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="print settings to stdout") parser.add_option("-f", "--frequency", type="eng_float", dest="rx_freq", default=98.9E6, help="RX frequency in Hz") parser.add_option("-a", "--args", type="string", dest="uhd_args", default='type=b200', help="USRP device args") parser.add_option("-c", "--cal", type="eng_float", dest="rssi_cal_offset_dB", default=-50, help="RSSI calibration offset in dB") parser.add_option("-g", "--gain", type="eng_float", dest="src_gain_dB", default=50, help="USRP gain in dB") parser.add_option("-V", "--volume", type="eng_float", dest="volume_dB", default=30, help="Audio volume in dB") parser.add_option("-s", "--soundrate", type="eng_float", dest="snd_card_rate", default=48000, help="Sound card rate in Hz") (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 # Define constants uhd_args = options.uhd_args self.rx_freq = options.rx_freq lo_offset_freq = 125E3 src_samp_rate = 500000 src_gain_dB = options.src_gain_dB rssi_cal_offset_dB = -50 volume_dB = options.volume_dB snd_card_rate = options.snd_card_rate # Print some info to stdout for verbose option if options.verbose: print 'USRP args string "%s" ' % uhd_args print 'RX frequency = %f MHz' % (self.rx_freq / 1E6) print 'Source sample rate = %i Hz' % src_samp_rate print 'USRP gain = %i dB' % src_gain_dB print 'RSSI cal offset= %i dB' % rssi_cal_offset_dB print 'Audio volume = %i dB' % volume_dB print 'Sound card rate = %i Hz' % snd_card_rate # Setup the USRP source self.src = uhd.usrp_source(uhd_args, uhd.io_type_t.COMPLEX_FLOAT32, 1) self.src.set_samp_rate(src_samp_rate) self.src.set_center_freq(self.rx_freq - lo_offset_freq, 0) self.src.set_gain(src_gain_dB, 0) # Generate taps for frequency translating FIR filter filter_taps = filter.firdes.low_pass(gain=1.0, sampling_freq=src_samp_rate, cutoff_freq=100E3, transition_width=25E3, window=filter.firdes.WIN_HAMMING) # Frequency translating FIR filter fxlate = filter.freq_xlating_fir_filter_ccc( decimation=2, taps=filter_taps, center_freq=lo_offset_freq, sampling_freq=src_samp_rate) # Wideband FM demodulator wbfm = analog.fm_demod_cf(channel_rate=src_samp_rate / 2, audio_decim=5, deviation=75000, audio_pass=15000, audio_stop=16000, gain=1.0, tau=75E-6) # Rational resampler resamp = filter.rational_resampler_fff(interpolation=snd_card_rate, decimation=src_samp_rate / 10) # Multiply for voulme control volume = blocks.multiply_const_ff(10**(volume_dB / 20) - 1) # Sound card sink sndcard = audio.sink(snd_card_rate, '', True) # Connect the blocks for audio monitoring self.connect(self.src, fxlate, wbfm, resamp, volume, sndcard) # Calculate power for RSSI c2magsqr = blocks.complex_to_mag_squared(1) # Integrate for mean power and decimate down to 1 Hz integrator = blocks.integrate_ff(decim=src_samp_rate / 2) # Take 10*Log10 and offset for calibrated power and src gain logten = blocks.nlog10_ff(10, 1, rssi_cal_offset_dB - src_gain_dB) # Probe the RSSI signal self.rssi = blocks.probe_signal_f() # Connect the blocks for the RSSI self.connect(fxlate, c2magsqr, integrator, logten, self.rssi)
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1e6 self.bb_decim = bb_decim = 4 self.freq_offset = freq_offset = 250000 self.freq = freq = 90.9e6 self.baseband_rate = baseband_rate = samp_rate / bb_decim self.audio_decim = audio_decim = 5 self.xlate_bandwidth = xlate_bandwidth = 100000 self.gain = gain = 20 self.freq_tune = freq_tune = freq - freq_offset self.audio_rate = audio_rate = 48000 self.audio_decim_rate = audio_decim_rate = baseband_rate / audio_decim ################################################## # Blocks ################################################## self.nb = Qt.QTabWidget() self.nb_widget_0 = Qt.QWidget() self.nb_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.nb_widget_0) self.nb_grid_layout_0 = Qt.QGridLayout() self.nb_layout_0.addLayout(self.nb_grid_layout_0) self.nb.addTab(self.nb_widget_0, 'Baseband') self.nb_widget_1 = Qt.QWidget() self.nb_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.nb_widget_1) self.nb_grid_layout_1 = Qt.QGridLayout() self.nb_layout_1.addLayout(self.nb_grid_layout_1) self.nb.addTab(self.nb_widget_1, 'Demod') self.nb_widget_2 = Qt.QWidget() self.nb_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.nb_widget_2) self.nb_grid_layout_2 = Qt.QGridLayout() self.nb_layout_2.addLayout(self.nb_grid_layout_2) self.nb.addTab(self.nb_widget_2, 'L+R') self.nb_widget_3 = Qt.QWidget() self.nb_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.nb_widget_3) self.nb_grid_layout_3 = Qt.QGridLayout() self.nb_layout_3.addLayout(self.nb_grid_layout_3) self.nb.addTab(self.nb_widget_3, 'Subcarrier') self.top_grid_layout.addWidget(self.nb) self._gain_range = Range(0, 75, 1, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'gain', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win) self.qtgui_waterfall_sink_x_1_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc baseband_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_1_0.enable_grid(False) self.qtgui_waterfall_sink_x_1_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_1_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_1_0.pyqwidget(), Qt.QWidget) self.nb_layout_3.addWidget(self._qtgui_waterfall_sink_x_1_0_win) self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1.set_update_time(0.10) self.qtgui_waterfall_sink_x_1.enable_grid(False) self.qtgui_waterfall_sink_x_1.enable_axis_labels(True) self.qtgui_waterfall_sink_x_1.set_plot_pos_half(not True) labels = ['Demod', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_1.pyqwidget(), Qt.QWidget) self.nb_layout_1.addWidget(self._qtgui_waterfall_sink_x_1_win) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.nb_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.nb_layout_2.addWidget(self._qtgui_freq_sink_x_1_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc baseband_rate, #bw "", #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.nb_layout_1.addWidget(self._qtgui_freq_sink_x_0_win) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq_tune, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_gain(gain, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_fcc( audio_decim, firdes.low_pass(2500.0, baseband_rate, 3e3, 2e3, firdes.WIN_HAMMING), 67e3, baseband_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, firdes.low_pass(1, samp_rate, xlate_bandwidth, 100000), freq_offset, samp_rate) self._freq_range = Range(88.5e6, 108e6, 200e3, 90.9e6, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'freq', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win) self.fir_filter_xxx_1 = filter.fir_filter_fff( audio_decim, firdes.low_pass(1.0, baseband_rate, 13e3, 3e3, firdes.WIN_HAMMING)) self.fir_filter_xxx_1.declare_sample_delay(0) self.audio_sink_0 = audio.sink(audio_rate, '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=bb_decim, ) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=audio_decim_rate, audio_decim=1, deviation=5000, audio_pass=15000, audio_stop=16000, gain=1.0, tau=75e-6, ) ################################################## # Connections ################################################## self.connect((self.analog_fm_demod_cf_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_1, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_waterfall_sink_x_1, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.qtgui_waterfall_sink_x_1_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "VOR Radio") Qt.QWidget.__init__(self) self.setWindowTitle("VOR Radio") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "vor_radio") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.tone_samp_rate = tone_samp_rate = 2**9 self.tone_freq = tone_freq = 30 self.tone_bandpass_width = tone_bandpass_width = 5 self.pll_tracking_range = pll_tracking_range = 100 self.pll_bandwidth = pll_bandwidth = (1.5 * math.pi) / 200 self.input_samp_rate = input_samp_rate = 2**15 self.ident_freq = ident_freq = 1020 self.fm_ref_freq = fm_ref_freq = 9960 self.fm_ref_deviation = fm_ref_deviation = 480 self.fm_lowpass_width = fm_lowpass_width = 1000 self.fm_lowpass_cutoff = fm_lowpass_cutoff = 5000 self.fm_demod_samp_rate = fm_demod_samp_rate = 2**12 self.am_demod_lowpass_width = am_demod_lowpass_width = 400 self.am_demod_lowpass_cutoff = am_demod_lowpass_cutoff = 500 ################################################## # Blocks ################################################## self.monitoring_tabs = Qt.QTabWidget() self.monitoring_tabs_widget_0 = Qt.QWidget() self.monitoring_tabs_layout_0 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.monitoring_tabs_widget_0) self.monitoring_tabs_grid_layout_0 = Qt.QGridLayout() self.monitoring_tabs_layout_0.addLayout( self.monitoring_tabs_grid_layout_0) self.monitoring_tabs.addTab(self.monitoring_tabs_widget_0, "Baseband") self.monitoring_tabs_widget_1 = Qt.QWidget() self.monitoring_tabs_layout_1 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.monitoring_tabs_widget_1) self.monitoring_tabs_grid_layout_1 = Qt.QGridLayout() self.monitoring_tabs_layout_1.addLayout( self.monitoring_tabs_grid_layout_1) self.monitoring_tabs.addTab(self.monitoring_tabs_widget_1, "Ident Signal") self.monitoring_tabs_widget_2 = Qt.QWidget() self.monitoring_tabs_layout_2 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.monitoring_tabs_widget_2) self.monitoring_tabs_grid_layout_2 = Qt.QGridLayout() self.monitoring_tabs_layout_2.addLayout( self.monitoring_tabs_grid_layout_2) self.monitoring_tabs.addTab(self.monitoring_tabs_widget_2, "Phase Compare") self.monitoring_tabs_widget_3 = Qt.QWidget() self.monitoring_tabs_layout_3 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.monitoring_tabs_widget_3) self.monitoring_tabs_grid_layout_3 = Qt.QGridLayout() self.monitoring_tabs_layout_3.addLayout( self.monitoring_tabs_grid_layout_3) self.monitoring_tabs.addTab(self.monitoring_tabs_widget_3, "Scratch") self.top_layout.addWidget(self.monitoring_tabs) self.baseband_tabs = Qt.QTabWidget() self.baseband_tabs_widget_0 = Qt.QWidget() self.baseband_tabs_layout_0 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.baseband_tabs_widget_0) self.baseband_tabs_grid_layout_0 = Qt.QGridLayout() self.baseband_tabs_layout_0.addLayout(self.baseband_tabs_grid_layout_0) self.baseband_tabs.addTab(self.baseband_tabs_widget_0, "Spectrum") self.baseband_tabs_widget_1 = Qt.QWidget() self.baseband_tabs_layout_1 = Qt.QBoxLayout( Qt.QBoxLayout.TopToBottom, self.baseband_tabs_widget_1) self.baseband_tabs_grid_layout_1 = Qt.QGridLayout() self.baseband_tabs_layout_1.addLayout(self.baseband_tabs_grid_layout_1) self.baseband_tabs.addTab(self.baseband_tabs_widget_1, "Waterfall") self.monitoring_tabs_layout_0.addWidget(self.baseband_tabs) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=2**10 // 40, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc input_samp_rate, #bw "VOR Baseband Waterfall", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-130, -60) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.baseband_tabs_layout_1.addWidget( self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_2 = qtgui.time_sink_f( 40 * 4, #size 40, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_2.set_update_time(0.10) self.qtgui_time_sink_x_2.set_y_axis(-2.5, 2.5) self.qtgui_time_sink_x_2.set_y_label("Amplitude", "") self.qtgui_time_sink_x_2.enable_tags(-1, True) self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_AUTO, qtgui.TRIG_SLOPE_POS, 0.1, 0.1, 0, "") self.qtgui_time_sink_x_2.enable_autoscale(False) self.qtgui_time_sink_x_2.enable_grid(False) self.qtgui_time_sink_x_2.enable_control_panel(False) if not True: self.qtgui_time_sink_x_2.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_2.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_2_win = sip.wrapinstance( self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) self.monitoring_tabs_layout_1.addWidget(self._qtgui_time_sink_x_2_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( tone_samp_rate, #size tone_samp_rate, #samp_rate "Compared Signals", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-25, 25) self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["Variable", "Reference", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.monitoring_tabs_layout_2.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ["Radial", "", "", "", "", "", "", "", "", ""] units = ["degrees", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 360) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_number_sink_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc input_samp_rate, #bw "VOR Baseband Signal", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-150, -60) self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.baseband_tabs_layout_0.addWidget(self._qtgui_freq_sink_x_0_win) self.low_pass_filter_1 = filter.fir_filter_ccf( 1, firdes.low_pass(1, 2**10, 16, 16, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, input_samp_rate, am_demod_lowpass_cutoff, am_demod_lowpass_width, firdes.WIN_HAMMING, 6.76)) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccf( input_samp_rate // 2**10, (firdes.low_pass(10000, input_samp_rate, 500, 500)), ident_freq, input_samp_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccf( input_samp_rate // fm_demod_samp_rate, (firdes.low_pass( 1000, input_samp_rate, fm_lowpass_cutoff, fm_lowpass_width)), fm_ref_freq, input_samp_rate) self.fft_vxx_0_0 = fft.fft_vfc(tone_samp_rate, True, (window.blackmanharris(tone_samp_rate)), 1) self.fft_vxx_0 = fft.fft_vfc(tone_samp_rate, True, (window.blackmanharris(tone_samp_rate)), 1) self.dc_blocker_xx_1 = filter.dc_blocker_ff(32, True) self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True) self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, tone_samp_rate) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, tone_samp_rate) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, input_samp_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(1, 1, 0) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_float * 1, tone_samp_rate) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_float * 1, tone_samp_rate) self.blocks_skiphead_0_0 = blocks.skiphead(gr.sizeof_gr_complex * 1, tone_freq) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex * 1, tone_freq) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (180 / math.pi, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((500, )) self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, tone_samp_rate) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, tone_samp_rate) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/home/brian/gnur-projects/gr-vor/sample_data/RBT_VOR_Sample_32768kHz.raw", True) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 82) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_arg_0_0 = blocks.complex_to_arg(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.band_pass_filter_0_0_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, tone_samp_rate, tone_freq - tone_bandpass_width, tone_freq + tone_bandpass_width, tone_bandpass_width, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0 = filter.fir_filter_fff( input_samp_rate // tone_samp_rate, firdes.band_pass(800, input_samp_rate, tone_freq - tone_bandpass_width, tone_freq + tone_bandpass_width, tone_bandpass_width, firdes.WIN_HAMMING, 6.76)) self.analog_pll_carriertracking_cc_0_0 = analog.pll_carriertracking_cc( pll_bandwidth, utility.hz_to_rad_per_sample(pll_tracking_range, input_samp_rate), utility.hz_to_rad_per_sample(-pll_tracking_range, input_samp_rate)) self.analog_fm_demod_cf_0 = analog.fm_demod_cf( channel_rate=fm_demod_samp_rate, audio_decim=fm_demod_samp_rate // tone_samp_rate, deviation=fm_ref_deviation, audio_pass=tone_freq, audio_stop=tone_freq * 2, gain=1.0, tau=0.0, ) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=input_samp_rate, audio_decim=1, audio_pass=tone_freq, audio_stop=tone_freq * 2, ) self.analog_agc2_xx_0_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1) self.analog_agc2_xx_0.set_max_gain(65536) self.airnav_unitcircle_ff_0 = airnav.unitcircle_ff() self.airnav_qt_ident_0 = self.airnav_qt_ident_0 = airnav.qt_ident() self.top_layout.addWidget(self.airnav_qt_ident_0) self.airnav_morse_decode_0 = airnav.morse_decode(10, 40) ################################################## # Connections ################################################## self.msg_connect((self.airnav_morse_decode_0, 'out'), (self.airnav_qt_ident_0, 'in')) self.connect((self.airnav_unitcircle_ff_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_fm_demod_cf_0, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0_0, 0), (self.blocks_delay_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.dc_blocker_xx_1, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_complex_to_arg_0_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_delay_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.airnav_morse_decode_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_complex_to_arg_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_skiphead_0_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.airnav_unitcircle_ff_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_2, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_pll_carriertracking_cc_0_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_vector_to_stream_0_0, 0), (self.blocks_skiphead_0_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.dc_blocker_xx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.blocks_vector_to_stream_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_fm_demod_cf_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_threshold_ff_0, 0))