Esempio n. 1
0
    def test_001(self):
        # Confirm that we can instantiate and run an FM preemphasis block
        tb = self.tb

        src = analog.sig_source_f(48000, analog.GR_COS_WAVE, 5000.0, 1.0)
        op = analog.fm_preemph(fs=48000, tau=75e-6, fh=-1.0)
        head = blocks.head(gr.sizeof_float, 100)
        dst = blocks.vector_sink_f()

        tb.connect(src, op)
        tb.connect(op, head)
        tb.connect(head, dst)
        tb.run()
Esempio n. 2
0
    def __init__(self, audio_rate=44100, max_dev=75e3, quad_rate=220.5e3):
        gr.hier_block2.__init__(
            self,
            "Scalable Fm",
            gr.io_signature(1, 1, gr.sizeof_float * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.audio_rate = audio_rate
        self.max_dev = max_dev
        self.quad_rate = quad_rate

        ##################################################
        # Variables
        ##################################################
        self.k = k = 2 * math.pi * max_dev / quad_rate
        self.interp_factor = interp_factor = int(quad_rate / audio_rate)

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=interp_factor,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(k)
        self.analog_fm_preemph_0 = analog.fm_preemph(fs=quad_rate,
                                                     tau=75e-6,
                                                     fh=-1.0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fm_preemph_0, 0),
                     (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self, 0))
        self.connect((self, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_fm_preemph_0, 0))
Esempio n. 3
0
    def __init__(self):
        gr.top_block.__init__(self, "Transmisor_de_emergencia")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Transmisor_de_emergencia")
        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)            

        # Funcion para iniciar la transmision
        def on_click_start():
            self.isOn = True
            self.start()
            self.buttonStart.setEnabled(False)
            self.buttonStop.setEnabled(True)
            #self.buttonRecord.setEnabled(False)
            #self.buttonDefault.setEnabled(False)
            insert_onState(self.serial_equipo, date.today(), datetime.now().time())

        # Funcion para detener la transmision
        def on_click_stop():
            self.isOn = False
            self.stop()
            self.wait()
            self.buttonStart.setEnabled(True)
            self.buttonStop.setEnabled(False)
            #self.buttonRecord.setEnabled(True)
            #self.buttonDefault.setEnabled(True)
            insert_offState(self.serial_equipo, date.today(), datetime.now().time())

        # Funcion para seleccionar audio base
        def defaultAudio():
            # Detener el programa
            if self.isOn:
                self.stop()
                self.wait()
            try:
                shutil.copyfile('base.wav', 'audio.wav')
                print 'Archivo copiado'
            except IOError as e:
                print 'No se pudo copiar'
            # Iniciar de nuevo el programa
            if self.isOn:
                self.start()

        # Funcion para grabar audio
        def audioRecord():
            # Detener el programa
            if self.isOn:
                self.stop()
                self.wait()
            chunk = 1024  # Grabar en bloques de 1024 muestras
            sample_format = pyaudio.paInt16  # 16 bits por muestras
            channels = 2
            fs = 44100  # Grabar a 44100 muestras por segundo 
            seconds = self.time_rec
            filename = "audio.wav"

            p = pyaudio.PyAudio()  # Creacion de interfaz a PortAudio
            
            os.system("aplay alerta_inicio.wav")

            stream = p.open(format=sample_format,
                            channels=channels,
                            rate=fs,
                            frames_per_buffer=chunk,
                            input=True)

            frames = []  

            # Guardar datos en trozos de 3 segundos
            for i in range(0, int(fs / chunk * seconds)):
                data = stream.read(chunk)
                frames.append(data)

            # Parar y cerrar flujo de audio
            stream.stop_stream()
            stream.close()
            # Terminar la interfaz de PortAudio
            p.terminate()

            os.system("aplay alerta_final.wav")

            # Guardar la data como un archivo .wav
            wf = wave.open(filename, 'wb')
            wf.setnchannels(channels)
            wf.setsampwidth(p.get_sample_size(sample_format))
            wf.setframerate(fs)
            wf.writeframes(b''.join(frames))
            wf.close()

            # Subir archivo grabado
            UploadFTP(self.HostFTP, self.PortFTP, self.UserFTP, self.PassFTP, str(self.serial_equipo), "audio.wav", '%s_%s_%s_%s.wav' % (self.serial_equipo,self.placa_ambulancia, date.today(),datetime.now().time()))

            # Iniciar de nuevo el programa
            if self.isOn:
                self.start()

        # Inicializacion de los botones en la GUI
        self.buttonStart = QPushButton('Iniciar', self)
        self.buttonStart.clicked.connect(on_click_start)
        self.buttonStop = QPushButton('Detener', self)
        self.buttonStop.move(100, 0)
        self.buttonStop.setEnabled(False)
        self.buttonStop.clicked.connect(on_click_stop)
        self.buttonRecord = QPushButton('Grabar', self)
        self.buttonRecord.move(0,50)
        self.buttonRecord.clicked.connect(audioRecord)
        self.buttonDefault = QPushButton('Por Defecto', self)
        self.buttonDefault.move(100,50)
        self.buttonDefault.clicked.connect(defaultAudio)

        self.settings = Qt.QSettings("GNU Radio", "Transmisor_de_emergencia")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.variable_function_probe_0 = variable_function_probe_0 = 0
        self.samp_rate = samp_rate = 250e3
        self.Freq = Freq = 88.5e6
        self.serial_equipo= "serial1"
        self.placa_ambulancia = "placa1"
        self.time_rec = 1        
        self.HostFTP = '127.0.0.1'
        self.PortFTP = 21
        self.UserFTP = 'proyectosdr'
        self.PassFTP = 'proyectosdr'
        self.isOn = False

        ##################################################
        # Bloques
        ##################################################

        # Funcion para barrido de frecuencia
        def _variable_function_probe_0_probe():
            while True:
                val = self.get_Freq()
                print val
                if val == 107500000:
                    self.set_Freq(88500000)
                else:
                    self.set_Freq(val+1000000)
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _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()


        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(1.28e6)
        self.uhd_usrp_sink_0.set_center_freq(Freq, 0)
        self.uhd_usrp_sink_0.set_gain(20, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=4,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, 44.1e3, 15e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/proyectosdr/proyectosdr/audio.wav', True)
        self.blocks_multiply_xx_3 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(1)
        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_vcc((200e-3, ))
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_wfm_tx_0 = analog.wfm_tx(
        	audio_rate=44100,
        	quad_rate=44100*7,
        	tau=75e-6,
        	max_dev=75e3,
        	fh=-1.0,
        )
        self.analog_sig_source_x_3 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 400e3, 1, 0)
        self.analog_sig_source_x_2 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -200e3, 1, 0)
        self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 200e3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -400e3, 1, 0)
        self.analog_fm_preemph_0 = analog.fm_preemph(fs=54e3, tau=75e-6, fh=-1.0)

        ##################################################
        # Conexiones
        ##################################################
        
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_2, 1))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_3, 1))
        self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_0, 3))
        self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_tx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_3, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="B200 VHF NBFM transceiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_rx_choice = tx_rx_choice = 1
        self.tx_gain = tx_gain = .615
        self.tune_minus_20 = tune_minus_20 = 0
        self.tune_minus_10 = tune_minus_10 = 0
        self.tune_20 = tune_20 = 0
        self.tune_10 = tune_10 = 0
        self.tone = tone = 100
        self.squelch = squelch = -70.32
        self.samp_rate = samp_rate = 4000000
        self.rx_offset = rx_offset = 0
        self.rit_tune = rit_tune = 0
        self.offset = offset = 600000
        self.chooser_fm = chooser_fm = 147.34e6
        self.audio_gain = audio_gain = .7

        ##################################################
        # Blocks
        ##################################################
        self._tx_rx_choice_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tx_rx_choice,
        	callback=self.set_tx_rx_choice,
        	label="TX-RX",
        	choices=[0, 1],
        	labels=['TX', 'RX'],
        )
        self.GridAdd(self._tx_rx_choice_chooser, 0, 3, 1, 1)
        _tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tx_gain_sizer,
        	value=self.tx_gain,
        	callback=self.set_tx_gain,
        	label="TX Gain: 144= .6, 220= .70, 440= .72",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tx_gain_sizer,
        	value=self.tx_gain,
        	callback=self.set_tx_gain,
        	minimum=.6,
        	maximum=.75,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tx_gain_sizer)
        self._tune_minus_20_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_minus_20,
        	callback=self.set_tune_minus_20,
        	label="-20 Tune",
        	choices=[0, 20e3, 40e3, 60e3, 80e3, 100e3, 120e3, 140e3, 0],
        	labels=[0, -20, -40, -60, -80, -100, -120, -140, 0],
        )
        self.GridAdd(self._tune_minus_20_chooser, 0, 1, 1, 1)
        self._tune_minus_10_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_minus_10,
        	callback=self.set_tune_minus_10,
        	label="-10 Tune",
        	choices=[0,-10e3, -20e3, -30e3, -40e3,-50e3,0],
        	labels=[0, -10, -20, -30, -40,-50,0],
        )
        self.GridAdd(self._tune_minus_10_chooser, 1, 1, 1, 1)
        self._tune_20_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_20,
        	callback=self.set_tune_20,
        	label="+20 Tune",
        	choices=[0, 20e3, 40e3, 60e3, 80e3, 100e3, 120e3, 140e3,0],
        	labels=[0, '+20', '+40', '+60', '+80', '+100', '+120', '+140','0'],
        )
        self.GridAdd(self._tune_20_chooser, 0, 0, 1, 1)
        self._tune_10_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_10,
        	callback=self.set_tune_10,
        	label="+10 Tune",
        	choices=[0,10e3, 20e3, 30e3, 40e3,50e3,0],
        	labels=[0,'+10', '+20', '+30', '+40','+50','0'],
        )
        self.GridAdd(self._tune_10_chooser, 1, 0, 1, 1)
        self._tone_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.tone,
        	callback=self.set_tone,
        	label="CTCSS",
        	choices=[100,103.5, 110.9, 118.8, 123.0,127.3,179.5],
        	labels=['100', '103.5', '110.9','118.8', '123.0', '127.3','179.5'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._tone_chooser, 0, 5, 1, 1)
        _squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	label="Squelch",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._squelch_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	minimum=-95,
        	maximum=-55,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_squelch_sizer, 0, 6, 1, 1)
        self._rx_offset_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.rx_offset,
        	callback=self.set_rx_offset,
        	label="RX offset",
        	choices=[0, 600000, -600000,5e6],
        	labels=['0', '+', '-','+5M'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._rx_offset_chooser, 1, 6, 1, 1)
        _rit_tune_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rit_tune_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rit_tune_sizer,
        	value=self.rit_tune,
        	callback=self.set_rit_tune,
        	label="RIT",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rit_tune_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rit_tune_sizer,
        	value=self.rit_tune,
        	callback=self.set_rit_tune,
        	minimum=-30e3,
        	maximum=+30e3,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_rit_tune_sizer, 1, 2, 1, 3)
        self._offset_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.offset,
        	callback=self.set_offset,
        	label="TX offset",
        	choices=[600000, -600000, 0,5e6],
        	labels=['+', '-', '0','5MHz'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._offset_chooser, 0, 4, 1, 1)
        self._chooser_fm_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.chooser_fm,
        	callback=self.set_chooser_fm,
        	label="Preset",
        	choices=[145.13e6,145.33e6, 145.88e6, 146.46e6, 146.49e6, 146.52e6,146.58e6, 146.64e6,146.74e6, 146.82e6, 146.86e6, 146.92e6, 146.96e6, 147.0e6,147.06e6, 147.08e6, 147.20e6, 147.22e6, 147.34e6, 223.5e6,441.825e6, 432.25e6],
        	labels=[145.13,145.33, 145.88, 146.46, 146.49, 146.52, 146.58, 146.64, 146.74, 146.82, 146.860, 146.92, 146.96,  147.00, 147.06, 147.08,147.200, 147.220, 147.34, 223.5,441.825, 432.25],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chooser_fm_chooser)
        _audio_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._audio_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	label="Audio gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._audio_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	minimum=.1,
        	maximum=4,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_audio_gain_sizer, 0, 2, 1, 1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=(((((chooser_fm+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rx_offset),
        	y_per_div=5,
        	y_divs=16,
        	ref_level=-55,
        	ref_scale=2.0,
        	sample_rate=samp_rate/2,
        	fft_size=1024*0+2048*0+4096,
        	fft_rate=12,
        	average=True,
        	avg_alpha=.4,
        	title="RF Bandpass",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 0, 5, 14)
        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((((((chooser_fm+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rx_offset)-10e3, 0)
        self.uhd_usrp_source_0.set_normalized_gain(.520*.8, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_source_0.set_bandwidth(1.99e6, 0)
        self.uhd_usrp_sink_1 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_1.set_samp_rate(320000)
        self.uhd_usrp_sink_1.set_center_freq((((((chooser_fm+offset)+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rit_tune, 0)
        self.uhd_usrp_sink_1.set_normalized_gain((.83*0+.72)*0+tx_gain, 0)
        self.uhd_usrp_sink_1.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_1.set_bandwidth(200000, 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=32000,
                decimation=40000,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=samp_rate/2,
                decimation=samp_rate,
                taps=None,
                fractional_bw=None,
        )
        self.pfb_decimator_ccf_0 = pfb.decimator_ccf(
        	  2,
        	  (firdes.low_pass(.1, (samp_rate), (samp_rate)/4.05,10e3)),
        	  0,
        	  100,
                  True,
                  True)
        self.pfb_decimator_ccf_0.declare_sample_delay(0)
        	
        self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, 32000, 4400, 300, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, 32000, 4500, 600, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, 32000, 300, 100, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(50, (firdes.low_pass(1,samp_rate/2,18e3,600)), 0+rit_tune+10e3, samp_rate/2)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc((.8, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((125, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_gain*tx_rx_choice, ))
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blks2_selector_0_1 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=1+(tx_rx_choice),
        	output_index=0,
        )
        self.audio_source_1 = audio.source(32000, "", True)
        self.audio_sink_0 = audio.sink(32000, "", True)
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(squelch, .0001)
        self.analog_sig_source_x_0 = analog.sig_source_f(32000, analog.GR_COS_WAVE, tone, .091, 0)
        self.analog_nbfm_tx_1 = analog.nbfm_tx(
        	audio_rate=32000,
        	quad_rate=320000,
        	tau=(75e-6)*0+90e-6,
        	max_dev=5e3,
                )
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=32000,
        	quad_rate=32000,
        	tau=75e-6,
        	max_dev=5e3,
          )
        self.analog_fm_preemph_0 = analog.fm_preemph(fs=32e3, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=32000, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fm_deemph_0, 0), (self.low_pass_filter_1, 0))    
        self.connect((self.analog_fm_preemph_0, 0), (self.blocks_add_xx_1, 0))    
        self.connect((self.analog_nbfm_rx_0, 0), (self.analog_fm_deemph_0, 0))    
        self.connect((self.analog_nbfm_tx_1, 0), (self.blocks_multiply_const_vxx_2, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_1, 1))    
        self.connect((self.analog_simple_squelch_cc_0, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.audio_source_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blks2_selector_0_1, 0), (self.uhd_usrp_sink_1, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.analog_nbfm_tx_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.high_pass_filter_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blks2_selector_0_1, 1))    
        self.connect((self.blocks_null_source_0, 0), (self.blks2_selector_0_1, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_simple_squelch_cc_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_fm_preemph_0, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.pfb_decimator_ccf_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.pfb_decimator_ccf_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.rational_resampler_xxx_0, 0))    
Esempio n. 5
0
    def __init__(self):
        gr.top_block.__init__(self, "Not titled yet")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Not titled yet")
        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", "polyphase")

        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 = 33333
        self.quad_mul = quad_mul = 6
        self.quad_rate = quad_rate = samp_rate * quad_mul
        self.num_banks = num_banks = 20
        self.taps = taps = firdes.low_pass_2(5, num_banks * quad_rate, 60e3,
                                             60e3, 80,
                                             firdes.WIN_BLACKMAN_HARRIS)
        self.variable_qtgui_entry_0 = variable_qtgui_entry_0 = len(taps)
        self.preemphasis_high_corner = preemphasis_high_corner = 13e3

        ##################################################
        # Blocks
        ##################################################
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ('localhost', 8080), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self._variable_qtgui_entry_0_tool_bar = Qt.QToolBar(self)
        self._variable_qtgui_entry_0_tool_bar.addWidget(
            Qt.QLabel('filter length' + ": "))
        self._variable_qtgui_entry_0_line_edit = Qt.QLineEdit(
            str(self.variable_qtgui_entry_0))
        self._variable_qtgui_entry_0_tool_bar.addWidget(
            self._variable_qtgui_entry_0_line_edit)
        self._variable_qtgui_entry_0_line_edit.returnPressed.connect(
            lambda: self.set_variable_qtgui_entry_0(
                int(str(self._variable_qtgui_entry_0_line_edit.text()))))
        self.top_grid_layout.addWidget(self._variable_qtgui_entry_0_tool_bar)
        self.rational_resampler_xxx_0_0_0_0_0 = filter.rational_resampler_fff(
            interpolation=quad_mul,
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0_0_0_0 = filter.rational_resampler_fff(
            interpolation=quad_mul,
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff(
            interpolation=quad_mul,
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=quad_mul,
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=quad_mul,
            decimation=1,
            taps=None,
            fractional_bw=None)
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            quad_rate * num_banks,  #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.qtgui_sink_x_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)
        self.pfb_synthesizer_ccf_0 = filter.pfb_synthesizer_ccf(
            num_banks, taps, False)
        self.pfb_synthesizer_ccf_0.set_channel_map([1, 2, 6, 7, 8])
        self.pfb_synthesizer_ccf_0.declare_sample_delay(0)
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "")
        self.osmosdr_sink_0.set_sample_rate(quad_rate * num_banks)
        self.osmosdr_sink_0.set_center_freq(93200000, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(0, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
        self.blocks_short_to_float_0_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_ff(0)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(30e-6)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(30e-6)
        self.blocks_file_source_0_0_0 = blocks.file_source(
            gr.sizeof_short * 1, '../../samples/3.aud', True, 0, 0)
        self.blocks_file_source_0_0_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_short * 1, '../../samples/2.aud', True, 0, 0)
        self.blocks_file_source_0_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_short * 1,
                                                       '../../samples/1.aud',
                                                       True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.analog_frequency_modulator_fc_0_0_0_0_0 = analog.frequency_modulator_fc(
            0.8)
        self.analog_frequency_modulator_fc_0_0_0_0 = analog.frequency_modulator_fc(
            0.8)
        self.analog_frequency_modulator_fc_0_0_0 = analog.frequency_modulator_fc(
            0.8)
        self.analog_frequency_modulator_fc_0_0 = analog.frequency_modulator_fc(
            0.8)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(
            0.8)
        self.analog_fm_preemph_0_0_0_0_0 = analog.fm_preemph(
            fs=quad_rate, tau=50e-6, fh=preemphasis_high_corner)
        self.analog_fm_preemph_0_0_0_0 = analog.fm_preemph(
            fs=quad_rate, tau=50e-6, fh=preemphasis_high_corner)
        self.analog_fm_preemph_0_0_0 = analog.fm_preemph(
            fs=quad_rate, tau=50e-6, fh=preemphasis_high_corner)
        self.analog_fm_preemph_0_0 = analog.fm_preemph(
            fs=quad_rate, tau=50e-6, fh=preemphasis_high_corner)
        self.analog_fm_preemph_0 = analog.fm_preemph(
            fs=quad_rate, tau=50e-6, fh=preemphasis_high_corner)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.rational_resampler_xxx_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.rational_resampler_xxx_0_0_0_0_0, 0))
        self.connect((self.analog_fm_preemph_0, 0),
                     (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.analog_fm_preemph_0_0, 0),
                     (self.analog_frequency_modulator_fc_0_0, 0))
        self.connect((self.analog_fm_preemph_0_0_0, 0),
                     (self.analog_frequency_modulator_fc_0_0_0, 0))
        self.connect((self.analog_fm_preemph_0_0_0_0, 0),
                     (self.analog_frequency_modulator_fc_0_0_0_0, 0))
        self.connect((self.analog_fm_preemph_0_0_0_0_0, 0),
                     (self.analog_frequency_modulator_fc_0_0_0_0_0, 0))
        self.connect((self.analog_frequency_modulator_fc_0, 0),
                     (self.pfb_synthesizer_ccf_0, 0))
        self.connect((self.analog_frequency_modulator_fc_0_0, 0),
                     (self.pfb_synthesizer_ccf_0, 1))
        self.connect((self.analog_frequency_modulator_fc_0_0_0, 0),
                     (self.pfb_synthesizer_ccf_0, 2))
        self.connect((self.analog_frequency_modulator_fc_0_0_0_0, 0),
                     (self.pfb_synthesizer_ccf_0, 3))
        self.connect((self.analog_frequency_modulator_fc_0_0_0_0_0, 0),
                     (self.pfb_synthesizer_ccf_0, 4))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_short_to_float_0_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0),
                     (self.blocks_short_to_float_0_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_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.pfb_synthesizer_ccf_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.pfb_synthesizer_ccf_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_fm_preemph_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.analog_fm_preemph_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.analog_fm_preemph_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0_0, 0),
                     (self.analog_fm_preemph_0_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0_0_0, 0),
                     (self.analog_fm_preemph_0_0_0_0_0, 0))
Esempio n. 6
0
    def __init__(self):
        gr.top_block.__init__(self, "FM Sender")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("FM Sender")
        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", "fm_transmitter")

        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.osr_rf = osr_rf = 4
        self.osr_mod = osr_mod = 5
        self.fs_file = fs_file = 48000
        self.tx_gain_db = tx_gain_db = 0.8
        self.outbuffer = outbuffer = 10
        self.n_filter_delay = n_filter_delay = 289 // 2
        self.gain_rds = gain_rds = 0.05
        self.gain_pilot = gain_pilot = 0.05
        self.gain_mono = gain_mono = 0.3
        self.gain_lrdiff = gain_lrdiff = 0.5
        self.gain_hinz = gain_hinz = 0.05
        self.fs_rf = fs_rf = fs_file * osr_mod * osr_rf
        self.fs_mod = fs_mod = fs_file * osr_mod
        self.fc_pirate = fc_pirate = 99e6

        ##################################################
        # Blocks
        ##################################################
        self._tx_gain_db_range = Range(0, 1, 0.01, 0.8, 200)
        self._tx_gain_db_win = RangeWidget(self._tx_gain_db_range,
                                           self.set_tx_gain_db, 'tx_gain_db',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._tx_gain_db_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_tab_widget_0 = Qt.QTabWidget()
        self.qtgui_tab_widget_0_widget_0 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_0 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_0)
        self.qtgui_tab_widget_0_grid_layout_0 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_0.addLayout(
            self.qtgui_tab_widget_0_grid_layout_0)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_0,
                                       'Tab 0')
        self.qtgui_tab_widget_0_widget_1 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_1 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_1)
        self.qtgui_tab_widget_0_grid_layout_1 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_1.addLayout(
            self.qtgui_tab_widget_0_grid_layout_1)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_1,
                                       'Tab 1')
        self.qtgui_tab_widget_0_widget_2 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_2 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_2)
        self.qtgui_tab_widget_0_grid_layout_2 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_2.addLayout(
            self.qtgui_tab_widget_0_grid_layout_2)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_2,
                                       'Tab 2')
        self.top_grid_layout.addWidget(self.qtgui_tab_widget_0, 5, 0, 1, 1)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._n_filter_delay_range = Range(0, 400, 1, 289 // 2, 200)
        self._n_filter_delay_win = RangeWidget(self._n_filter_delay_range,
                                               self.set_n_filter_delay,
                                               'n_filter_delay',
                                               "counter_slider", int)
        self.top_grid_layout.addWidget(self._n_filter_delay_win, 9, 0, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._gain_rds_range = Range(0, 1, 0.05, 0.05, 200)
        self._gain_rds_win = RangeWidget(self._gain_rds_range,
                                         self.set_gain_rds, 'gain_rds',
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_rds_win, 8, 0, 1, 1)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._gain_pilot_range = Range(0, 1, 0.05, 0.05, 200)
        self._gain_pilot_win = RangeWidget(self._gain_pilot_range,
                                           self.set_gain_pilot, 'gain_pilot',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_pilot_win, 3, 0, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._gain_mono_range = Range(0, 1, 0.05, 0.3, 200)
        self._gain_mono_win = RangeWidget(self._gain_mono_range,
                                          self.set_gain_mono, 'gain_mono',
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_mono_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._gain_lrdiff_range = Range(0, 1, 0.05, 0.5, 200)
        self._gain_lrdiff_win = RangeWidget(self._gain_lrdiff_range,
                                            self.set_gain_lrdiff,
                                            'gain_lrdiff', "counter_slider",
                                            float)
        self.top_grid_layout.addWidget(self._gain_lrdiff_win, 2, 0, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._gain_hinz_range = Range(0, 0.5, 0.05, 0.05, 200)
        self._gain_hinz_win = RangeWidget(self._gain_hinz_range,
                                          self.set_gain_hinz, 'gain_hinz',
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_hinz_win, 4, 0, 1, 1)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.uhd_usrp_sink_1 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=list(range(0, 1)),
            ),
            '',
        )
        self.uhd_usrp_sink_1.set_center_freq(fc_pirate, 0)
        self.uhd_usrp_sink_1.set_normalized_gain(tx_gain_db, 0)
        self.uhd_usrp_sink_1.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_1.set_bandwidth(200e3, 0)
        self.uhd_usrp_sink_1.set_samp_rate(fs_rf)
        self.uhd_usrp_sink_1.set_time_unknown_pps(uhd.time_spec())
        self.rds_encoder_0 = rds.encoder(0, 20, True, 'PIRAT 17', 47.11e6,
                                         True, False, 13, 3, 147,
                                         'SAALFELDEN TESTING')

        self.rational_resampler_xxx_0_0_0_0 = filter.rational_resampler_fff(
            interpolation=osr_mod, decimation=1, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff(
            interpolation=osr_mod, decimation=1, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=osr_mod, decimation=1, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=osr_rf, decimation=1, taps=None, fractional_bw=None)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            4096 * 2,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            fs_mod,  #bw
            "fmChannelData",  #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(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.1)
        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 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 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.qtgui_tab_widget_0_layout_0.addWidget(
            self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, fs_mod, 2.5e3, .5e3, firdes.WIN_HAMMING,
                               6.76))
        self.low_pass_filter_0.set_max_output_buffer(10)
        self.gr_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.gr_unpack_k_bits_bb_0.set_max_output_buffer(10)
        self.gr_sig_source_x_0_0 = analog.sig_source_f(fs_mod,
                                                       analog.GR_COS_WAVE,
                                                       57e3, 1, 0, 0)
        self.gr_multiply_xx_0 = blocks.multiply_vff(1)
        self.gr_multiply_xx_0.set_max_output_buffer(10)
        self.gr_map_bb_1 = digital.map_bb([1, 2])
        self.gr_map_bb_1.set_max_output_buffer(10)
        self.gr_map_bb_0 = digital.map_bb([-1, 1])
        self.gr_map_bb_0.set_max_output_buffer(10)
        self.gr_diff_encoder_bb_0 = digital.diff_encoder_bb(2)
        self.gr_diff_encoder_bb_0.set_max_output_buffer(10)
        self.gr_char_to_float_0 = blocks.char_to_float(1, 1)
        self.gr_char_to_float_0.set_max_output_buffer(10)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1,
                                             int(fs_mod / 2.375 / 1000))
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_xx_0_2 = blocks.multiply_const_ff(
            gain_hinz, 1)
        self.blocks_multiply_const_xx_0_0_0 = blocks.multiply_const_ff(
            gain_pilot, 1)
        self.blocks_multiply_const_xx_0_0 = blocks.multiply_const_ff(
            gain_lrdiff, 1)
        self.blocks_multiply_const_xx_0 = blocks.multiply_const_ff(
            gain_mono, 1)
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_ff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(gain_rds)
        self.blocks_multiply_const_vxx_0_0.set_max_output_buffer(10)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float * 1,
                                             n_filter_delay)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, n_filter_delay)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_1_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, fs_mod, 30, 15e3, 100, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, fs_mod, 30, 15e3, 100, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, fs_mod, 23e3, 53e3, 2e3, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_0.set_block_alias("filter_bp_lrdiff")
        self.audio_source_0_0 = audio.source(48000, 'pulse_monitor', False)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            fs_mod, analog.GR_COS_WAVE, 19e3, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            fs_mod, analog.GR_COS_WAVE, 38e3, 1, 0, 0)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(
            75e3 / fs_mod * 2 * math.pi)
        self.analog_fm_preemph_0_0 = analog.fm_preemph(fs=fs_file,
                                                       tau=50e-6,
                                                       fh=-1.0)
        self.analog_fm_preemph_0 = analog.fm_preemph(fs=fs_file,
                                                     tau=50e-6,
                                                     fh=-1.0)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.rational_resampler_xxx_0_0_0_0, 0))
        self.connect((self.analog_fm_preemph_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_fm_preemph_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.analog_fm_preemph_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_fm_preemph_0_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_frequency_modulator_fc_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.audio_source_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.audio_source_0_0, 1),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_const_xx_0_0, 0))
        self.connect((self.band_pass_filter_1, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.band_pass_filter_1_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.blocks_multiply_const_xx_0_0_0, 0))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.blocks_multiply_const_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_fm_preemph_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_add_xx_0_0, 4))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.analog_fm_preemph_0_0, 0))
        self.connect((self.blocks_multiply_const_xx_0, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_xx_0_0, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_multiply_const_xx_0_0_0, 0),
                     (self.blocks_add_xx_0_0, 2))
        self.connect((self.blocks_multiply_const_xx_0_2, 0),
                     (self.blocks_add_xx_0_0, 3))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.gr_char_to_float_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.gr_diff_encoder_bb_0, 0), (self.gr_map_bb_1, 0))
        self.connect((self.gr_map_bb_0, 0), (self.gr_char_to_float_0, 0))
        self.connect((self.gr_map_bb_1, 0), (self.gr_unpack_k_bits_bb_0, 0))
        self.connect((self.gr_multiply_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.gr_sig_source_x_0_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_map_bb_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.gr_multiply_xx_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.uhd_usrp_sink_1, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.band_pass_filter_1, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.band_pass_filter_1_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0_0, 0),
                     (self.blocks_multiply_const_xx_0_2, 0))
        self.connect((self.rds_encoder_0, 0), (self.gr_diff_encoder_bb_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM radio transmitter")
        _icon_path = "D:\GNURadio\share\icons\hicolor\scalable/apps\gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.vol = vol = 0.91
        self.sub_gain = sub_gain = 2
        self.samp_rate = samp_rate = 420e3
        self.rds_gain = rds_gain = 0.18
        self.ps2 = ps2 = "music heals!"
        self.ps1 = ps1 = "DEMOS FM"
        self.power = power = 45
        self.pilot_gain = pilot_gain = 0.16
        self.outbuffer = outbuffer = 150000
        self.hardware_rate = hardware_rate = 2e6
        self.fm_max_dev = fm_max_dev = 75e3
        self.channel_widht = channel_widht = 120e3
        self.center_freq = center_freq = 1000 * 1e5
        self.audio_rate = audio_rate = 44100

        ##################################################
        # Blocks
        ##################################################
        _vol_sizer = wx.BoxSizer(wx.VERTICAL)
        self._vol_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_vol_sizer,
            value=self.vol,
            callback=self.set_vol,
            label='VOLUME',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._vol_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_vol_sizer,
            value=self.vol,
            callback=self.set_vol,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_vol_sizer)
        _sub_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._sub_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_sub_gain_sizer,
            value=self.sub_gain,
            callback=self.set_sub_gain,
            label='L-R level ',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._sub_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_sub_gain_sizer,
            value=self.sub_gain,
            callback=self.set_sub_gain,
            minimum=0,
            maximum=2,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_sub_gain_sizer)
        _rds_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rds_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rds_gain_sizer,
            value=self.rds_gain,
            callback=self.set_rds_gain,
            label='RDS power',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rds_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rds_gain_sizer,
            value=self.rds_gain,
            callback=self.set_rds_gain,
            minimum=0,
            maximum=0.2,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rds_gain_sizer)
        self._ps2_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.ps2,
            callback=self.set_ps2,
            label='PS2',
            converter=forms.str_converter(),
        )
        self.Add(self._ps2_text_box)
        self._ps1_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.ps1,
            callback=self.set_ps1,
            label='PS1',
            converter=forms.str_converter(),
        )
        self.Add(self._ps1_text_box)
        _power_sizer = wx.BoxSizer(wx.VERTICAL)
        self._power_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_power_sizer,
            value=self.power,
            callback=self.set_power,
            label='TX power',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._power_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_power_sizer,
            value=self.power,
            callback=self.set_power,
            minimum=1,
            maximum=47,
            num_steps=46,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_power_sizer)
        _pilot_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pilot_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            label='Pilot tone 19KHz',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._pilot_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            minimum=0,
            maximum=0.2,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_pilot_gain_sizer)
        _center_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._center_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_center_freq_sizer,
            value=self.center_freq,
            callback=self.set_center_freq,
            label='F',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._center_freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_center_freq_sizer,
            value=self.center_freq,
            callback=self.set_center_freq,
            minimum=880 * 1e5,
            maximum=1080 * 1e5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_center_freq_sizer)
        self.rational_resampler_xxx_4_0 = filter.rational_resampler_fff(
            interpolation=int(channel_widht / 1000),
            decimation=380,
            taps=None,
            fractional_bw=None,
        )
        (self.rational_resampler_xxx_4_0).set_min_output_buffer(150000)
        self.rational_resampler_xxx_3_1 = filter.rational_resampler_fff(
            interpolation=int(channel_widht) / 100,
            decimation=int(audio_rate) / 100,
            taps=None,
            fractional_bw=None,
        )
        (self.rational_resampler_xxx_3_1).set_min_output_buffer(150000)
        self.rational_resampler_xxx_2 = filter.rational_resampler_ccc(
            interpolation=int(hardware_rate / 10000),
            decimation=int(samp_rate / 10000),
            taps=None,
            fractional_bw=None,
        )
        (self.rational_resampler_xxx_2).set_min_output_buffer(100000)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=int(channel_widht / 100),
            decimation=int(audio_rate / 100),
            taps=None,
            fractional_bw=None,
        )
        (self.rational_resampler_xxx_1).set_min_output_buffer(150000)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=int(samp_rate / 1000),
            decimation=int(channel_widht / 1000),
            taps=None,
            fractional_bw=None,
        )
        (self.rational_resampler_xxx_0).set_min_output_buffer(150000)
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                           'hackrf')
        self.osmosdr_sink_0.set_sample_rate(hardware_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(0, 0)
        self.osmosdr_sink_0.set_if_gain(power, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(1.75e6, 0)

        self.gr_unpack_k_bits_bb_0_0 = blocks.unpack_k_bits_bb(2)
        (self.gr_unpack_k_bits_bb_0_0).set_max_output_buffer(150000)
        self.gr_sig_source_x_0_0_0 = analog.sig_source_f(
            channel_widht, analog.GR_SIN_WAVE, 57e3, rds_gain, 0)
        (self.gr_sig_source_x_0_0_0).set_min_output_buffer(150000)
        self.gr_rds_encoder_0_0 = rds.encoder(0, 11, True, ps1, 96900000,
                                              False, False, 7, 0, 000, ps2)

        (self.gr_rds_encoder_0_0).set_max_output_buffer(150000)
        self.gr_multiply_xx_0_0 = blocks.multiply_vff(1)
        (self.gr_multiply_xx_0_0).set_min_output_buffer(150000)
        self.gr_map_bb_1_0 = digital.map_bb(([1, 2]))
        (self.gr_map_bb_1_0).set_max_output_buffer(150000)
        self.gr_map_bb_0_0 = digital.map_bb(([-1, 1]))
        (self.gr_map_bb_0_0).set_max_output_buffer(150000)
        self.gr_frequency_modulator_fc_0 = analog.frequency_modulator_fc(
            2 * math.pi * fm_max_dev / samp_rate * 0.6)
        (self.gr_frequency_modulator_fc_0).set_min_output_buffer(150000)
        self.gr_diff_encoder_bb_0_0 = digital.diff_encoder_bb(2)
        (self.gr_diff_encoder_bb_0_0).set_max_output_buffer(150000)
        self.gr_char_to_float_0_0 = blocks.char_to_float(1, 1)
        (self.gr_char_to_float_0_0).set_max_output_buffer(150000)
        self.gr_add_xx_0_0_0_1 = blocks.add_vff(1)
        (self.gr_add_xx_0_0_0_1).set_min_output_buffer(150000)
        self.fir_filter_xxx_2 = filter.fir_filter_fff(
            1, (firdes.low_pass(1, channel_widht, 2.4e3, 0.5e3)))
        self.fir_filter_xxx_2.declare_sample_delay(0)
        (self.fir_filter_xxx_2).set_min_output_buffer(150000)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(
            1, (firdes.low_pass(2, audio_rate, 16e3, 0.2e3)))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        (self.fir_filter_xxx_1).set_min_output_buffer(150000)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(
            1, (firdes.low_pass(1, audio_rate, 16e3, 1e3)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        (self.fir_filter_xxx_0).set_min_output_buffer(150000)
        self.blocks_sub_xx_0_0 = blocks.sub_ff(1)
        (self.blocks_sub_xx_0_0).set_min_output_buffer(150000)
        self.blocks_short_to_float_1 = blocks.short_to_float(1, 1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_float * 1, 160)
        (self.blocks_repeat_0_0).set_min_output_buffer(150000)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        (self.blocks_multiply_xx_1_0).set_min_output_buffer(150000)
        self.blocks_multiply_const_xx_0_0 = blocks.multiply_const_ff(0.000032)
        (self.blocks_multiply_const_xx_0_0).set_min_output_buffer(150000)
        self.blocks_multiply_const_xx_0 = blocks.multiply_const_ff(0.000032)
        (self.blocks_multiply_const_xx_0).set_min_output_buffer(150000)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((vol, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((vol, ))
        self.blocks_keep_m_in_n_0_0 = blocks.keep_m_in_n(
            gr.sizeof_short, 1, 2, 1)
        (self.blocks_keep_m_in_n_0_0).set_min_output_buffer(150000)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_short, 1, 2,
                                                       0)
        (self.blocks_keep_m_in_n_0).set_min_output_buffer(150000)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_short * 1, 'C:\\Users\\denim\\Music\\1.wav', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        (self.blocks_file_source_0).set_min_output_buffer(50000)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 200000)
        (self.blocks_delay_0).set_min_output_buffer(150000)
        self.blocks_add_xx_2 = blocks.add_vff(1)
        (self.blocks_add_xx_2).set_min_output_buffer(150000)
        self.analog_sig_source_x_1_1 = analog.sig_source_f(
            channel_widht, analog.GR_SIN_WAVE, 19e3, pilot_gain, 0)
        (self.analog_sig_source_x_1_1).set_min_output_buffer(150000)
        self.analog_sig_source_x_1_0_0 = analog.sig_source_f(
            channel_widht, analog.GR_SIN_WAVE, 38e3, sub_gain, 0)
        (self.analog_sig_source_x_1_0_0).set_min_output_buffer(150000)
        self.analog_fm_preemph_0_0_0_0_0 = analog.fm_preemph(fs=audio_rate,
                                                             tau=50e-6,
                                                             fh=-1.0)
        (self.analog_fm_preemph_0_0_0_0_0).set_min_output_buffer(150000)
        self.analog_fm_preemph_0_0_0_0 = analog.fm_preemph(fs=audio_rate,
                                                           tau=50e-6,
                                                           fh=-1.0)
        (self.analog_fm_preemph_0_0_0_0).set_min_output_buffer(150000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fm_preemph_0_0_0_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.analog_fm_preemph_0_0_0_0_0, 0),
                     (self.fir_filter_xxx_1, 0))
        self.connect((self.analog_sig_source_x_1_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.analog_sig_source_x_1_1, 0),
                     (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_add_xx_2, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_keep_m_in_n_0_0, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_keep_m_in_n_0_0, 0),
                     (self.blocks_short_to_float_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_multiply_const_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_multiply_const_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_xx_0, 0),
                     (self.blocks_sub_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_xx_0, 0),
                     (self.gr_add_xx_0_0_0_1, 0))
        self.connect((self.blocks_multiply_const_xx_0_0, 0),
                     (self.blocks_sub_xx_0_0, 1))
        self.connect((self.blocks_multiply_const_xx_0_0, 0),
                     (self.gr_add_xx_0_0_0_1, 1))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_add_xx_2, 2))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.rational_resampler_xxx_4_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_short_to_float_1, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_sub_xx_0_0, 0),
                     (self.analog_fm_preemph_0_0_0_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.analog_fm_preemph_0_0_0_0, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.rational_resampler_xxx_3_1, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.gr_multiply_xx_0_0, 1))
        self.connect((self.gr_add_xx_0_0_0_1, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.gr_char_to_float_0_0, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.gr_diff_encoder_bb_0_0, 0), (self.gr_map_bb_1_0, 0))
        self.connect((self.gr_frequency_modulator_fc_0, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.gr_map_bb_0_0, 0), (self.gr_char_to_float_0_0, 0))
        self.connect((self.gr_map_bb_1_0, 0),
                     (self.gr_unpack_k_bits_bb_0_0, 0))
        self.connect((self.gr_multiply_xx_0_0, 0), (self.blocks_add_xx_2, 3))
        self.connect((self.gr_rds_encoder_0_0, 0),
                     (self.gr_diff_encoder_bb_0_0, 0))
        self.connect((self.gr_sig_source_x_0_0_0, 0),
                     (self.gr_multiply_xx_0_0, 0))
        self.connect((self.gr_unpack_k_bits_bb_0_0, 0),
                     (self.gr_map_bb_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.gr_frequency_modulator_fc_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_add_xx_2, 1))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.rational_resampler_xxx_3_1, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.rational_resampler_xxx_4_0, 0),
                     (self.fir_filter_xxx_2, 0))