def __init__(self): gr.hier_block2.__init__(self, "transmitter_fm", gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_gr_complex)) self.mod = analog.wfm_tx(audio_rate=44100.0, quad_rate=220.5e3) self.connect(self, self.mod, self) self.rate = 200e3 / 44.1e3
def __init__(self): analog_source.__init__(self, mod_name="wbfm", audio_rate=44.1e3) self.interp = filter.fractional_resampler_ff(0.0, .5) self.mod = analog.wfm_tx(audio_rate=self.audio_rate, quad_rate=10 * self.audio_rate, max_dev=self.audio_rate / 2) self.connect(self.random_source, self.interp, self.mod, self)
def __init__(self): gr.top_block.__init__(self, "Transmitter") ################################################## # Variables ################################################## self.samp_rate = samp_rate = int(1e6) self.freq = freq = 875e5 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=100, decimation=1, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + 'hackrf=000000000000000087c867dc2d0c6c5f') self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(10, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/pwntoo/GRC/assets/morse.wav', True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, )) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_source_0 = audio.source(44100, '', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0))
def __init__(self, channel_shift_hz=0, random_source_seed=0, sample_rate=0, symbol_rate=1): gr.hier_block2.__init__( self, "Hurdle2 Fm", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_gr_complex * 1), ) ################################################## # Parameters ################################################## self.channel_shift_hz = channel_shift_hz self.random_source_seed = random_source_seed self.sample_rate = sample_rate self.symbol_rate = symbol_rate ################################################## # Blocks ################################################## self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_ccf( 5, firdes.low_pass(1, sample_rate, symbol_rate * 5, symbol_rate, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=10000, quad_rate=600000, tau=75e-6, max_dev=50e3, ) self.analog_sig_source_x_0_0 = analog.sig_source_c( sample_rate, analog.GR_COS_WAVE, channel_shift_hz, 1, 0) self.analog_noise_source_x_1 = analog.noise_source_f( analog.GR_GAUSSIAN, 0.3, random_source_seed) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_1, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.low_pass_filter_0_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0, 0), (self, 0)) self.connect((self.low_pass_filter_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Fm Noisy Frequency") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2048 ################################################## # Blocks ################################################## self.fft_vxx_0 = fft.fft_vcc(samp_rate, True, (window.blackmanharris(samp_rate)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, samp_rate) self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, samp_rate) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1, '/dev/stdin', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, '/dev/stdout', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=samp_rate / 2, fh=-1.0, ) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 0.01, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Mc") ################################################## # Variables ################################################## self.variable_0 = variable_0 = 0 self.samp_rate_0_0 = samp_rate_0_0 = 32000 self.samp_rate_0 = samp_rate_0 = 32000 self.samp_rate = samp_rate = 32000 self.center_freq = center_freq = 99000000.0 ################################################## # Blocks ################################################## #self.uhd_usrp_sink_0 = uhd.usrp_sink( # ",".join(("", "")), # uhd.stream_args( # cpu_format="fc32", # channels=range(1), # ), #) self.uhd_usrp_sink_0 = uhd.usrp_sink(device_addr="serial=30FA179", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1))) self.uhd_usrp_sink_0.set_samp_rate(88200) self.uhd_usrp_sink_0.set_center_freq(center_freq, 0) self.uhd_usrp_sink_0.set_gain(30, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(250000, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/jiangminmin/Downloads/haha.wav', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=88200, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wbfmtx") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2500000 ################################################## # Blocks ################################################## 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(435000000, 0) self.uhd_usrp_sink_0.set_gain(60, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(100000, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=2500000, decimation=176400, taps=None, fractional_bw=None, ) self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[1], True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=176400, tau=75e-6, max_dev=5000, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0))
def __init__(self, filename, lo_freq, audio_rate, if_rate): self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/jiangminmin/Downloads/haha.wav', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=88200, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), self) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0))
def fmGen(self, noiseLevel): ################################################## # Variables ################################################## self.samp_rate = samp_rate = 300000 ################################################## # Blocks ################################################## self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[3], True) self.sink = blocks.vector_sink_c(1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate) #, True) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, )) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=176400, tau=75e-6, max_dev=5e3, # fh=-1.0, ) self.channel = channels.channel_model( noise_voltage= noiseLevel, # AWGN noise level as a voltage (edit depending on SNR) frequency_offset=0.0, # No frequency offset epsilon= 1.0, # 1.0 to keep no difference between sampling rates of clocks of transmitter and receiver noise_seed=0, # Normal random number generator for noise block_tags=False # Only needed for multipath ) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.channel, 0)) self.connect((self.channel, 0), (self.sink, 0)) return self.sink
def __init__(self): gr.top_block.__init__(self) self.sample_rate = 5000000 self.ampl = 0.1 self.freq = 100000000 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(self.sample_rate) self.uhd_usrp_sink_0.set_center_freq(self.freq, 0) self.uhd_usrp_sink_0.set_gain(90, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0.set_bandwidth(100e3, 0) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=32000, quad_rate=640000, tau=75e-6, max_dev=75e3, ) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 1, 0) def freq_jump(): while 1: if self.freq < 108000000: self.set_freq( self.freq + 5000000) else: self.set_freq(88000000) print "Jump!" time.sleep(0.2) jump_thread = threading.Thread(target=freq_jump) jump_thread.daemon = True jump_thread.start() self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.analog_wfm_tx_0, 0))
def __init__(self, frequency, file, sample_rate): gr.top_block.__init__(self, "FM Transmitter") ################################################## # Variables ################################################## self.tune_freq = tune_freq = frequency self.file_name = file_name = file self.samp_rate = samp_rate = sample_rate ################################################## # Blocks ################################################## self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + 'hackrf') self.osmosdr_sink_0.set_clock_source('gpsdo', 0) self.osmosdr_sink_0.set_time_source('gpsdo', 0) self.osmosdr_sink_0.set_time_now(osmosdr.time_spec_t(time.time()), osmosdr.ALL_MBOARDS) self.osmosdr_sink_0.set_sample_rate(16 * samp_rate) self.osmosdr_sink_0.set_center_freq(tune_freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(RF_GAIN, 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(70000, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source(file_name, True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=samp_rate, quad_rate=16 * samp_rate, tau=50e-6, max_dev=50e3, fh=-1, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0))
def __init__(self): gr.top_block.__init__(self, "CW Tx") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(samp_rate), decimation=176400, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(DEF_MORSE_FREQ, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(10, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source("/tmp/morse.wav", False) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=DEF_SAMPLE_RATE, quad_rate=176400, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Jammer") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 5000000 self.Freq = Freq = 105.9e6 ################################################## # Blocks ################################################## 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(Freq, 0) self.uhd_usrp_sink_0.set_gain(90, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0.set_bandwidth(100e3, 0) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=32000, quad_rate=640000, tau=75e-6, max_dev=75e3, ) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.analog_wfm_tx_0, 0))
def __init__(self): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 5000000 self.Freq = Freq = 105.9e6 ################################################## # Blocks ################################################## 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(Freq, 0) self.uhd_usrp_sink_0.set_gain(90, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0.set_bandwidth(100e3, 0) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=32000, quad_rate=640000, tau=75e-6, max_dev=75e3, ) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.analog_wfm_tx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wbfm Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Wbfm Tx") 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", "wbfm_tx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 400000 ################################################## # Blocks ################################################## 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(2.45e9, 0) self.uhd_usrp_sink_0.set_gain(60, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(200000, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=1, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #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_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/camellia/Downloads/disco_dancing.wav', True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, '', False) self.blocks_file_sink_0.set_unbuffered(False) self.audio_sink_0_0 = audio.sink(48000, '', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=22000, quad_rate=44000, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Hackrf") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=None, fractional_bw=None) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "") self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(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(40, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 95.7e6 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "send_frame_size=65536,num_send_frames=128")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / 200000, decimation=1, taps=None, fractional_bw=None, ) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 1) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( (-1 - 1j, -1 + 1j, 1 - 1j, 1 + 1j, 0), 1) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_1 = blocks.vector_to_stream( gr.sizeof_char * 1, 1048576) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 2048) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.001, )) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=50000, quad_rate=200000, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_f( 50000, analog.GR_COS_WAVE, 1000, 0.1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 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.samp_rate = samp_rate = 88200 self.noiseAmp = noiseAmp = 0 self.consMultiply = consMultiply = 1.333 ################################################## # Blocks ################################################## _noiseAmp_sizer = wx.BoxSizer(wx.VERTICAL) self._noiseAmp_text_box = forms.text_box( parent=self.GetWin(), sizer=_noiseAmp_sizer, value=self.noiseAmp, callback=self.set_noiseAmp, label='noiseAmp', converter=forms.float_converter(), proportion=0, ) self._noiseAmp_slider = forms.slider( parent=self.GetWin(), sizer=_noiseAmp_sizer, value=self.noiseAmp, callback=self.set_noiseAmp, minimum=0, maximum=2, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_noiseAmp_sizer) self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.n.AddPage(grc_wxgui.Panel(self.n), "tab1") self.n.AddPage(grc_wxgui.Panel(self.n), "tab2") self.n.AddPage(grc_wxgui.Panel(self.n), "tab3") self.n.AddPage(grc_wxgui.Panel(self.n), "tab4") self.Add(self.n) _consMultiply_sizer = wx.BoxSizer(wx.VERTICAL) self._consMultiply_text_box = forms.text_box( parent=self.GetWin(), sizer=_consMultiply_sizer, value=self.consMultiply, callback=self.set_consMultiply, label='consMultiply', converter=forms.float_converter(), proportion=0, ) self._consMultiply_slider = forms.slider( parent=self.GetWin(), sizer=_consMultiply_sizer, value=self.consMultiply, callback=self.set_consMultiply, minimum=0, maximum=3, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_consMultiply_sizer) self.wxgui_fftsink2_0_2 = fftsink2.fft_sink_c( self.n.GetPage(2).GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT After AWGN Addition", peak_hold=False, ) self.n.GetPage(2).Add(self.wxgui_fftsink2_0_2.win) self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_c( self.n.GetPage(1).GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT AFter WSBM Transmit", peak_hold=False, ) self.n.GetPage(1).Add(self.wxgui_fftsink2_0_1.win) self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f( self.n.GetPage(0).GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT of File Source", peak_hold=False, ) self.n.GetPage(0).Add(self.wxgui_fftsink2_0_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_f( self.n.GetPage(3).GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT After WSBM Receive (We listen to this)", peak_hold=False, ) self.n.GetPage(3).Add(self.wxgui_fftsink2_0.win) self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/students/btech/b13236/EE304P/Lab_8/zeno_lp.wav", True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((consMultiply, )) self.blocks_add_xx_0 = blocks.add_vcc(1) self.audio_sink_0 = audio.sink(44100, "", True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=88200, tau=75e-6, max_dev=75e3, ) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=88200, audio_decimation=2, ) self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, noiseAmp, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.wxgui_fftsink2_0_1, 0)) self.connect((self.blocks_add_xx_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.wxgui_fftsink2_0_2, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.wxgui_fftsink2_0_0, 0))
def create_blocks(self, modulation, sym, sn, train): self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=1, taps=None, fractional_bw=None, ) if modulation == "2psk": self.digital_mod = digital.psk.psk_mod( constellation_points=2, mod_code="gray", differential=True, samples_per_symbol=sym, excess_bw=0.35, verbose=False, log=False, ) elif modulation == "4psk": self.digital_mod = digital.psk.psk_mod( constellation_points=4, mod_code="gray", differential=True, samples_per_symbol=sym, excess_bw=0.35, verbose=False, log=False, ) elif modulation == "8psk": self.digital_mod = digital.psk.psk_mod( constellation_points=8, mod_code="gray", differential=True, samples_per_symbol=sym, excess_bw=0.35, verbose=False, log=False, ) elif modulation == "fsk": self.digital_mod = digital.gfsk_mod( samples_per_symbol=sym, sensitivity=1.0, bt=0.35, verbose=False, log=False, ) elif modulation == "qam16": self.digital_mod = digital.qam.qam_mod( constellation_points=16, mod_code="gray", differential=True, samples_per_symbol=sym, excess_bw=0.35, verbose=False, log=False, ) elif modulation == "qam64": self.digital_mod = digital.qam.qam_mod( constellation_points=64, mod_code="gray", differential=True, samples_per_symbol=sym, excess_bw=0.35, verbose=False, log=False, ) elif modulation == "gmsk": self.digital_mod = digital.gmsk_mod( samples_per_symbol=sym, bt=0.35, verbose=False, log=False, ) if train: self.blocks_wavfile_source_0 = blocks.wavfile_source( "music.wav", False) else: self.blocks_wavfile_source_0 = blocks.wavfile_source( "music2.wav", False) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=44100 * 5, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_nfm_tx_0 = analog.nbfm_tx( audio_rate=44100, quad_rate=44100 * 2, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=SNRV[sn][1], frequency_offset=100.0, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=np.random.randint(np.iinfo(np.int32).max), block_tags=False)
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") 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.working_samp_rate = working_samp_rate = 400e3 self.transition_width = transition_width = 10e3 self.samp_rate = samp_rate = 8e6 self.freq_tx = freq_tx = 98e6 self.channel_width = channel_width = 150e3 self.center_freq = center_freq = 100e6 self.audio_transition = audio_transition = 2e3 self.audio_samp_rate = audio_samp_rate = 48e3 self.audio_cutoff = audio_cutoff = 20e3 ################################################## # Blocks ################################################## self._freq_tx_tool_bar = Qt.QToolBar(self) self._freq_tx_tool_bar.addWidget(Qt.QLabel('Transmit Frequency' + ": ")) self._freq_tx_line_edit = Qt.QLineEdit(str(self.freq_tx)) self._freq_tx_tool_bar.addWidget(self._freq_tx_line_edit) self._freq_tx_line_edit.returnPressed.connect(lambda: self.set_freq_tx( eng_notation.str_to_num( str(self._freq_tx_line_edit.text().toAscii())))) self.top_layout.addWidget(self._freq_tx_tool_bar) self.rational_resampler_2 = filter.rational_resampler_ccc( interpolation=int(samp_rate / working_samp_rate), decimation=1, taps=(firdes.low_pass(1, samp_rate, channel_width / 2, transition_width)), fractional_bw=None, ) self.rational_resampler_1 = filter.rational_resampler_fff( interpolation=int(working_samp_rate / audio_samp_rate), decimation=1, taps=(firdes.low_pass(1, working_samp_rate, audio_cutoff, audio_transition)), fractional_bw=None, ) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype center_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_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(True) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '') self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(100e6, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(10, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/erik/Code/gnu-radio/fm_tx/HumanEvents_s32k.wav', True) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=int(working_samp_rate), quad_rate=int(working_samp_rate), tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq_tx - center_freq, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_2, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.rational_resampler_1, 0)) self.connect((self.rational_resampler_1, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_2, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Multi Tx") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.audio_rate = audio_rate = 48000 self.wpm = wpm = 15 self.wbfm_on = wbfm_on = True self.usb_on = usb_on = True self.samp_rate = samp_rate = audio_rate * 40 self.q_offset = q_offset = 0 self.psk_on = psk_on = True self.phase = phase = 0 self.nbfm_on = nbfm_on = True self.magnitude = magnitude = 0 self.lsb_on = lsb_on = True self.i_offset = i_offset = 0 self.gain = gain = 25 self.cw_on = cw_on = True self.center_freq = center_freq = 441000000 self.am_on = am_on = True ################################################## # Blocks ################################################## self._wbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.wbfm_on, callback=self.set_wbfm_on, label="WBFM", true=True, false=False, ) self.GridAdd(self._wbfm_on_check_box, 4, 1, 1, 1) self._usb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.usb_on, callback=self.set_usb_on, label="USB", true=True, false=False, ) self.GridAdd(self._usb_on_check_box, 4, 4, 1, 1) _q_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._q_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, label="DC offset Q", converter=forms.float_converter(), proportion=0, ) self._q_offset_slider = forms.slider( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_q_offset_sizer, 3, 0, 1, 7) self._psk_on_check_box = forms.check_box( parent=self.GetWin(), value=self.psk_on, callback=self.set_psk_on, label="PSK31", true=True, false=False, ) self.GridAdd(self._psk_on_check_box, 4, 6, 1, 1) _phase_sizer = wx.BoxSizer(wx.VERTICAL) self._phase_text_box = forms.text_box( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, label="Phase correction", converter=forms.float_converter(), proportion=0, ) self._phase_slider = forms.slider( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_phase_sizer, 0, 0, 1, 7) self._nbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.nbfm_on, callback=self.set_nbfm_on, label="NBFM", true=True, false=False, ) self.GridAdd(self._nbfm_on_check_box, 4, 0, 1, 1) _magnitude_sizer = wx.BoxSizer(wx.VERTICAL) self._magnitude_text_box = forms.text_box( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, label="Magnitude correction", converter=forms.float_converter(), proportion=0, ) self._magnitude_slider = forms.slider( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_magnitude_sizer, 1, 0, 1, 7) self._lsb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.lsb_on, callback=self.set_lsb_on, label="LSB", true=True, false=False, ) self.GridAdd(self._lsb_on_check_box, 4, 3, 1, 1) _i_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._i_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, label="DC offset I", converter=forms.float_converter(), proportion=0, ) self._i_offset_slider = forms.slider( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_i_offset_sizer, 2, 0, 1, 7) self._cw_on_check_box = forms.check_box( parent=self.GetWin(), value=self.cw_on, callback=self.set_cw_on, label="CW", true=True, false=False, ) self.GridAdd(self._cw_on_check_box, 4, 5, 1, 1) self._am_on_check_box = forms.check_box( parent=self.GetWin(), value=self.am_on, callback=self.set_am_on, label="AM", true=True, false=False, ) self.GridAdd(self._am_on_check_box, 4, 2, 1, 1) self.root_raised_cosine_filter_1 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200)) self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200)) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=192, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=samp_rate, decimation=audio_rate, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 2, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 4, decimation=1, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "") self.osmosdr_sink_0.set_sample_rate(samp_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(gain, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.interp_fir_filter_ccf( 1, firdes.low_pass(0.5, audio_rate, 5000, 400, firdes.WIN_HAMMING, 6.76)) self.iqbalance_fix_cc_0 = iqbalance.fix_cc(magnitude, phase) self.digital_psk_mod_0 = digital.psk.psk_mod( constellation_points=2, mod_code="none", differential=True, samples_per_symbol=8, excess_bw=0.35, verbose=False, log=False, ) self.digital_map_bb_0 = digital.map_bb(([1, 0])) self.blocks_wavfile_source_0 = blocks.wavfile_source( "multi_tx.wav", True) self.blocks_vector_source_x_2 = blocks.vector_source_b( (0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1), True, 1, []) self.blocks_vector_source_x_0 = blocks.vector_source_c( (1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0), True, 1, []) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, int(1.2 * audio_rate / wpm)) self.blocks_multiply_xx_6 = blocks.multiply_vcc(1) self.blocks_multiply_xx_5 = blocks.multiply_vcc(1) self.blocks_multiply_xx_4 = blocks.multiply_vcc(1) self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1) 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_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_1 = blocks.add_const_vcc( (i_offset + 1j * q_offset, )) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.5, )) self.band_pass_filter_0_0 = filter.interp_fir_filter_ccc( 1, firdes.complex_band_pass(1, audio_rate, -2800, -200, 200, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.interp_fir_filter_ccc( 1, firdes.complex_band_pass(1, audio_rate, 200, 2800, 200, firdes.WIN_HAMMING, 6.76)) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, ) self.analog_sig_source_x_6 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 22000, 1 if psk_on else 0, 0) self.analog_sig_source_x_5 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 20000, 1 if cw_on else 0, 0) self.analog_sig_source_x_4 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 120000, 1.0 / 7, 0) self.analog_sig_source_x_3_0 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 11000, 1.8 if lsb_on else 0, 0) self.analog_sig_source_x_3 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 14000, 1.8 if usb_on else 0, 0) self.analog_sig_source_x_2 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 0, 1.0 / 7 if wbfm_on else 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -100000, 1.0 / 7 if nbfm_on else 0, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 2, tau=75e-6, max_dev=5e3, ) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 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_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_2, 0)) self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_2, 1)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 0)) self.connect((self.blocks_add_xx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 2)) self.connect((self.analog_sig_source_x_4, 0), (self.blocks_multiply_xx_4, 1)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_xx_4, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_sig_source_x_3_0, 0), (self.blocks_multiply_xx_3_0, 1)) self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_3_0, 0)) self.connect((self.blocks_multiply_xx_3_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_3, 0)) self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_3, 1)) self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_1, 2)) self.connect((self.blocks_add_xx_0, 0), (self.iqbalance_fix_cc_0, 0)) self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_1, 3)) self.connect((self.analog_sig_source_x_5, 0), (self.blocks_multiply_xx_5, 1)) self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_multiply_xx_5, 0)) self.connect((self.analog_sig_source_x_6, 0), (self.blocks_multiply_xx_6, 1)) self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_1, 4)) self.connect((self.rational_resampler_xxx_3, 0), (self.blocks_multiply_xx_6, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_psk_mod_0, 0)) self.connect((self.digital_psk_mod_0, 0), (self.rational_resampler_xxx_3, 0)) self.connect((self.blocks_vector_source_x_2, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.root_raised_cosine_filter_1, 0)) self.connect((self.root_raised_cosine_filter_1, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.iqbalance_fix_cc_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Radio Tx") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.freq = freq = 462650000 self.variable_static_text_0 = variable_static_text_0 = (3e8/freq)/4 self.rf_gain = rf_gain = 10 self.if_gain = if_gain = 25 self.aud_gain = aud_gain = 2 ################################################## # Blocks ################################################## _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=30, num_steps=300, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_rf_gain_sizer, 3, 1, 1, 1) _if_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._if_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_if_gain_sizer, value=self.if_gain, callback=self.set_if_gain, label="IF Gain", converter=forms.float_converter(), proportion=0, ) self._if_gain_slider = forms.slider( parent=self.GetWin(), sizer=_if_gain_sizer, value=self.if_gain, callback=self.set_if_gain, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_if_gain_sizer, 4, 1, 1, 1) _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="Transmit Frequency", converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=462640000, maximum=462670000, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_freq_sizer, 1, 1, 1, 1) self._variable_static_text_0_static_text = forms.static_text( parent=self.GetWin(), value=self.variable_static_text_0, callback=self.set_variable_static_text_0, label="Antenna Lenth (meters)", converter=forms.float_converter(), ) self.Add(self._variable_static_text_0_static_text) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=5, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=12, decimation=5, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(int(48e3)) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(rf_gain, 0) self.osmosdr_sink_0.set_if_gain(if_gain, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( 5, 48000, 22000, 10000, firdes.WIN_HAMMING, 6.76)) self.audio_source_0 = audio.source(48000, "", True) _aud_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._aud_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_aud_gain_sizer, value=self.aud_gain, callback=self.set_aud_gain, label="Audio Input Gain", converter=forms.float_converter(), proportion=0, ) self._aud_gain_slider = forms.slider( parent=self.GetWin(), sizer=_aud_gain_sizer, value=self.aud_gain, callback=self.set_aud_gain, minimum=1, maximum=5, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_aud_gain_sizer, 6, 1, 1, 1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=int(48e3), quad_rate=int(480e3), tau=75e-6, max_dev=75e3, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.audio_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.osmosdr_sink_0, 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): gr.top_block.__init__(self, "Fm Tx Mic") Qt.QWidget.__init__(self) self.setWindowTitle("Fm Tx Mic") 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_tx_mic") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 44100 self.samp_out = samp_out = 500000 self.freq_tx = freq_tx = args.frequency #91.3e6 ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=samp_out, decimation=samp_rate*4, taps=None, fractional_bw=None, ) self.osmosdr_sink_1 = osmosdr.sink( args="numchan=" + str(1) + " " + 'driver=lime,soapy=0' ) self.osmosdr_sink_1.set_sample_rate(samp_out) self.osmosdr_sink_1.set_center_freq(freq_tx, 0) self.osmosdr_sink_1.set_freq_corr(0, 0) self.osmosdr_sink_1.set_gain(10, 0) self.osmosdr_sink_1.set_if_gain(20, 0) self.osmosdr_sink_1.set_bb_gain(20, 0) self.osmosdr_sink_1.set_antenna('BAND1', 0) self.osmosdr_sink_1.set_bandwidth(0, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.audio_source_0 = audio.source(samp_rate, '', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=samp_rate, quad_rate=samp_rate*4, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_c(samp_out, analog.GR_COS_WAVE, 0, 142.857e-3, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.audio_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_xx_0, 0))
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") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.heterodyne_freq = heterodyne_freq = 915 * 1e6 self.gain_src = gain_src = 3 * 10e-6 self.gain_fm = gain_fm = 32768 self.samp_rate = samp_rate = 640000 self.heterodyne_freq_slider = heterodyne_freq_slider = heterodyne_freq self.gain_src_slider = gain_src_slider = gain_src self.gain_fm_slider = gain_fm_slider = gain_fm self.center_freq = center_freq = 915e6 ################################################## # Blocks ################################################## self._heterodyne_freq_slider_range = Range(heterodyne_freq - 10 * 1e6, heterodyne_freq + 10 * 1e6, 1e5, heterodyne_freq, 200) self._heterodyne_freq_slider_win = RangeWidget( self._heterodyne_freq_slider_range, self.set_heterodyne_freq_slider, 'Heterodyne freq', "counter_slider", float) self.top_grid_layout.addWidget(self._heterodyne_freq_slider_win) self._gain_src_slider_range = Range(gain_src - 10 * 1e-6, gain_src + 10 * 10e-6, 1 * 10e-7, gain_src, 200) self._gain_src_slider_win = RangeWidget(self._gain_src_slider_range, self.set_gain_src_slider, 'Gain src', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_src_slider_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype center_freq, #fc samp_rate * 30, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(0, 100) 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(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) 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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self._gain_fm_slider_range = Range(gain_fm - 10e3, gain_fm + 100e3, 1e3, gain_fm, 200) self._gain_fm_slider_win = RangeWidget(self._gain_fm_slider_range, self.set_gain_fm_slider, 'Gain FM', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_fm_slider_win) self.blocks_short_to_float_0 = blocks.short_to_float(1, 1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff( (gain_src_slider, )) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_short * 1, '/home/max/Work dir/_University/Digilent/RF-signal-power-meter/GNU_Radio_prototype/Examples/FM transmitter/audio_fifo.fifo', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.audio_sink_0 = audio.sink(32000, '', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=32000, quad_rate=640000, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, heterodyne_freq_slider, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_short_to_float_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_short_to_float_0, 0), (self.blocks_multiply_const_vxx_1, 0))
def __init__(self, freq=93.4e6, inputfile='jen_ai_marre.wav', ppm=0): grc_wxgui.top_block_gui.__init__(self, title="Wbfm Tx Hackrf") _icon_path = "C:\Program Files\GNURadio-3.7\share\icons\hicolor\scalable/apps\gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Parameters ################################################## self.freq = freq self.inputfile = inputfile self.ppm = ppm ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=2e6, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=8, decimation=1, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '') self.osmosdr_sink_0.set_sample_rate(8e6) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(14, 0) self.osmosdr_sink_0.set_if_gain(40, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(250e3, 0) self.fractional_interpolator_xx_0 = filter.fractional_interpolator_ff( 1, 875e-3) self.audio_source_0 = audio.source(48000, '', True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=32000, quad_rate=320000, tau=300e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.audio_source_0, 0), (self.fractional_interpolator_xx_0, 0)) self.connect((self.fractional_interpolator_xx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): gr.top_block.__init__(self, "NFM-WFM-Transmitter") Qt.QWidget.__init__(self) self.setWindowTitle("NFM-WFM-Transmitter") 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", "nfm_wfm_transmitter") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 8e6 self.nfm = nfm = 1 self.gain = gain = 0.1 self.freq = freq = 145.75e6 self.audio_rate = audio_rate = 48000 ################################################## # Blocks ################################################## _nfm_check_box = Qt.QCheckBox('WFM') self._nfm_choices = {True: 1, False: 0} self._nfm_choices_inv = dict((v,k) for k,v in self._nfm_choices.iteritems()) self._nfm_callback = lambda i: Qt.QMetaObject.invokeMethod(_nfm_check_box, "setChecked", Qt.Q_ARG("bool", self._nfm_choices_inv[i])) self._nfm_callback(self.nfm) _nfm_check_box.stateChanged.connect(lambda i: self.set_nfm(self._nfm_choices[bool(i)])) self.top_grid_layout.addWidget(_nfm_check_box) self._gain_range = Range(0, 1, 0.01, 0.1, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Input gain', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win) self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel('Frequency'+": ")) self._freq_line_edit = Qt.QLineEdit(str(self.freq)) self._freq_tool_bar.addWidget(self._freq_line_edit) self._freq_line_edit.returnPressed.connect( lambda: self.set_freq(eng_notation.str_to_num(str(self._freq_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._freq_tool_bar) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=500, decimation=6, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + 'hackrf=0000000000000000a27466e62362050f' ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(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(20, 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_wavfile_source_0 = blocks.wavfile_source('D:\\Test-WAV.wav', True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((gain, )) self.blks2_selector_0_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=2, num_outputs=1, input_index=nfm, output_index=0, ) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_float*1, num_inputs=1, num_outputs=2, input_index=0, output_index=nfm, ) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate*2, tau=75e-6, max_dev=100e3, fh=-1.0, ) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate*2, tau=75e-6, max_dev=5e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_tx_0, 0), (self.blks2_selector_0_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.blks2_selector_0_0, 1)) self.connect((self.blks2_selector_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blks2_selector_0, 1), (self.analog_wfm_tx_0, 0)) self.connect((self.blks2_selector_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blks2_selector_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Multi Tx") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.audio_rate = audio_rate = 48000 self.wpm = wpm = 15 self.wbfm_on = wbfm_on = True self.usb_on = usb_on = True self.samp_rate = samp_rate = audio_rate * 40 self.q_offset = q_offset = 0 self.psk_on = psk_on = True self.phase = phase = 0 self.nbfm_on = nbfm_on = True self.magnitude = magnitude = 0 self.lsb_on = lsb_on = True self.i_offset = i_offset = 0 self.gain = gain = 25 self.cw_on = cw_on = True self.center_freq = center_freq = 441000000 self.am_on = am_on = True ################################################## # Blocks ################################################## self._wbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.wbfm_on, callback=self.set_wbfm_on, label="WBFM", true=True, false=False, ) self.GridAdd(self._wbfm_on_check_box, 4, 1, 1, 1) self._usb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.usb_on, callback=self.set_usb_on, label="USB", true=True, false=False, ) self.GridAdd(self._usb_on_check_box, 4, 4, 1, 1) _q_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._q_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, label="DC offset Q", converter=forms.float_converter(), proportion=0, ) self._q_offset_slider = forms.slider( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_q_offset_sizer, 3, 0, 1, 7) self._psk_on_check_box = forms.check_box( parent=self.GetWin(), value=self.psk_on, callback=self.set_psk_on, label="PSK31", true=True, false=False, ) self.GridAdd(self._psk_on_check_box, 4, 6, 1, 1) _phase_sizer = wx.BoxSizer(wx.VERTICAL) self._phase_text_box = forms.text_box( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, label="Phase correction", converter=forms.float_converter(), proportion=0, ) self._phase_slider = forms.slider( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_phase_sizer, 0, 0, 1, 7) self._nbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.nbfm_on, callback=self.set_nbfm_on, label="NBFM", true=True, false=False, ) self.GridAdd(self._nbfm_on_check_box, 4, 0, 1, 1) _magnitude_sizer = wx.BoxSizer(wx.VERTICAL) self._magnitude_text_box = forms.text_box( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, label="Magnitude correction", converter=forms.float_converter(), proportion=0, ) self._magnitude_slider = forms.slider( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_magnitude_sizer, 1, 0, 1, 7) self._lsb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.lsb_on, callback=self.set_lsb_on, label="LSB", true=True, false=False, ) self.GridAdd(self._lsb_on_check_box, 4, 3, 1, 1) _i_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._i_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, label="DC offset I", converter=forms.float_converter(), proportion=0, ) self._i_offset_slider = forms.slider( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_i_offset_sizer, 2, 0, 1, 7) self._cw_on_check_box = forms.check_box( parent=self.GetWin(), value=self.cw_on, callback=self.set_cw_on, label="CW", true=True, false=False, ) self.GridAdd(self._cw_on_check_box, 4, 5, 1, 1) self._am_on_check_box = forms.check_box( parent=self.GetWin(), value=self.am_on, callback=self.set_am_on, label="AM", true=True, false=False, ) self.GridAdd(self._am_on_check_box, 4, 2, 1, 1) self.root_raised_cosine_filter_1 = filter.fir_filter_ccf(1, firdes.root_raised_cosine( 1, audio_rate, 5, 0.35, 200)) self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine( 1, audio_rate, 5, 0.35, 200)) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=192, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=samp_rate, decimation=audio_rate, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 2, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 4, decimation=1, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_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(gain, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.interp_fir_filter_ccf(1, firdes.low_pass( 0.5, audio_rate, 5000, 400, firdes.WIN_HAMMING, 6.76)) self.iqbalance_fix_cc_0 = iqbalance.fix_cc(magnitude, phase) self.digital_psk_mod_0 = digital.psk.psk_mod( constellation_points=2, mod_code="none", differential=True, samples_per_symbol=8, excess_bw=0.35, verbose=False, log=False, ) self.digital_map_bb_0 = digital.map_bb(([1,0])) self.blocks_wavfile_source_0 = blocks.wavfile_source("multi_tx.wav", True) self.blocks_vector_source_x_2 = blocks.vector_source_b((0,0, 1,1,0,1,1,0,1, 0,0, 1,0,1,0,1,1, 0,0, 1,1,0,1, 0,0, 1,0,1,1,1, 0,0, 1, 0,0, 1,1,0,1, 0,0, 1,0,1,1,1, 0,0, 1, 0,0, 1,1,0,1,1,0,1,0,1, 0,0, 1,1,1,0,1,1,1, 0,0, 1,1,1,1,1,1,1,1, 0,0, 1,1,1,1,1,1,1, 0,0, 1,0,1,0,1,1,1,1, 0,0, 1,0,1,0,1,1,1,1, 0,0, 1, 0,0, 1,0,1, 0,0, 1,1, 0,0, 1,0,1,1,1, 0,0, 1,0,1, 0,0, 1,1,0,1, 0,0, 1,1,1,1, 0,0, 1,0,1,1,0,1,1, 0,0, 1,0,1,0,1,1,1, 0,0, 1,1,1,0,1), True, 1, []) self.blocks_vector_source_x_0 = blocks.vector_source_c((1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0,0,0,0,0, 1,1,1,0,1,0,1, 0,0,0, 1, 0,0,0,0,0,0,0, 1,0,1,0,1,0,1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1,0,1,1,1,0,1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0, 1,0,1,1,1,0,1, 0,0,0,0,0,0,0, 1,1,1, 0,0,0, 1, 0,0,0, 1,0,1,0,1, 0,0,0, 1,1,1, 0,0,0, 1,0,1, 0,0,0, 1,1,1,0,1, 0,0,0, 1,1,1,0,1,1,1,0,1, 0,0,0,0,0,0,0), True, 1, []) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, int(1.2 * audio_rate / wpm)) self.blocks_multiply_xx_6 = blocks.multiply_vcc(1) self.blocks_multiply_xx_5 = blocks.multiply_vcc(1) self.blocks_multiply_xx_4 = blocks.multiply_vcc(1) self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1) 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_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_1 = blocks.add_const_vcc((i_offset + 1j * q_offset, )) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.5, )) self.band_pass_filter_0_0 = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass( 1, audio_rate, -2800, -200, 200, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass( 1, audio_rate, 200, 2800, 200, firdes.WIN_HAMMING, 6.76)) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, ) self.analog_sig_source_x_6 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 22000, 1 if psk_on else 0, 0) self.analog_sig_source_x_5 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 20000, 1 if cw_on else 0, 0) self.analog_sig_source_x_4 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 120000, 1.0 / 7, 0) self.analog_sig_source_x_3_0 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 11000, 1.8 if lsb_on else 0, 0) self.analog_sig_source_x_3 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 14000, 1.8 if usb_on else 0, 0) self.analog_sig_source_x_2 = analog.sig_source_c(audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0) self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 0, 1.0 / 7 if wbfm_on else 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -100000, 1.0 / 7 if nbfm_on else 0, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 2, tau=75e-6, max_dev=5e3, ) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 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_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_2, 0)) self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_2, 1)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 0)) self.connect((self.blocks_add_xx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 2)) self.connect((self.analog_sig_source_x_4, 0), (self.blocks_multiply_xx_4, 1)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_xx_4, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.analog_sig_source_x_3_0, 0), (self.blocks_multiply_xx_3_0, 1)) self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_3_0, 0)) self.connect((self.blocks_multiply_xx_3_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_3, 0)) self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_3, 1)) self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_1, 2)) self.connect((self.blocks_add_xx_0, 0), (self.iqbalance_fix_cc_0, 0)) self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_1, 3)) self.connect((self.analog_sig_source_x_5, 0), (self.blocks_multiply_xx_5, 1)) self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_multiply_xx_5, 0)) self.connect((self.analog_sig_source_x_6, 0), (self.blocks_multiply_xx_6, 1)) self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_1, 4)) self.connect((self.rational_resampler_xxx_3, 0), (self.blocks_multiply_xx_6, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_psk_mod_0, 0)) self.connect((self.digital_psk_mod_0, 0), (self.rational_resampler_xxx_3, 0)) self.connect((self.blocks_vector_source_x_2, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.root_raised_cosine_filter_1, 0)) self.connect((self.root_raised_cosine_filter_1, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.iqbalance_fix_cc_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") 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.samp_rate = samp_rate = 32000 self.pam4_constellation = pam4_constellation = digital.constellation_calcdist( ([0, 1, 3, 2]), ([0, 1, 3, 2]), 4, 1).base() self.noiseamp = noiseamp = (10**(-0.9) + 10) / 2 self.noise_enable = noise_enable = 0 self.mod_select = mod_select = 1 self.ebw_range = ebw_range = 0.35 self.a_src_freq = a_src_freq = 200e3 ################################################## # Blocks ################################################## self._noiseamp_range = Range(10**(-0.9), 10, 0.001, (10**(-0.9) + 10) / 2, 200) self._noiseamp_win = RangeWidget(self._noiseamp_range, self.set_noiseamp, "Noise Amplitude", "counter_slider", float) self.top_grid_layout.addWidget(self._noiseamp_win, 0, 2) _noise_enable_check_box = Qt.QCheckBox("Noise Enable") self._noise_enable_choices = {True: 1, False: 0} self._noise_enable_choices_inv = dict( (v, k) for k, v in self._noise_enable_choices.iteritems()) self._noise_enable_callback = lambda i: Qt.QMetaObject.invokeMethod( _noise_enable_check_box, "setChecked", Qt.Q_ARG("bool", self._noise_enable_choices_inv[i])) self._noise_enable_callback(self.noise_enable) _noise_enable_check_box.stateChanged.connect( lambda i: self.set_noise_enable(self._noise_enable_choices[bool(i)] )) self.top_grid_layout.addWidget(_noise_enable_check_box, 0, 1) self._mod_select_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] self._mod_select_labels = [ "BPSK", "QPSK", "8PSK", "QAM16", "QAM64", "PAM4", "GFSK", "CPFSK", "WBFM", "AM-DSB", "AM-SSB" ] self._mod_select_tool_bar = Qt.QToolBar(self) self._mod_select_tool_bar.addWidget(Qt.QLabel("mod_select" + ": ")) self._mod_select_combo_box = Qt.QComboBox() self._mod_select_tool_bar.addWidget(self._mod_select_combo_box) for label in self._mod_select_labels: self._mod_select_combo_box.addItem(label) self._mod_select_callback = lambda i: Qt.QMetaObject.invokeMethod( self._mod_select_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._mod_select_options.index(i))) self._mod_select_callback(self.mod_select) self._mod_select_combo_box.currentIndexChanged.connect( lambda i: self.set_mod_select(self._mod_select_options[i])) self.top_grid_layout.addWidget(self._mod_select_tool_bar, 0, 0) self._a_src_freq_range = Range(44100, 200e3, 10, 200e3, 200) self._a_src_freq_win = RangeWidget(self._a_src_freq_range, self.set_a_src_freq, "Analog Source Frequency", "counter_slider", float) self.top_layout.addWidget(self._a_src_freq_win) 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(0, 0) self.uhd_usrp_sink_0.set_gain(0, 0) self.sig_source_0 = analog.sig_source_f(samp_rate, analog.GR_TRI_WAVE, 44100, 1, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 2048, #size samp_rate, #samp_rate "Times Series", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_control_panel(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 * 1): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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, 1, 2) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "Frequency Spectrum", #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(-140, 10) self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(True) self.qtgui_freq_sink_x_0.enable_grid(True) 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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1, 3) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 2048, #size "Constellation", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(True) self.qtgui_const_sink_x_0.enable_grid(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [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_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 0, 1, 2) self.hilbert_fc_0 = filter.hilbert_fc(401, firdes.WIN_HAMMING, 6.76) self.fractional_interpolator_xx_0 = filter.fractional_interpolator_ff( 0, 44100 / a_src_freq) self.digital_qam_mod_0_1 = digital.qam.qam_mod( constellation_points=64, mod_code="gray", differential=True, samples_per_symbol=8, excess_bw=ebw_range, verbose=False, log=False, ) self.digital_qam_mod_0_0 = digital.qam.qam_mod( constellation_points=16, mod_code="gray", differential=True, samples_per_symbol=8, excess_bw=ebw_range, verbose=False, log=False, ) self.digital_psk_mod_1 = digital.psk.psk_mod( constellation_points=8, mod_code="gray", differential=True, samples_per_symbol=8, excess_bw=ebw_range, verbose=False, log=False, ) self.digital_psk_mod_0_0 = digital.psk.psk_mod( constellation_points=2, mod_code="gray", differential=True, samples_per_symbol=8, excess_bw=ebw_range, verbose=False, log=False, ) self.digital_psk_mod_0 = digital.psk.psk_mod( constellation_points=4, mod_code="gray", differential=True, samples_per_symbol=8, excess_bw=ebw_range, verbose=False, log=False, ) self.digital_gfsk_mod_0 = digital.gfsk_mod( samples_per_symbol=8, sensitivity=0.1, bt=ebw_range, verbose=False, log=False, ) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=pam4_constellation, differential=True, samples_per_symbol=8, pre_diff_code=True, excess_bw=ebw_range, verbose=False, log=False, ) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_packed_to_unpacked_xx_1 = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_LSB_FIRST) self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff((0.1, )) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc( (1 + 1j, )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, )) self.blks2_selector_1 = grc_blks2.selector( item_size=gr.sizeof_gr_complex * 1, num_inputs=2, num_outputs=1, input_index=noise_enable, output_index=0, ) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex * 1, num_inputs=11, num_outputs=1, input_index=mod_select, output_index=0, ) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=44100, quad_rate=220500, tau=75e-6, max_dev=75e3, ) self.analog_sig_source_x_0_0 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, a_src_freq, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, a_src_freq, 1, 0) self.analog_random_source_x_0 = blocks.vector_source_b( map(int, numpy.random.randint(0, 64, 8192)), True) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, noiseamp, 31415) self.analog_cpfsk_bc_0 = analog.cpfsk_bc(0.5, 1.0, 8) self.analog_const_source_x_1 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) self.analog_const_source_x_0 = analog.sig_source_c( 0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blks2_selector_1, 0)) self.connect((self.analog_const_source_x_1, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_cpfsk_bc_0, 0), (self.blks2_selector_0, 7)) self.connect((self.analog_noise_source_x_0, 0), (self.blks2_selector_1, 1)) self.connect((self.analog_random_source_x_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.blocks_packed_to_unpacked_xx_1, 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_multiply_xx_0_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.blks2_selector_0, 8)) self.connect((self.blks2_selector_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blks2_selector_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blks2_selector_0, 1)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.blocks_add_const_vxx_0_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blks2_selector_0, 9)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.analog_cpfsk_bc_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_psk_mod_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_psk_mod_0_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_psk_mod_1, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_qam_mod_0_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_qam_mod_0_1, 0)) self.connect((self.blocks_packed_to_unpacked_xx_1, 0), (self.digital_gfsk_mod_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blks2_selector_0, 5)) self.connect((self.digital_gfsk_mod_0, 0), (self.blks2_selector_0, 6)) self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_psk_mod_0_0, 0), (self.blks2_selector_0, 0)) self.connect((self.digital_psk_mod_1, 0), (self.blks2_selector_0, 2)) self.connect((self.digital_qam_mod_0_0, 0), (self.blks2_selector_0, 3)) self.connect((self.digital_qam_mod_0_1, 0), (self.blks2_selector_0, 4)) self.connect((self.fractional_interpolator_xx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.fractional_interpolator_xx_0, 0), (self.blocks_multiply_const_vxx_1_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.blks2_selector_0, 10)) self.connect((self.sig_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.sig_source_0, 0), (self.fractional_interpolator_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "multi_fm_transmit") ################################################## # Variables ################################################## self.num_banks = num_banks = 30 self.mod_rate = mod_rate = 200000 self.taps_rs = taps_rs = firdes.low_pass_2(25.0, 25.0, 0.1, 0.1, 60, firdes.WIN_KAISER, 7.0) self.taps = taps = firdes.low_pass_2(8, num_banks*mod_rate, 120e3, 50e3, 80, firdes.WIN_BLACKMAN_HARRIS) self.aud_rate = aud_rate = 48000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff( interpolation=25, decimation=6, taps=taps_rs, fractional_bw=0.3) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=25, decimation=6, taps=taps_rs, fractional_bw=0.3) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=25, decimation=6, taps=taps_rs, fractional_bw=0.3) self.pfb_synthesizer_ccf_0 = filter.pfb_synthesizer_ccf( num_banks, taps, False) self.pfb_synthesizer_ccf_0.set_channel_map([1,9,8]) self.pfb_synthesizer_ccf_0.declare_sample_delay(0) self.osmosdr_sink_1 = osmosdr.sink( args="numchan=" + str(1) + " " + "buffers=1" ) self.osmosdr_sink_1.set_sample_rate(mod_rate*num_banks) self.osmosdr_sink_1.set_center_freq(96000000, 0) self.osmosdr_sink_1.set_freq_corr(0, 0) self.osmosdr_sink_1.set_gain(0, 0) self.osmosdr_sink_1.set_if_gain(0, 0) self.osmosdr_sink_1.set_bb_gain(0, 0) self.osmosdr_sink_1.set_antenna('', 0) self.osmosdr_sink_1.set_bandwidth(0, 0) self.audio_source_0 = audio.source(aud_rate, 'plughw:UMC1820', False) self.analog_wfm_tx_0_0_0 = analog.wfm_tx( audio_rate=mod_rate, quad_rate=mod_rate, tau=75e-6, max_dev=75e3, fh=10e3, ) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=mod_rate, quad_rate=mod_rate, tau=75e-6, max_dev=75e3, fh=10e3, ) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=mod_rate, quad_rate=mod_rate, tau=75e-6, max_dev=75e3, fh=10e3, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.pfb_synthesizer_ccf_0, 0)) self.connect((self.analog_wfm_tx_0_0, 0), (self.pfb_synthesizer_ccf_0, 1)) self.connect((self.analog_wfm_tx_0_0_0, 0), (self.pfb_synthesizer_ccf_0, 2)) self.connect((self.audio_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.audio_source_0, 1), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.audio_source_0, 2), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.pfb_synthesizer_ccf_0, 0), (self.osmosdr_sink_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_wfm_tx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.analog_wfm_tx_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp", catch_exceptions=True) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", '')), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), '', ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec(0)) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=[], fractional_bw=-1.0) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, window.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 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", "m2k_am_if_to_fm_pluto_tx") 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.tx_samp_rate = tx_samp_rate = 600000 self.tx_freq = tx_freq = 90e6 self.samp_rate = samp_rate = 10000000 self.rr_interp = rr_interp = 8 self.rr_decim = rr_decim = 5 self.osr = osr = 5 self.lp_decim = lp_decim = 10 self.if_freq = if_freq = 475000 self.fx_decim = fx_decim = 10 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=rr_interp, decimation=rr_decim, taps=[128], fractional_bw=0.8) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( 4096, #size samp_rate / (osr * fx_decim), #samp_rate "Demodulated Baseband", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_1.enable_tags(True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_1.enable_autoscale(True) self.qtgui_time_sink_x_0_1.enable_grid(True) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(True) self.qtgui_time_sink_x_0_1.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_1_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( 4096, #size samp_rate / (osr * fx_decim), #samp_rate "Translated I.F.", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) 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(True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(True) 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(True) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] 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] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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) self.m2k_analog_in_source_0 = m2k.analog_in_source( 'ip:192.168.3.1', 16384, [True, False], [0, 0], samp_rate, osr, 4, True, True, [2, 0], [0, 0], 0, 0, [0, 0]) self.low_pass_filter_0 = filter.fir_filter_fff( lp_decim, firdes.low_pass(1, samp_rate / (osr * fx_decim), 3000, 500, firdes.WIN_HAMMING, 6.76)) self.iio_pluto_sink_0 = iio.pluto_sink('ip:192.168.2.1', int(tx_freq), tx_samp_rate, 200000, 32768, False, 0, '', True) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcc( fx_decim, firdes.low_pass(1, (samp_rate / osr), (samp_rate / osr) / (2 * fx_decim), 20000), if_freq, samp_rate / osr) self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(1) self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(32000, '', False) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=int(samp_rate / (osr * fx_decim * lp_decim)), quad_rate=tx_samp_rate, tau=75e-6, max_dev=150e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.iio_pluto_sink_0, 0)) self.connect((self.blocks_complex_to_mag_1, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_complex_to_mag_1, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 1)) self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.m2k_analog_in_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 95.7e6 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "send_frame_size=65536,num_send_frames=128")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / 200000, decimation=1, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, (), True, 1) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( 2048, 2048 + 112, 0, '') self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( (-1 - 1j, -1 + 1j, 1 - 1j, 1 + 1j, 0), 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 2048) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.001, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1, 'symbols.raw', False) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=50000, quad_rate=200000, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_f( 50000, analog.GR_COS_WAVE, 1000, 0.1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_file_source_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self, control): self.ctl = control gr.top_block.__init__(self, "Fmtx") Qt.QWidget.__init__(self) self.setWindowTitle("Fmtx") 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", "fmTX") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.swap__ = swap__ = 0 self.samp_rate = samp_rate = 1.323e6 self.ptt = ptt = 0 self.freq = freq = 103.7e6 self.die__ = die__ = 0 self.audio_samp_in = audio_samp_in = 44100 ################################################## # Blocks ################################################## self._samp_rate_range = Range(0, 6.00e6, 1, 1.323e6, 200) self._samp_rate_win = RangeWidget(self._samp_rate_range, self.set_samp_rate, "Sample Rate Slider", "counter_slider", float) self.top_layout.addWidget(self._samp_rate_win) _ptt_push_button = Qt.QPushButton("ptt") self._ptt_choices = {'Pressed': 1, 'Released': 0} _ptt_push_button.pressed.connect(lambda: self.set_ptt(self._ptt_choices['Pressed'])) _ptt_push_button.released.connect(lambda: self.set_ptt(self._ptt_choices['Released'])) self.top_layout.addWidget(_ptt_push_button) self._freq_range = Range(88e6, 108e6, 100e3, 103.7e6, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "Frequency Slider", "counter_slider", float) self.top_layout.addWidget(self._freq_win) _swap___push_button = Qt.QPushButton("Switch to RX") self._swap___choices = {'Pressed': 1, 'Released': 0} _swap___push_button.pressed.connect(lambda: self.set_swap__(self._swap___choices['Pressed'])) _swap___push_button.released.connect(lambda: self.set_swap__(self._swap___choices['Released'])) self.top_layout.addWidget(_swap___push_button) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=10, decimation=1, 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_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(True) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(14, 0) self.osmosdr_sink_0.set_if_gain(47, 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) _die___push_button = Qt.QPushButton("GUI Kill") self._die___choices = {'Pressed': 1, 'Released': 0} _die___push_button.pressed.connect(lambda: self.set_die__(self._die___choices['Pressed'])) _die___push_button.released.connect(lambda: self.set_die__(self._die___choices['Released'])) self.top_layout.addWidget(_die___push_button) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((ptt, )) self.audio_source_0 = audio.source(44100, "", True) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_samp_in, quad_rate=audio_samp_in * 3, tau=75e-6, max_dev=75e3, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.audio_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Am Fm") Qt.QWidget.__init__(self) self.setWindowTitle("Am Fm") 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", "am_fm") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 self.gain = gain = 0 self.delay = delay = 0 self.const = const = 1 ################################################## # Blocks ################################################## self._gain_range = Range(-20, 20, 1, 0, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", float) self.top_layout.addWidget(self._gain_win) self._delay_range = Range(-1000, 1000, 1, 0, 200) self._delay_win = RangeWidget(self._delay_range, self.set_delay, "delay", "counter_slider", float) self.top_layout.addWidget(self._delay_win) self._const_range = Range(-5, 5, 1, 1, 200) self._const_win = RangeWidget(self._const_range, self.set_const, "const", "counter_slider", float) self.top_layout.addWidget(self._const_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #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(-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) 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.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) 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_0 = blocks.multiply_const_vff( (pow(10.0, gain / 10.0), )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 0) self.blocks_add_const_vxx_0 = blocks.add_const_vff((const, )) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=int(samp_rate), quad_rate=int(samp_rate), tau=75e-6, max_dev=75e2, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, 1000, 0.1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") 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.samp_rate = samp_rate = 25000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=8, decimation=1, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_3_0 = qtgui.time_sink_f( 500, #size samp_rate, #samp_rate "after_interpolator", #name 1 #number of inputs ) self.qtgui_time_sink_x_3_0.set_update_time(0.10) self.qtgui_time_sink_x_3_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_3_0.set_y_label("Amplitude", "") self.qtgui_time_sink_x_3_0.enable_tags(-1, True) self.qtgui_time_sink_x_3_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_3_0.enable_autoscale(False) self.qtgui_time_sink_x_3_0.enable_grid(False) self.qtgui_time_sink_x_3_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_3_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_3_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_3_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_3_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_3_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_3_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_3_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_3_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_3_0_win = sip.wrapinstance(self.qtgui_time_sink_x_3_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_3_0_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( 500, #size samp_rate, #samp_rate "after_FM", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) 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_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_control_panel(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(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) 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_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(1e6) self.osmosdr_sink_0.set_center_freq(1000e6, 0) self.osmosdr_sink_0.set_freq_corr(6, 0) self.osmosdr_sink_0.set_gain(0, 0) self.osmosdr_sink_0.set_if_gain(40, 0) self.osmosdr_sink_0.set_bb_gain(30, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(250e3, 0) self.fractional_interpolator_xx_0 = filter.fractional_interpolator_ff(1, 0.875) self.file_input = qtgui.time_sink_f( 500, #size samp_rate, #samp_rate "file_input", #name 1 #number of inputs ) self.file_input.set_update_time(0.10) self.file_input.set_y_axis(-1, 1) self.file_input.set_y_label("Amplitude", "") self.file_input.enable_tags(-1, True) self.file_input.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.file_input.enable_autoscale(False) self.file_input.enable_grid(False) self.file_input.enable_control_panel(False) if not True: self.file_input.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.file_input.set_line_label(i, "Data {0}".format(i)) else: self.file_input.set_line_label(i, labels[i]) self.file_input.set_line_width(i, widths[i]) self.file_input.set_line_color(i, colors[i]) self.file_input.set_line_style(i, styles[i]) self.file_input.set_line_marker(i, markers[i]) self.file_input.set_line_alpha(i, alphas[i]) self._file_input_win = sip.wrapinstance(self.file_input.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._file_input_win) self.blocks_vector_source_x_0 = blocks.vector_source_f((0, 0, 0), True, 1, []) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_float*1, (1, 1)) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, 10) self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/andy/code.txt", True) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((-0.5, )) self.bipolar_wave = qtgui.time_sink_f( 500, #size samp_rate, #samp_rate "bipolar_wave", #name 1 #number of inputs ) self.bipolar_wave.set_update_time(0.10) self.bipolar_wave.set_y_axis(-1, 1) self.bipolar_wave.set_y_label("Amplitude", "") self.bipolar_wave.enable_tags(-1, True) self.bipolar_wave.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.bipolar_wave.enable_autoscale(False) self.bipolar_wave.enable_grid(False) self.bipolar_wave.enable_control_panel(False) if not True: self.bipolar_wave.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.bipolar_wave.set_line_label(i, "Data {0}".format(i)) else: self.bipolar_wave.set_line_label(i, labels[i]) self.bipolar_wave.set_line_width(i, widths[i]) self.bipolar_wave.set_line_color(i, colors[i]) self.bipolar_wave.set_line_style(i, styles[i]) self.bipolar_wave.set_line_marker(i, markers[i]) self.bipolar_wave.set_line_alpha(i, alphas[i]) self._bipolar_wave_win = sip.wrapinstance(self.bipolar_wave.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._bipolar_wave_win) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=int(25e3), quad_rate=int(500e3), tau=3e-6, max_dev=50e3, ) self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_CONST_WAVE, 1000, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_CONST_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## 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_multiply_xx_0_0, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.file_input, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_stream_mux_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.bipolar_wave, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.fractional_interpolator_xx_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 1)) self.connect((self.fractional_interpolator_xx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.fractional_interpolator_xx_0, 0), (self.qtgui_time_sink_x_3_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.osmosdr_sink_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.samp_rate = samp_rate = 250e3 self.freq = freq = 88.1e6 self.audio_rate = audio_rate = 44100 self.audio_interp = audio_interp = 4 ################################################## # Blocks ################################################## _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label='freq', converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=88.0e6, maximum=107.9e6, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_sizer) 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_normalized_gain(0.5, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(samp_rate * 1.0), decimation=audio_rate * audio_interp, taps=None, fractional_bw=None, ) #self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/john/Downloads/documents-export-2015-09-15/Inspired But Too Tired Acoustic.wav", True) self.blocks_wavfile_source_0 = blocks.wavfile_source("John_Prine.wav", True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((25, )) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * audio_interp, tau=75e-6, max_dev=5e3, ) thread = threading.Thread(target=self.sweep, args=()) thread.daemon = True thread.start() ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_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.samp_rate_send = samp_rate_send = 250e3 self.samp_rate_rec = samp_rate_rec = 5000000 self.audio_rate = audio_rate = 44100 self.audio_interp = audio_interp = 4 self.Freq = Freq = 88.5e6 ################################################## # Blocks ################################################## _Freq_sizer = wx.BoxSizer(wx.VERTICAL) self._Freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_Freq_sizer, value=self.Freq, callback=self.set_Freq, label='Freq', converter=forms.float_converter(), proportion=0, ) self._Freq_slider = forms.slider( parent=self.GetWin(), sizer=_Freq_sizer, value=self.Freq, callback=self.set_Freq, minimum=80e6, maximum=115e6, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_Freq_sizer) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate_rec, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Waterfall Plot", ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=Freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate_rec / 25, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) 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_rec) self.uhd_usrp_source_0.set_center_freq(Freq, 0) self.uhd_usrp_source_0.set_gain(20, 0) self.uhd_usrp_source_0.set_antenna("RX2", 0) 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(samp_rate_send) self.uhd_usrp_sink_0.set_center_freq(Freq, 0) self.uhd_usrp_sink_0.set_normalized_gain(0.5, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(samp_rate_send * 1.0), decimation=audio_rate * audio_interp, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf(20, firdes.low_pass( 1, samp_rate_rec, 100e3, 10e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/john/Downloads/Inspired But Too Tired Acoustic.wav", True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((25, )) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * audio_interp, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.wxgui_waterfallsink2_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
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") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.volume = volume = 10 self.samp_rate = samp_rate = 48000 self.noise = noise = 1 ################################################## # Blocks ################################################## self._volume_range = Range(1, 100, 1, 10, 200) self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "counter_slider", float) self.top_grid_layout.addWidget(self._volume_win) self._noise_range = Range(0, 10, 1, 1, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, "noise", "counter_slider", float) self.top_grid_layout.addWidget(self._noise_win) self.wavsource = blocks.wavfile_source('C:\\Users\\sksha\\Desktop\\20190802132\\bciao.wav', True) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=100, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=100, decimation=1, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0/10) self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_0_win) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #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.channels_channel_model_0 = channels.channel_model( noise_voltage=noise, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=False ) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((volume, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, )) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_source_0 = audio.source(samp_rate, '', True) self.audio_sink_0 = audio.sink(samp_rate, '', True) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=5000, fh=-1.0, ) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=1, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.analog_wfm_tx_0_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.analog_wfm_tx_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.analog_wfm_tx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.wavsource, 0), (self.blocks_add_xx_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.samp_rate = samp_rate = 250e3 self.freq = freq = 88.5e6 self.enable = enable = 0 self.audio_rate = audio_rate = 44100 self.audio_interp = audio_interp = 4 ################################################## # Blocks ################################################## _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label='freq', converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=88.0e6, maximum=107.9e6, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_sizer) self._enable_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.enable, callback=self.set_enable, label='enable', choices=[0,1], labels=[], style=wx.RA_HORIZONTAL, ) self.Add(self._enable_chooser) 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(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_normalized_gain(0.5, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=int(samp_rate * 1.0), decimation=audio_rate * audio_interp, taps=None, fractional_bw=None, ) self.blocks_wavfile_source_1 = blocks.wavfile_source("/home/john/IRG/Music/John Prine - The Sins of Memphisto.wav", True) self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/john/IRG/Music/Inspired But Too Tired Acoustic.wav", True) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((25, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((25, )) self.blks2_selector_0 = grc_blks2.selector( item_size=gr.sizeof_gr_complex*1, num_inputs=2, num_outputs=1, input_index=enable, output_index=0, ) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * audio_interp, tau=75e-6, max_dev=5e3, ) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * audio_interp, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.blks2_selector_0, 1)) self.connect((self.analog_wfm_tx_0_0, 0), (self.blks2_selector_0, 0)) self.connect((self.blks2_selector_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_wfm_tx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0))