def test_002_checkwavcopy(self): infile = g_in_file outfile = "test_out.wav" wf_in = blocks.wavfile_source(infile) wf_out = blocks.wavfile_sink(outfile, wf_in.channels(), wf_in.sample_rate(), wf_in.bits_per_sample()) self.tb.connect(wf_in, wf_out) self.tb.run() wf_out.close() # we're loosing all extra header chunks self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile)) in_f = file(infile, 'rb') out_f = file(outfile, 'rb') in_data = in_f.read() out_data = out_f.read() out_f.close() os.remove(outfile) # cut extra header chunks input file self.assertEqual(in_data[:g_extra_header_offset] + \ in_data[g_extra_header_offset + g_extra_header_len:], out_data)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Wav To Raw Iq") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Blocks ################################################## self.test_wav = blocks.wavfile_source("original.wav", False) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=2000000, decimation=44100, taps=None, fractional_bw=None, ) self.blocks_streams_to_stream_0 = blocks.streams_to_stream(gr.sizeof_float*1, 2) self.blocks_float_to_char_0 = blocks.float_to_char(1, 127) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "sample.raw", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.test_wav, 1), (self.blocks_streams_to_stream_0, 1)) self.connect((self.blocks_streams_to_stream_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.test_wav, 0), (self.blocks_streams_to_stream_0, 0))
def __init__(self): gr.top_block.__init__(self, "P25 Wav Decode") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48000, decimation=8000, taps=None, fractional_bw=None, ) self.dsd_block_ff_0 = dsd.block_ff(dsd.dsd_FRAME_AUTO_DETECT,dsd.dsd_MOD_AUTO_SELECT,3,True,2) self.blocks_wavfile_source_0 = blocks.wavfile_source("p25_raw_unencrypted_edf.wav", True) self.audio_sink_0 = audio.sink(48000, "", True) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.dsd_block_ff_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
def __init__(self, inputFile, outputFile, samp_rate): gr.top_block.__init__(self, "Wavtobin") ################################################## # Variables ################################################## self.samp_rate = samp_rate self.chip_rate = chip_rate = 64e3 ################################################## # Blocks ################################################## self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(chip_rate/samp_rate, taps=None, flt_size=32) self.blocks_wavfile_source_0 = blocks.wavfile_source(inputFile, False) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, outputFile, False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_file_sink_0, 0))
def _setup_head(self): """ Sets up the input of the flow graph, i.e. determine which kind of file source is necessary. """ if self.filename[-4:].lower() == '.wav': if self.options.verbose: print 'Reading data from a WAV file.' src = blocks.wavfile_source(self.filename, True) f2c = blocks.float_to_complex() self.connect((src, 0), (f2c, 0)) if src.channels() == 2: self.connect((src, 1), (f2c, 1)) self.connect(f2c, self.head) else: if self.options.verbose: print 'Reading data from a raw data file.' src = blocks.file_source(self.options.sample_size, self.filename, True) if self.options.sample_size == gr.sizeof_float: f2c = blocks.float_to_complex() self.connect(src, f2c, self.head) if self.options.verbose: print ' Input data is considered real.' else: self.connect(src, self.head) if self.options.verbose: print ' Input data is considered complex.'
def __init__(self): gr.top_block.__init__(self, "SAME Decoder test") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 8000 ################################################## # Blocks ################################################## self.rational_resampler_44k = filter.rational_resampler_fff( interpolation=80, decimation=441, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=100, decimation=96, taps=None, fractional_bw=None, ) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcc(1, (firdes.low_pass(1, samp_rate, 600, 100)), 1822.916667, samp_rate) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=16, gain_mu=0.175, mu=0.5, omega_relative_limit=0.1, freq_error=0.0, verbose=True, log=False, ) #self.src = audio.source(samp_rate, "plughw:CARD=PCH,DEV=2", True) self.blocks_wavfile_source_0 = blocks.wavfile_source("eas-test-11-7-2013.wav", False) self.blocks_bitstream_sink = blocks.file_sink(1, "bitstream.bin") self.xlat_sink = blocks.wavfile_sink("xlat.wav", 1, 8333) self.xlat_complex_to_float = blocks.complex_to_float() self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(-50, 0.0001, 0) self.msg_queue = gr.msg_queue(10) self.same_dec_0 = same.same_dec(self.msg_queue) ################################################## # Connections ################################################## self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.xlat_complex_to_float, 0), (self.xlat_sink, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.same_dec_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_bitstream_sink, 0)) #self.connect((self.src, 0), (self.rational_resampler_44k, 0)) #self.connect((self.rational_resampler_44k, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_pwr_squelch_xx_0,0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self._watcher = _queue_watcher_thread(self.msg_queue)
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 = 48000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=4160, decimation=4800, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=9600, decimation=samp_rate, taps=None, fractional_bw=None, ) self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[1], False) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((255, )) self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, 2) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, 2) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, sys.argv[1]+".gray", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass( 1, samp_rate, 500, 4200, 2000, firdes.WIN_HAMMING, 6.76)) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_1, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0))
def __init__(self, source_path): gr.top_block.__init__(self, "Top Block") source_directory, source_filename = os.path.split(source_path) source_filename, source_extension = os.path.splitext(source_filename) target_signal, carrier_freq, sampling_rate, start_date, start_time, capture_device = source_filename.split('_') wav_file = (source_extension.upper() == ".WAV") if sampling_rate[-1].upper() == 'M': sampling_rate = float(sampling_rate[:-1]) * 1e6 else: raise RuntimeError('Unsupported sampling rate "%s"' % sampling_rate) start_timestamp = iso8601.datetime.strptime(start_date + ' ' + start_time, '%Y%m%d %H%M%Sz') utc = pytz.utc start_timestamp = utc.localize(start_timestamp) f_ts = open('timestamp.txt', 'w') f_ts.write(start_timestamp.isoformat()) f_ts.close() ################################################## # Variables ################################################## self.samp_rate = samp_rate = sampling_rate self.average_window = average_window = 1000 ################################################## # Blocks ################################################## if wav_file: self.blocks_wavfile_source_0 = blocks.wavfile_source(source_path, False) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) else: self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, source_path, False) self.burst_detector = burst_detector() self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink(gr.sizeof_gr_complex*1, samp_rate) ################################################## # Connections ################################################## if wav_file: self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.burst_detector, 0)) else: self.connect((self.blocks_file_source_0, 0), (self.burst_detector, 0)) self.connect((self.burst_detector, 0), (self.blocks_tagged_file_sink_0, 0))
def __init__(self,f_in,f_out): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.file_out = file_out = f_out self.file_in = file_in = f_in ################################################## # Blocks ################################################## self.sat_observer_noaa_analog_decoder_f_0 = sat_observer.noaa_analog_decoder_f(file_out, "ac", 15) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=441, decimation=192, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (40, ), 10.966e3, samp_rate) self.blocks_wavfile_source_0 = blocks.wavfile_source(file_in, False) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((6.5, )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate, audio_decimation=5, ) ################################################## # Connections ################################################## self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.sat_observer_noaa_analog_decoder_f_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (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_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
def __init__(self, in_filename, out_filename, fft_count): gr.top_block.__init__(self, "Fft Test") windowSize = 1024 print "FFT Count: ", fft_count self.wavfile_source = blocks.wavfile_source(in_filename, False) self.file_sink = blocks.file_sink(gr.sizeof_float, out_filename) ffts = [] for i in range(fft_count): ffts.append(FFT_IFFT(windowSize)) if i == 0: self.connect((self.wavfile_source, 0), (ffts[0], 0)) else: self.connect((ffts[i-1], 0), (ffts[i], 0)) self.connect((ffts[fft_count-1], 0), (self.file_sink, 0))
def __init__(self, src_file): gr.top_block.__init__(self) sample_rate = 11025 ampl = 0.1 print src_file # Audio source (.wav file) # TODO : Make the filename a VARIABLE # src_file = input("Enter .wav File PSK31 : ") src = blocks.wavfile_source(src_file, False) # Raw float data output file. # TODO : To make the raw file also a variable, for psk31decoder2.py to run dst = blocks.file_sink(1, "./output.raw") # Delay line. This delays the signal by 32ms dl = blocks.delay(gr.sizeof_float, int(round(sample_rate/31.25))) # Multiplier # Multiplying the source and the delayed version will give us # a negative output if there was a phase reversal and a positive output # if there was no phase reversal mul = blocks.multiply_ff(1) # Low Pass Filter. This leaves us with the envelope of the signal lpf_taps = filter.firdes.low_pass( 5.0, sample_rate, 15, 600, filter.firdes.WIN_HAMMING) lpf = filter.fir_filter_fff(1, lpf_taps) # Binary Slicer (comparator) slc = digital.binary_slicer_fb() # Connect the blocks. self.connect(src, dl) self.connect(src, (mul, 0)) self.connect(dl, (mul, 1)) self.connect(mul, lpf) self.connect(lpf, slc) self.connect(slc, dst)
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): gr.top_block.__init__(self, "TW-1 test decoder") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.samp_per_sym = samp_per_sym = 10 self.gain_mu = gain_mu = 0.175*3 ################################################## # Blocks ################################################## self.synctags_fixedlen_tagger_0 = synctags.fixedlen_tagger("syncword", "packet_len", 256*8, numpy.byte) self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 2400, 2000, firdes.WIN_HAMMING, 6.76)) self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x00, 16) self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb("10010011000010110101000111011110", 4, "syncword") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+0.0), 0.25*gain_mu*gain_mu, 0.5, gain_mu, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source("/tmp/tw-1c.wav", False) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_len") self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(gr.sizeof_char*1, "packet_len", 1/8.0) self.blocks_message_debug_1 = blocks.message_debug() self.ax100_gomx3_rs_decode_0 = ax100.gomx3_rs_decode(True) ################################################## # Connections ################################################## self.msg_connect((self.ax100_gomx3_rs_decode_0, 'out'), (self.blocks_message_debug_1, 'print_pdu')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'), (self.ax100_gomx3_rs_decode_0, 'in')) self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.blocks_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.synctags_fixedlen_tagger_0, 0)) self.connect((self.digital_descrambler_bb_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.synctags_fixedlen_tagger_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Play Wav File") _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 = 48000 ################################################## # Blocks ################################################## self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/pi/Media-Convert_test2_PCM_Mono_VBR_8SS_48000Hz.wav", False) (self.blocks_wavfile_source_0).set_max_output_buffer(1) self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/home/pi/output.wav", 1, samp_rate, 8) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_wavfile_sink_0, 0))
def __init__(self, src="uhd", dst=None, repeat=False, reader=True, tag=True, samp_rate=2e6, emulator=None): gr.hier_block2.__init__(self, "decoder", gr.io_signature(0, 0, 0), # Input signature gr.io_signature(0, 0, 0)) # Output signature if src == "uhd": self._src = usrp_src.usrp_src(samp_rate=samp_rate, dst=dst) hi_val = 1.1 else: self._wav = blocks.wavfile_source(src, repeat) self._r2c = blocks.float_to_complex(1) self._src = blocks.complex_to_mag_squared(1) self.connect(self._wav, self._r2c, self._src) hi_val = 1.09 # may need to be set to 1.05 depending on antenna setup self._back = background.background(reader, tag, emulator) self._trans = transition_sink.transition_sink(samp_rate, self._back.append, hi_val=hi_val) self._connect(self._src, self._trans) if dst and dst != "uhd" and src == "uhd": self._rec = record.record(dst, samp_rate) self._connect(self._src, self._rec)
def __init__(self): gr.top_block.__init__(self) parser = OptionParser(option_class=eng_option) parser.add_option("-I", "--input", type="string", default="", help="pcm input device name. E.g., hw:0,0 or /dev/dsp") parser.add_option("-O", "--audio-output", type="string", default="", help="pcm output device name") parser.add_option("-r", "--sample-rate", type="eng_float", default=192000, help="set sample rate to RATE (192000)") parser.add_option("-f", "--frequency", type="eng_float", default=45000) parser.add_option("-a", "--amplitude", type="eng_float", default=0.5) (options, args) = parser.parse_args () if len(args) != 0: parser.print_help() raise SystemExit, 1 sample_rate = int(options.sample_rate) ampl = float(options.amplitude) if ampl > 1.0: ampl = 1.0 to_real = blocks.complex_to_real() to_imag = blocks.complex_to_imag() #src = audio.source (sample_rate, options.audio_input) src = blocks.wavfile_source (options.input) firdes_taps = filter.firdes.low_pass_2(1, 1, 0.2, 0.1, 60) converter = filter.freq_xlating_fir_filter_fcf ( 1, firdes_taps, 0, sample_rate ) converter.set_center_freq(0 - options.frequency) dst = audio.sink (sample_rate, options.audio_output, True) #self.connect(src, converter, to_real, dst) self.connect(src, converter) self.connect(converter, to_real, (dst,0)) self.connect(converter, to_imag, (dst,1))
def __init__(self, filename): gr.top_block.__init__(self, "Spritedemodnogui") ################################################## # Variables ################################################## self.chip_rate = chip_rate = 64e3 ################################################## # Blocks ################################################## self.sprite_sprite_decoder_f_0 = sprite.sprite_decoder_f() self.sprite_peak_decimator_ff_0 = sprite.peak_decimator_ff() self.sprite_correlator_cf_1 = sprite.correlator_cf(2) self.sprite_correlator_cf_0 = sprite.correlator_cf(3) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( .256, taps=None, flt_size=32) self.blocks_wavfile_source_0 = blocks.wavfile_source(filename, False) self.blocks_sub_xx_0 = blocks.sub_ff(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) ################################################## # Connections ################################################## self.connect((self.blocks_sub_xx_0, 0), (self.sprite_peak_decimator_ff_0, 0)) self.connect((self.sprite_correlator_cf_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.sprite_correlator_cf_1, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.sprite_correlator_cf_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.sprite_correlator_cf_1, 0)) self.connect((self.sprite_peak_decimator_ff_0, 0), (self.sprite_sprite_decoder_f_0, 0))
def test_002_checkwavcopy(self): infile = g_in_file outfile = "test_out.wav" wf_in = blocks.wavfile_source(infile) wf_out = blocks.wavfile_sink(outfile, wf_in.channels(), wf_in.sample_rate(), wf_in.bits_per_sample()) self.tb.connect(wf_in, wf_out) self.tb.run() wf_out.close() self.assertEqual(getsize(infile), getsize(outfile)) in_f = file(infile, 'rb') out_f = file(outfile, 'rb') in_data = in_f.read() out_data = out_f.read() out_f.close() os.remove(outfile) self.assertEqual(in_data, out_data)
def __init__(self,DRMParameters): gr.top_block.__init__(self, "DRM Transmitter 1") ################################################## # Variables ################################################## self.text_message = text_message = DRMParameters.text_msg self.station_label = station_label = DRMParameters.station_label self.msc_prot_level_2 = msc_prot_level_2 = 1 self.long_interl = long_interl = True self.audio_sample_rate = audio_sample_rate = DRMParameters.audio_samp*1000 self.SO = SO = DRMParameters.so self.RM = RM = DRMParameters.rm self.tp = tp = drm.transm_params(RM, SO, False, 0, DRMParameters.msc_mod, 0, msc_prot_level_2, DRMParameters.sdc_mod, 0, long_interl, audio_sample_rate, station_label, text_message) self.samp_rate = samp_rate = 48e3 self.usrp_addr = DRMParameters.usrp_id self.output_name = DRMParameters.output_name self.center_freq = DRMParameters.center_freq*1e6 self.audio_file = DRMParameters.audio_file ################################################## # Blocks ################################################## if DRMParameters.uhd_found: self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join((self.usrp_addr, "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate * 250 / 48) self.uhd_usrp_sink_0.set_center_freq(self.center_freq, 0) self.uhd_usrp_sink_0.set_gain(0, 0) self.uhd_usrp_sink_0.set_antenna("TXA", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=250, decimation=48, taps=None, fractional_bw=None, ) self.fft_vxx_0 = fft.fft_vcc(tp.ofdm().nfft(), False, (), True, 1) self.drm_scrambler_bb_0_1 = drm.scrambler_bb(tp.sdc().L()) self.drm_scrambler_bb_0_0 = drm.scrambler_bb(tp.fac().L()) self.drm_scrambler_bb_0 = drm.scrambler_bb(tp.msc().L_MUX()) self.drm_mlc_fac_bc = drm.make_mlc( channel_type="FAC", tp=tp ) #SDC Configuration self.drm_mlc_sdc_bc= drm.make_mlc( channel_type="SDC", tp=tp ) #MSC Configuration self.drm_mlc_msc_bc = drm.make_mlc( channel_type="MSC", tp=tp ) self.drm_interleaver_cc_0 = drm.interleaver_cc((tp.msc().cell_interl_seq()), long_interl, drm.INTL_DEPTH_DRM) self.drm_generate_sdc_b_0 = drm.generate_sdc_b(tp) self.drm_generate_fac_b_0 = drm.generate_fac_b(tp) self.drm_audio_encoder_sb_0 = drm.audio_encoder_sb(tp) self.digital_ofdm_cyclic_prefixer_1 = digital.ofdm_cyclic_prefixer(tp.ofdm().nfft(), tp.ofdm().nfft()+tp.ofdm().nfft()*tp.ofdm().cp_ratio_enum()/tp.ofdm().cp_ratio_denom(), 0, "") self.cell_mapping_cc_0 = drm.cell_mapping_cc(tp, (tp.msc().N_MUX() * tp.ofdm().M_TF() * 8, tp.sdc().N() * 8, tp.fac().N() * tp.ofdm().M_TF() * 8)) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) if DRMParameters.pulse_audio: self.audio_source_1 = audio.source(audio_sample_rate, "", True) else: self.blocks_wavfile_source_0 = blocks.wavfile_source(self.audio_file, False) if DRMParameters.gen_output: self.blocks_wavfile_sink_0 = blocks.wavfile_sink(self.output_name, 1, 48000, 16) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((7e-3, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((32768, )) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 7000, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) if DRMParameters.gen_output: self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.drm_audio_encoder_sb_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_0, 0)) if DRMParameters.pulse_audio: self.connect((self.audio_source_1, 0), (self.blocks_multiply_const_vxx_0, 0)) else: self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.cell_mapping_cc_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_1, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.drm_audio_encoder_sb_0, 0), (self.drm_scrambler_bb_0, 0)) self.connect((self.drm_generate_fac_b_0, 0), (self.drm_scrambler_bb_0_0, 0)) self.connect((self.drm_generate_sdc_b_0, 0), (self.drm_scrambler_bb_0_1, 0)) self.connect((self.drm_interleaver_cc_0, 0), (self.cell_mapping_cc_0, 0)) self.connect((self.drm_mlc_msc_bc, 0), (self.drm_interleaver_cc_0, 0)) self.connect((self.drm_mlc_sdc_bc, 0), (self.cell_mapping_cc_0, 1)) self.connect((self.drm_mlc_fac_bc, 0), (self.cell_mapping_cc_0, 2)) self.connect((self.drm_scrambler_bb_0, 0), (self.drm_mlc_msc_bc, 0)) self.connect((self.drm_scrambler_bb_0_0, 0), (self.drm_mlc_fac_bc, 0)) self.connect((self.drm_scrambler_bb_0_1, 0), (self.drm_mlc_sdc_bc, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_1, 0)) if DRMParameters.uhd_found: self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_null_sink_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 ################################################## # Blocks ################################################## 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_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.blackmanharris(1024)), True, 1) self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/iocoder/school/networks/project/radio_waves/src/radio_waves.wav", True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 1024) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) ################################################## # Connections ################################################## self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_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 = 96000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label("Amplitude", "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( samp_rate, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-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(False) self.qtgui_time_sink_x_0.enable_control_panel(True) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) self.epy_block_0 = blk(SampleDelay=1000) self.blocks_wavfile_source_0 = blocks.wavfile_source( "/home/radtke/Schreibtisch/WebSDRDateien/websdr_11_07_17_11.wav", False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_threshold_ff_0 = blocks.threshold_ff(0.003, 0.006, 0) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_threshold_ff_0, 0), (self.epy_block_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.epy_block_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
def __init__(self): gr.top_block.__init__(self, "Sampling Demo") Qt.QWidget.__init__(self) self.setWindowTitle("Sampling Demo") 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", "sampling_demo") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.N = N = 1 ################################################## # Blocks ################################################## self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 44e3 / N, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "float" == "float" or "float" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 5000, #size 44e3 / N, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.05) 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(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 44e3 / N, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.05) 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 "float" == "float" or "float" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in 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.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/marc/498x/44k.wav', False) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_float * 1, N) self.audio_sink_0 = audio.sink(44000 / N, '', True) ################################################## # Connections ################################################## self.connect((self.blocks_keep_one_in_n_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_keep_one_in_n_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", "pilas") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 11025 self.N = N = 1024 self.Fmax = Fmax = samp_rate/2 self.PSDmax = PSDmax = 6e-2 self.Fresolucion = Fresolucion = 2*Fmax/N self.Ensayos = Ensayos = 1000000 ################################################## # Blocks ################################################## self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f( N, -samp_rate/2, (samp_rate-1)/N, "Frecuencia", "Amplitud (Watt/Hz)", 'PSD', 1 # Number of inputs ) self.qtgui_vector_sink_f_0.set_update_time(0.10) self.qtgui_vector_sink_f_0.set_y_axis(0., PSDmax) self.qtgui_vector_sink_f_0.enable_autoscale(False) self.qtgui_vector_sink_f_0.enable_grid(False) self.qtgui_vector_sink_f_0.set_x_axis_units("Hz") self.qtgui_vector_sink_f_0.set_y_axis_units("Watt/Hz") self.qtgui_vector_sink_f_0.set_ref_level(0) labels = ['.', '', '', '', '', '', '', '', '', ''] widths = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #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(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( N, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "Espetro dinamico", #name 1 ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_1 = fft.fft_vcc(N, True, window.rectangular(N), True, 1) self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/hortegab/MisGits/comdig_multimedia/bush-clinton_debate_waffle.wav', True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, N) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(numpy.full(N,1./samp_rate)) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(N) self.analog_const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0) self.E3TRadio_vector_average_hob_0 = E3TRadio.vector_average_hob(N, Ensayos) ################################################## # Connections ################################################## self.connect((self.E3TRadio_vector_average_hob_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.analog_const_source_x_0_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.E3TRadio_vector_average_hob_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.qtgui_vector_sink_f_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_1, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.fft_vxx_1, 0), (self.blocks_complex_to_mag_squared_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, "HLG Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("HLG Receiver") 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", "cw_rx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1.024e6 self.low_cut = low_cut = 500 self.hi_cut = hi_cut = 1100 self.freq = freq = 8.5427e6 self.cfreq = cfreq = 8.5764e6 ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, 'Narrow Band RF Spectrum/Spectrogram') self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, 'AF Processing') self.tab_widget_2 = Qt.QWidget() self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2) self.tab_grid_layout_2 = Qt.QGridLayout() self.tab_layout_2.addLayout(self.tab_grid_layout_2) self.tab.addTab(self.tab_widget_2, 'Time Domain Scope') self.top_grid_layout.addWidget(self.tab, 0,0,1,1) self._low_cut_range = Range(0, 700, 10, 500, 200) self._low_cut_win = RangeWidget(self._low_cut_range, self.set_low_cut, 'Low Cut (Hz)', "counter_slider", float) self.tab_grid_layout_1.addWidget(self._low_cut_win, 1,0,1,1) self._hi_cut_range = Range(900, 2000, 10, 1100, 200) self._hi_cut_win = RangeWidget(self._hi_cut_range, self.set_hi_cut, 'Hi Cut (Hz)', "counter_slider", float) self.tab_grid_layout_1.addWidget(self._hi_cut_win, 2,0,1,1) self._freq_range = Range(cfreq - samp_rate/2, cfreq + samp_rate/2, 1e2, 8.5427e6, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'VFO (Hz)', "counter_slider", float) self.top_layout.addWidget(self._freq_win) self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=24, decimation=48, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=48, decimation=1024, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc 48e3, #bw '', #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-150, -90) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1,0,1,1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 8192*4, #size 48e3, #samp_rate "", #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(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win, 0,0,1,1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 24e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-160, -50) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(False) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1.disable_legend() if "float" == "float" or "float" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0,0,1,1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc 48e3, #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(-150, -40) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: 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.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,1,1) self.fft_filter_xxx_1 = filter.fft_filter_ccc(1, (firdes.complex_band_pass(50,48e3,low_cut,hi_cut,5e2,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_1.declare_sample_delay(0) self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/handiko/HDSDR_20140419_185856Z_8500kHz_RF.wav', False) self.blocks_wavfile_sink_0 = blocks.wavfile_sink('HLG.wav', 1, 48000, 16) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 48e3,True) self.blocks_rotator_cc_0 = blocks.rotator_cc(-((freq-cfreq)/samp_rate)*math.pi) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.audio_sink_0 = audio.sink(48000, '', True) self.analog_agc_xx_0 = analog.agc_ff(1e-2, 0.1, 1.0) self.analog_agc_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.analog_agc_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.rational_resampler_xxx_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_waterfall_sink_x_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.fft_filter_xxx_1, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.fft_filter_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.qtgui_freq_sink_x_1, 0))
def __init__(self): gr.top_block.__init__(self, "Merapi Test") Qt.QWidget.__init__(self) self.setWindowTitle("Merapi Test") 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", "merapi_test") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=10, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 1024, #size samp_rate / 100, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.01) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #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(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fft_filter_xxx_2 = filter.fft_filter_fff(1, (firdes.band_pass( 1, samp_rate, 1360 - 300, 1360 + 300, 500, firdes.WIN_HAMMING)), 1) self.fft_filter_xxx_2.declare_sample_delay(0) self.fft_filter_xxx_0 = filter.fft_filter_fff(10, (firdes.low_pass( 1, samp_rate / 10, 20, 20, firdes.WIN_HAMMING)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/handiko/cv.wav', True) self.blocks_rotator_cc_0 = blocks.rotator_cc( (-1360.0 / samp_rate) * 2 * math.pi) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.audio_sink_0 = audio.sink(samp_rate, '', True) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf( 0.1 * samp_rate / (2 * math.pi * 500 / 8.0)) self.analog_agc_xx_0 = analog.agc_ff(1e-2, 0.1, 0.1) self.analog_agc_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.fft_filter_xxx_2, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.fft_filter_xxx_2, 0), (self.analog_agc_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0))
print "Running %s, t0=%d" % (path, t0) bitrate = 3600 # Bits per second tb = gr.top_block() if True or path.endswith(".raw"): file_source = blocks.file_source(gr.sizeof_char, path, False) ctf = blocks.uchar_to_float() offset_block = blocks.add_const_ff(-127.0) clean_file_source = blocks.multiply_const_ff(1.0 / 127.0) tb.connect(file_source, ctf, offset_block, clean_file_source) elif path.endswith("wav"): clean_file_source = blocks.wavfile_source(path, False) def print_pkt(pkt): #print "pkt: " + str(s) unhandled = decoder.handle_packet(pkt) # if unhandled: # print "UNH: '%s' %x %s %x" % (unhandled, pkt["cmd"], "G" if pkt["group"] else "I", pkt["idno"]) pass def print_skipped(n): # print " skip: %d" % n decoder.handle_skip(n)
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.samp_rate = samp_rate = 44000 ################################################## # Blocks ################################################## self.s1_thekiggys_com_0 = s1_thekiggys_com() self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #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(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/god/workspace/sdr-work/recordings/audio/6_5_2.wav', True) self.audio_sink_0 = audio.sink(samp_rate, '', True) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.s1_thekiggys_com_0, 0)) self.connect((self.s1_thekiggys_com_0, 0), (self.qtgui_time_sink_x_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") 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 amGen(self, type, noiseLevel): ################################################## # Variables ################################################## self.add = add = 0 # set to 1 if not suppressing carrier if type == "DSBFC": add = 1 self.samp_rate = samp_rate = 300000 ################################################## # Blocks ################################################## self.sink = blocks.vector_sink_c(1) self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[3], True) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((add, )) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 100000, 1, 0) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate) #, True) 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 ) self.band_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.band_pass(1, samp_rate, 100000, 150000, 10000, firdes.WIN_KAISER, 6.76)) # used only for SSB ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) if type == "SSB": self.connect((self.blocks_multiply_xx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_throttle_0, 0)) else: self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channel, 0)) self.connect((self.channel, 0), (self.sink, 0)) return self.sink
def __init__(self): gr.top_block.__init__(self, "Hd Tx Hackrf", catch_exceptions=True) ################################################## # 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=[], 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.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, 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 = 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, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) 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, "Am Dsb") Qt.QWidget.__init__(self) self.setWindowTitle("Am Dsb") 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", "am_dsb") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 50e3 self.bw = bw = 5e3 ################################################## # Blocks ################################################## self._bw_range = Range(5e3, 25e3, 1e3, 5e3, 200) self._bw_win = RangeWidget(self._bw_range, self.set_bw, 'Bandwidth', "counter_slider", float) self.top_grid_layout.addWidget(self._bw_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.01) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 3, 1, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.01) 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(0.1) 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 = ['Audio', 'AM DSB', '', '', '', '', '', '', '', ''] 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(2): 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, 3, 0, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.fir_filter_xxx_0 = filter.fir_filter_fcc( 1, (firdes.low_pass_2(1, samp_rate, bw, 1e3, 50))) self.fir_filter_xxx_0.declare_sample_delay(0) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/prabhat/Downloads/Untitled folder/PIERS project/fm tx rx/Charlie Puth - Attention Official Video (1).wav', True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, )) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.fir_filter_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Am Ma3 Hackrf", catch_exceptions=True) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 1710e3 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=4096, 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.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 + 100000, 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(1, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(1.5e6, 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, 3750) self.nrsc5_l1_am_encoder_ma3_0 = nrsc5.l1_am_encoder(3) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(1, 17900) self.fft_vxx_0 = fft.fft_vcc(256, False, window.rectangular(256), True, 1) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample_mono.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 256) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 14) for i in range(14)] + [1] * (256 - 14) + [math.cos(math.pi / 2 * i / 14) for i in range(14)], True, 1, []) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2 * math.pi * 100000 / samp_rate) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 256, 2) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char * 30000) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.1) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 270, 512, 121) ################################################## # Connections ################################################## 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_rotator_cc_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_null_source_0, 0), (self.nrsc5_l1_am_encoder_ma3_0, 1)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.osmosdr_sink_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.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_am_encoder_ma3_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_am_encoder_ma3_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_am_encoder_ma3_0, 2)) 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="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, "Read/Write Tests for real-valued signals") Qt.QWidget.__init__(self) self.setWindowTitle("Read/Write Tests for real-valued signals") 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", "read_writeTests_real_gr38_001") 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.Fs3 = Fs3 = 22050 self.Fs23 = Fs23 = 44100 self.Fs22 = Fs22 = 48000 self.Fs2 = Fs2 = 32000 ################################################## # Blocks ################################################## self.qtgui_sink_x_0_1_0_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc Fs23, #bw "y23t", #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_0_1_0_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_1_0_0_win = sip.wrapinstance( self.qtgui_sink_x_0_1_0_0.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_0_1_0_0.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_0_0_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_sink_x_0_1 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc Fs22, #bw "y22t", #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_0_1.set_update_time(1.0 / 10) self._qtgui_sink_x_0_1_win = sip.wrapinstance( self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_0_1.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_sink_x_0_0 = qtgui.sink_f( 4096, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc Fs3, #bw "y3t", #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.qtgui_sink_x_0_0.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_0_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_sink_x_0 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc Fs2, #bw "y2t", #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_0.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sig_x3t_PAMint16_Fs22050.wav', True) self.blocks_throttle_0_0_0_0_0 = blocks.throttle( gr.sizeof_float * 1, Fs23, True) self.blocks_throttle_0_0_0 = blocks.throttle(gr.sizeof_float * 1, Fs22, True) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float * 1, Fs3, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, Fs2, True) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_float * 1, 'sig_x2t_float32_Fs32000.bin', True, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.analog_sig_source_x_0_0_0 = analog.sig_source_f( Fs23, analog.GR_SAW_WAVE, 100, 1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_f( Fs22, analog.GR_SIN_WAVE, 1000, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0_0_0, 0)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_throttle_0_0_0_0_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.blocks_throttle_0_0_0, 0), (self.qtgui_sink_x_0_1, 0)) self.connect((self.blocks_throttle_0_0_0_0_0, 0), (self.qtgui_sink_x_0_1_0_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "USB TX") ################################################## # Variables ################################################## self.low = low = 300 self.filter_width = filter_width = 2.7e3 self.file_name = file_name = "ft8_qso.conf" self._wav_samp_rate_config = ConfigParser.ConfigParser() self._wav_samp_rate_config.read(file_name) try: wav_samp_rate = self._wav_samp_rate_config.getfloat('tx', 'wav_samp_rate') except: wav_samp_rate = 12e3 self.wav_samp_rate = wav_samp_rate self._wav_file_config = ConfigParser.ConfigParser() self._wav_file_config.read(file_name) try: wav_file = self._wav_file_config.get('tx', 'tx_wav_file') except: wav_file = './ft8_cq.wav' self.wav_file = wav_file self._tx_sdr_ppm_config = ConfigParser.ConfigParser() self._tx_sdr_ppm_config.read(file_name) try: tx_sdr_ppm = self._tx_sdr_ppm_config.getfloat('tx', 'tx_sdr_ppm') except: tx_sdr_ppm = 0 self.tx_sdr_ppm = tx_sdr_ppm self._tx_freq_config = ConfigParser.ConfigParser() self._tx_freq_config.read(file_name) try: tx_freq = self._tx_freq_config.getfloat('tx', 'tx_freq') except: tx_freq = 144.174e6 self.tx_freq = tx_freq self._tx_dev_string_config = ConfigParser.ConfigParser() self._tx_dev_string_config.read(file_name) try: tx_dev_string = self._tx_dev_string_config.get('tx', 'tx_device_string') except: tx_dev_string = 'hackrf=0' self.tx_dev_string = tx_dev_string self._rf_samp_rate_config = ConfigParser.ConfigParser() self._rf_samp_rate_config.read(file_name) try: rf_samp_rate = self._rf_samp_rate_config.getfloat('tx', 'rf_samp_rate') except: rf_samp_rate = 2e6 self.rf_samp_rate = rf_samp_rate self._rf_gain_config = ConfigParser.ConfigParser() self._rf_gain_config.read(file_name) try: rf_gain = self._rf_gain_config.getfloat('tx', 'tx_rf_gain') except: rf_gain = 60 print("RF Gain: " + str(rf_gain)) self.rf_gain = rf_gain self._offset_config = ConfigParser.ConfigParser() self._offset_config.read(file_name) try: offset = self._offset_config.getfloat('tx', 'offset') except: offset = 5e3 self.offset = offset self._if_samp_rate_config = ConfigParser.ConfigParser() self._if_samp_rate_config.read(file_name) try: if_samp_rate = self._if_samp_rate_config.getfloat('tx', 'if_samp_rate') except: if_samp_rate = 48e3 self.if_samp_rate = if_samp_rate self._if_gain_config = ConfigParser.ConfigParser() self._if_gain_config.read(file_name) try: if_gain = self._if_gain_config.getfloat('tx', 'tx_if_gain') except: if_gain = 20 self.if_gain = if_gain self.high = high = low+filter_width self._carrier_level_config = ConfigParser.ConfigParser() self._carrier_level_config.read(file_name) try: carrier_level = self._carrier_level_config.getfloat('tx', 'carrier_level') except: carrier_level = 1 self.carrier_level = carrier_level self._bb_gain_config = ConfigParser.ConfigParser() self._bb_gain_config.read(file_name) try: bb_gain = self._bb_gain_config.getfloat('tx', 'tx_bb_gain') except: bb_gain = 20 self.bb_gain = bb_gain self._audio_gain_config = ConfigParser.ConfigParser() self._audio_gain_config.read(file_name) try: audio_gain = self._audio_gain_config.getfloat('tx', 'audio_gain') except: audio_gain = 600e-3 self.audio_gain = audio_gain ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=int(rf_samp_rate), decimation=int(if_samp_rate), taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=int(if_samp_rate), decimation=int(wav_samp_rate), taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + tx_dev_string ) self.osmosdr_sink_0.set_sample_rate(rf_samp_rate) self.osmosdr_sink_0.set_center_freq(tx_freq-offset, 0) self.osmosdr_sink_0.set_freq_corr(tx_sdr_ppm, 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(bb_gain, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.blocks_wavfile_source_0 = blocks.wavfile_source(wav_file, False) self.band_pass_filter_af = filter.fir_filter_fff(1, firdes.band_pass( 1, wav_samp_rate, 300, 2700, 150, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_gain, )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.band_pass_filter_0 = filter.interp_fir_filter_ccc(1, firdes.complex_band_pass( 1, if_samp_rate, low, high, 100, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0_0 = analog.sig_source_c(if_samp_rate, analog.GR_COS_WAVE, offset, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(if_samp_rate, analog.GR_SIN_WAVE, 0, carrier_level, 0) self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0_0, 0)) 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.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.band_pass_filter_af, 0)) self.connect((self.band_pass_filter_af, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.osmosdr_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 ################################################## # 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_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec()) 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.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_1 = blocks.multiply_const_cc(0.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_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, 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_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.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.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), (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 __init__(self): gr.top_block.__init__(self, "Aprs Regenerate") Qt.QWidget.__init__(self) self.setWindowTitle("Aprs Regenerate") 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", "aprs_regenerate") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48e3 ################################################## # Blocks ################################################## self.show_text_0 = display.show_text() self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._show_text_0_win) self.satellites_nrzi_encode_0 = satellites.nrzi_encode() self.satellites_nrzi_decode_0 = satellites.nrzi_decode() self.satellites_hdlc_framer_0 = satellites.hdlc_framer(preamble_bytes=80, postamble_bytes=4) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate/40, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-4.5, 4.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: 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 = [2, 0, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, 0, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fsk_demod_0 = fsk_demod( baud=1200, fsk_hi_tone=2200, fsk_lo_tone=1200, in_sps=40, out_sps=2, ) self.epy_block_0 = epy_block_0.blk() self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((1200,2200), 1) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source('/home/handiko/aprs_regenerate.wav', True) self.blocks_vco_f_0 = blocks.vco_f(48000, 2*math.pi, 0.1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '', '52001', 10000, False) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, 40) self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'packet_len') self.audio_sink_0 = audio.sink(48000, '', True) self.afsk_afsk1200_0 = afsk.afsk1200(48000,4) ################################################## # Connections ################################################## self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.epy_block_0, 'in')) self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'), (self.satellites_hdlc_framer_0, 'in')) self.msg_connect((self.epy_block_0, 'out'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.satellites_hdlc_framer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.afsk_afsk1200_0, 0), (self.show_text_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.satellites_nrzi_encode_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.fsk_demod_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.afsk_afsk1200_0, 0)) self.connect((self.blocks_vco_f_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.satellites_nrzi_decode_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_vco_f_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.fsk_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.satellites_nrzi_decode_0, 0), (self.digital_hdlc_deframer_bp_0, 0)) self.connect((self.satellites_nrzi_encode_0, 0), (self.blocks_repeat_0, 0))
def __init__(self): gr.top_block.__init__(self, "Proyectofinal") Qt.QWidget.__init__(self) self.setWindowTitle("Proyectofinal") 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", "proyectoFinal") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.rango_l = rango_l = 12000 self.range_h = range_h = 1 ################################################## # Blocks ################################################## self._rango_l_range = Range(0, 24000, 100, 12000, 200) self._rango_l_win = RangeWidget(self._rango_l_range, self.set_rango_l, "rango_low", "counter_slider", float) self.top_layout.addWidget(self._rango_l_win) self._range_h_range = Range(1, 24000, 100, 1, 200) self._range_h_win = RangeWidget(self._range_h_range, self.set_range_h, "range_h", "counter_slider", float) self.top_layout.addWidget(self._range_h_win) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(False) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "float" == "float" or "float" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not 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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance( self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 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_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(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "float" == "float" or "float" == "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.low_pass_filter_0 = filter.fir_filter_fff( 1, firdes.low_pass(1, samp_rate, rango_l, 100, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, range_h, 100, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_0 = blocks.wavfile_source( "/usr/share/sounds/alsa/Front_Center.wav", True) self.audio_sink_0 = audio.sink(samp_rate, "", True) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.high_pass_filter_0, 0), (self.audio_sink_0, 0)) self.connect((self.high_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.high_pass_filter_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Audio Transmitter") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.variable_slider_0 = variable_slider_0 = 80e6 self.samp_rate = samp_rate = 44100 ################################################## # Blocks ################################################## _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, label="freq_slider", converter=forms.float_converter(), proportion=0, ) self._variable_slider_0_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, minimum=80e6, maximum=150e6, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_variable_slider_0_sizer) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=variable_slider_0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=195312, 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_sink_0 = uhd.usrp_sink( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(195312) self.uhd_usrp_sink_0.set_center_freq(variable_slider_0, 0) self.uhd_usrp_sink_0.set_gain(20, 0) self.uhd_usrp_sink_0.set_antenna("J2", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=195312, decimation=264600, taps=None, fractional_bw=None, ) self.blocks_wavfile_source_0 = blocks.wavfile_source( "/home/ece775/Desktop/wireless_project/Theme - Friends.wav", True) self.audio_sink_0 = audio.sink(44100, "", True) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=44100, quad_rate=264600, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_tx_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.audio_sink_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_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") 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.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1 = qtgui.time_sink_f( 512, #size samp_rate, #samp_rate "Mozart", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, True) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1.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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 512, #size samp_rate, #samp_rate "Frequency Modulated Mozart", #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(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: 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_layout.addWidget(self._qtgui_time_sink_x_0_win) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/steven/Downloads/onclassical_demo_demicheli_geminiani_pieces_allegro-in-f-major_small-version.wav', True) self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(1) ################################################## # Connections ################################################## self.connect((self.analog_frequency_modulator_fc_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_frequency_modulator_fc_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.qtgui_time_sink_x_1, 0))
def __init__(self): gr.top_block.__init__(self, "Fhss Rx") ################################################## # Variables ################################################## self.samp_sym = samp_sym = 12000 * 3 self.transistion = transistion = 50 self.tone_freq = tone_freq = 0 self.sideband_rx = sideband_rx = 6000 self.sideband = sideband = 6000 self.samp_rate = samp_rate = 12000 self.interpolation = interpolation = 4 self.init = init = 1, 1, 1, 1 self.generator = generator = 1, 1, 0, 0, 1 self.code_rate = code_rate = int(samp_sym * 1) self.carrier = carrier = 10000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=1, decimation=interpolation, taps=None, fractional_bw=None, ) self.freq_xlating_fir_filter_xxx_0_0_0 = filter.freq_xlating_fir_filter_ccc( 1, (filter.firdes.low_pass(1, samp_rate * 4, carrier + sideband_rx, 1000)), carrier, samp_rate * 4) script, inputwav, outputBinary = argv self.blocks_wavfile_source_0_1 = blocks.wavfile_source(inputwav, False) self.blocks_throttle_1_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char * 1, outputBinary, False) self.blocks_file_sink_0_0.set_unbuffered(False) self.Spread_rx_synthesizer_0_0 = Spread.rx_synthesizer( code_rate, samp_sym, samp_rate, 12000 / 2, 50000, 0.16, (generator), (init)) self.Spread_cpfsk_demod_0_0 = Spread.cpfsk_demod(samp_sym) ################################################## # Connections ################################################## self.connect((self.Spread_cpfsk_demod_0_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.Spread_rx_synthesizer_0_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.blocks_float_to_complex_0_0, 0), (self.freq_xlating_fir_filter_xxx_0_0_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.Spread_cpfsk_demod_0_0, 0)) self.connect((self.blocks_throttle_1_0, 0), (self.Spread_rx_synthesizer_0_0, 0)) self.connect((self.blocks_wavfile_source_0_1, 0), (self.blocks_float_to_complex_0_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.blocks_throttle_1_0, 0))
def __init__(self, fft_size, samp_rate, middle_freq, gain, bandwidth, sourceType = 0, filename = ""): gr.top_block.__init__(self, "Top Block") #### Variables #### self.fft_size = fft_size self.samp_rate = samp_rate self.middle_freq = middle_freq self.gain = gain self.bandwidth = bandwidth #### Blocks #### if sourceType == 0: #rtl2832 radio source self.rtl2832_source = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtl2832_source.set_clock_source("gpsdo", 0) self.rtl2832_source.set_sample_rate(samp_rate) self.rtl2832_source.set_center_freq(middle_freq, 0) self.rtl2832_source.set_freq_corr(0, 0) self.rtl2832_source.set_dc_offset_mode(0, 0) self.rtl2832_source.set_iq_balance_mode(0, 0) self.rtl2832_source.set_gain_mode(False, 0) self.rtl2832_source.set_gain(gain, 0) self.rtl2832_source.set_if_gain(20, 0) self.rtl2832_source.set_bb_gain(20, 0) self.rtl2832_source.set_antenna("", 0) self.rtl2832_source.set_bandwidth(bandwidth, 0) elif sourceType == 1 and filename: #wave file source self.blocks_wavfile_source_0 = blocks.wavfile_source(filename, False) self.samp_rate = self.blocks_wavfile_source_0.sample_rate print "Sample rate set to ", samp_rate self.block_wav_float_to_complex = blocks.float_to_complex(1) self.block_throttle_real = blocks.throttle(gr.sizeof_float*1, samp_rate,True) #throttles reading from the wav file to simulate real time radio self.block_throttle_im = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( sample_rate=samp_rate, fft_size=fft_size, ref_scale=2, frame_rate=20, avg_alpha=1.0, average=False, ) self.msgq_out = blocks_message_sink_0_msgq_out = gr.msg_queue(2) self.blocks_message_sink_0 = blocks.message_sink(gr.sizeof_float*fft_size, blocks_message_sink_0_msgq_out, False) #### Connections #### if sourceType == 0: self.connect((self.rtl2832_source, 0), (self.logpwrfft_x_0, 0)) elif sourceType == 1: self.connect((self.blocks_wavfile_source_0, 1), (self.block_throttle_im, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.block_throttle_real, 0)) self.connect((self.block_throttle_real, 0), (self.block_wav_float_to_complex, 0)) self.connect((self.block_throttle_im, 0), (self.block_wav_float_to_complex, 1)) self.connect((self.block_wav_float_to_complex, 0), (self.logpwrfft_x_0, 0)) self.connect((self.logpwrfft_x_0, 0), (self.blocks_message_sink_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.audio_rate = audio_rate = 16000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size audio_rate, #samp_rate "", #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(False) 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc audio_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if float == type(float()): self.qtgui_freq_sink_x_0_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_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_0_win) self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[1], True) self.audio_sink_0 = audio.sink(audio_rate, "", True) ################################################## # Connections ################################################## self.connect((self.blocks_wavfile_source_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.qtgui_time_sink_x_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Am Xmit Multi Carrier Fl2K") _icon_path = "/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.rf_sample_rate = rf_sample_rate = 8192e3 self.fir_interp = fir_interp = 512 self.fgain = fgain = 128 self.af_sample_rate = af_sample_rate = 16e3 ################################################## # Blocks ################################################## self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=rf_sample_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_f( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=rf_sample_rate, 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.low_pass_filter_5 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_4 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_3 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_2 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_1 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_5 = blocks.wavfile_source( "Jackbenny-390101Goodbye1938Hello1939.wav", True) self.blocks_wavfile_source_4 = blocks.wavfile_source( "Jackbenny-390115JacksScreenGuildTheatrePerformance.wav", True) self.blocks_wavfile_source_3 = blocks.wavfile_source( "Jackbenny-390122EncyclopediaBritannica.wav", True) self.blocks_wavfile_source_2 = blocks.wavfile_source( "Jackbenny-390129BennyVsAllenFight.wav", True) self.blocks_wavfile_source_1 = blocks.wavfile_source( "Jackbenny-390129JackChallengesFredToFight.wav", True) self.blocks_wavfile_source_0 = blocks.wavfile_source( "Jackbenny-390205JackChallengesFredAllenToABoxingMatch.wav", True) self.blocks_multiply_xx_5 = blocks.multiply_vff(1) self.blocks_multiply_xx_4 = blocks.multiply_vff(1) self.blocks_multiply_xx_3 = blocks.multiply_vff(1) self.blocks_multiply_xx_2 = blocks.multiply_vff(1) self.blocks_multiply_xx_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_multiply_const_vxx_6 = blocks.multiply_const_vff((.045, )) self.blocks_float_to_char_0 = blocks.float_to_char(1, 128) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, "am_xmit_fl2k.dat", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_xx_0 = blocks.add_vff(1) self.blocks_add_const_vxx_5 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_4 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_3 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_2 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_1 = blocks.add_const_vff((1, )) self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, )) self.analog_sig_source_x_5 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 590.006e3, 1, 0) self.analog_sig_source_x_4 = analog.sig_source_f( rf_sample_rate, analog.GR_COS_WAVE, 570.005e3, 1, 0) self.analog_sig_source_x_3 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 560.004e3, 1, 0) self.analog_sig_source_x_2 = analog.sig_source_f( rf_sample_rate, analog.GR_COS_WAVE, 550.003e3, 1, 0) self.analog_sig_source_x_1 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 540.002e3, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_f( rf_sample_rate, analog.GR_COS_WAVE, 530.001e3, 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_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_2, 1)) self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_3, 1)) self.connect((self.analog_sig_source_x_4, 0), (self.blocks_multiply_xx_4, 1)) self.connect((self.analog_sig_source_x_5, 0), (self.blocks_multiply_xx_5, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_add_const_vxx_2, 0), (self.blocks_multiply_xx_2, 0)) self.connect((self.blocks_add_const_vxx_3, 0), (self.blocks_multiply_xx_3, 0)) self.connect((self.blocks_add_const_vxx_4, 0), (self.blocks_multiply_xx_4, 0)) self.connect((self.blocks_add_const_vxx_5, 0), (self.blocks_multiply_xx_5, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_6, 0)) self.connect((self.blocks_float_to_char_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_6, 0), (self.blocks_float_to_char_0, 0)) self.connect((self.blocks_multiply_const_vxx_6, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.blocks_multiply_const_vxx_6, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_0, 3)) self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 4)) self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_0, 5)) self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_wavfile_source_1, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_wavfile_source_2, 0), (self.low_pass_filter_2, 0)) self.connect((self.blocks_wavfile_source_3, 0), (self.low_pass_filter_3, 0)) self.connect((self.blocks_wavfile_source_4, 0), (self.low_pass_filter_4, 0)) self.connect((self.blocks_wavfile_source_5, 0), (self.low_pass_filter_5, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.low_pass_filter_2, 0), (self.blocks_add_const_vxx_2, 0)) self.connect((self.low_pass_filter_3, 0), (self.blocks_add_const_vxx_3, 0)) self.connect((self.low_pass_filter_4, 0), (self.blocks_add_const_vxx_4, 0)) self.connect((self.low_pass_filter_5, 0), (self.blocks_add_const_vxx_5, 0)) # start manual block add # block 6 self.low_pass_filter_6 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_6 = blocks.wavfile_source( "Jackbenny-390212LoveFindsAnnieHardy.wav", True) self.blocks_multiply_xx_6 = blocks.multiply_vff(1) self.blocks_add_const_vxx_6 = blocks.add_const_vff((1, )) self.analog_sig_source_x_6 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 600.006e3, 1, 0) # connections self.connect((self.analog_sig_source_x_6, 0), (self.blocks_multiply_xx_6, 1)) self.connect((self.blocks_add_const_vxx_6, 0), (self.blocks_multiply_xx_6, 0)) self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_0, 6)) self.connect((self.blocks_wavfile_source_6, 0), (self.low_pass_filter_6, 0)) self.connect((self.low_pass_filter_6, 0), (self.blocks_add_const_vxx_6, 0)) # block 7 self.low_pass_filter_7 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_7 = blocks.wavfile_source( "Jackbenny-390219CarmichaelThePolarBear.wav", True) self.blocks_multiply_xx_7 = blocks.multiply_vff(1) self.blocks_add_const_vxx_7 = blocks.add_const_vff((1, )) self.analog_sig_source_x_7 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 620.005e3, 1, 0) # connections self.connect((self.analog_sig_source_x_7, 0), (self.blocks_multiply_xx_7, 1)) self.connect((self.blocks_add_const_vxx_7, 0), (self.blocks_multiply_xx_7, 0)) self.connect((self.blocks_multiply_xx_7, 0), (self.blocks_add_xx_0, 7)) self.connect((self.blocks_wavfile_source_7, 0), (self.low_pass_filter_7, 0)) self.connect((self.low_pass_filter_7, 0), (self.blocks_add_const_vxx_7, 0)) # block 8 self.low_pass_filter_8 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_8 = blocks.wavfile_source( "Jackbenny-390226JesseJamespartOne.wav", True) self.blocks_multiply_xx_8 = blocks.multiply_vff(1) self.blocks_add_const_vxx_8 = blocks.add_const_vff((1, )) self.analog_sig_source_x_8 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 630.004e3, 1, 0) # connections self.connect((self.analog_sig_source_x_8, 0), (self.blocks_multiply_xx_8, 1)) self.connect((self.blocks_add_const_vxx_8, 0), (self.blocks_multiply_xx_8, 0)) self.connect((self.blocks_multiply_xx_8, 0), (self.blocks_add_xx_0, 8)) self.connect((self.blocks_wavfile_source_8, 0), (self.low_pass_filter_8, 0)) self.connect((self.low_pass_filter_8, 0), (self.blocks_add_const_vxx_8, 0)) # block 9 self.low_pass_filter_9 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_9 = blocks.wavfile_source( "Jackbenny-390305JesseJamespartTwo.wav", True) self.blocks_multiply_xx_9 = blocks.multiply_vff(1) self.blocks_add_const_vxx_9 = blocks.add_const_vff((1, )) self.analog_sig_source_x_9 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 640.003e3, 1, 0) # connections self.connect((self.analog_sig_source_x_9, 0), (self.blocks_multiply_xx_9, 1)) self.connect((self.blocks_add_const_vxx_9, 0), (self.blocks_multiply_xx_9, 0)) self.connect((self.blocks_multiply_xx_9, 0), (self.blocks_add_xx_0, 9)) self.connect((self.blocks_wavfile_source_9, 0), (self.low_pass_filter_9, 0)) self.connect((self.low_pass_filter_9, 0), (self.blocks_add_const_vxx_9, 0)) # block 10 self.low_pass_filter_10 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_10 = blocks.wavfile_source( "Jackbenny-390312CarmichaelThePolarBearIsSick.wav", True) self.blocks_multiply_xx_10 = blocks.multiply_vff(1) self.blocks_add_const_vxx_10 = blocks.add_const_vff((1, )) self.analog_sig_source_x_10 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 650.002e3, 1, 0) # connections self.connect((self.analog_sig_source_x_10, 0), (self.blocks_multiply_xx_10, 1)) self.connect((self.blocks_add_const_vxx_10, 0), (self.blocks_multiply_xx_10, 0)) self.connect((self.blocks_multiply_xx_10, 0), (self.blocks_add_xx_0, 10)) self.connect((self.blocks_wavfile_source_10, 0), (self.low_pass_filter_10, 0)) self.connect((self.low_pass_filter_10, 0), (self.blocks_add_const_vxx_10, 0)) # block 11 self.low_pass_filter_11 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_11 = blocks.wavfile_source( "Jackbenny-390319JackHasACold.wav", True) self.blocks_multiply_xx_11 = blocks.multiply_vff(1) self.blocks_add_const_vxx_11 = blocks.add_const_vff((1, )) self.analog_sig_source_x_11 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 660.002e3, 1, 0) # connections self.connect((self.analog_sig_source_x_11, 0), (self.blocks_multiply_xx_11, 1)) self.connect((self.blocks_add_const_vxx_11, 0), (self.blocks_multiply_xx_11, 0)) self.connect((self.blocks_multiply_xx_11, 0), (self.blocks_add_xx_0, 11)) self.connect((self.blocks_wavfile_source_11, 0), (self.low_pass_filter_11, 0)) self.connect((self.low_pass_filter_11, 0), (self.blocks_add_const_vxx_11, 0)) # block 12 self.low_pass_filter_12 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_12 = blocks.wavfile_source( "Jackbenny-390326GuestEdSullivan.wav", True) self.blocks_multiply_xx_12 = blocks.multiply_vff(1) self.blocks_add_const_vxx_12 = blocks.add_const_vff((1, )) self.analog_sig_source_x_12 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 670.001e3, 1, 0) # connections self.connect((self.analog_sig_source_x_12, 0), (self.blocks_multiply_xx_12, 1)) self.connect((self.blocks_add_const_vxx_12, 0), (self.blocks_multiply_xx_12, 0)) self.connect((self.blocks_multiply_xx_12, 0), (self.blocks_add_xx_0, 12)) self.connect((self.blocks_wavfile_source_12, 0), (self.low_pass_filter_12, 0)) self.connect((self.low_pass_filter_12, 0), (self.blocks_add_const_vxx_12, 0)) # block 13 self.low_pass_filter_13 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_13 = blocks.wavfile_source( "Jackbenny-390402AprilFools.wav", True) self.blocks_multiply_xx_13 = blocks.multiply_vff(1) self.blocks_add_const_vxx_13 = blocks.add_const_vff((1, )) self.analog_sig_source_x_13 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 690.000e3, 1, 0) # connections self.connect((self.analog_sig_source_x_13, 0), (self.blocks_multiply_xx_13, 1)) self.connect((self.blocks_add_const_vxx_13, 0), (self.blocks_multiply_xx_13, 0)) self.connect((self.blocks_multiply_xx_13, 0), (self.blocks_add_xx_0, 13)) self.connect((self.blocks_wavfile_source_13, 0), (self.low_pass_filter_13, 0)) self.connect((self.low_pass_filter_13, 0), (self.blocks_add_const_vxx_13, 0)) # block 14 self.low_pass_filter_14 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_14 = blocks.wavfile_source( "Jackbenny-390409FourGirlsInWhite.wav", True) self.blocks_multiply_xx_14 = blocks.multiply_vff(1) self.blocks_add_const_vxx_14 = blocks.add_const_vff((1, )) self.analog_sig_source_x_14 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 700.001e3, 1, 0) # connections self.connect((self.analog_sig_source_x_14, 0), (self.blocks_multiply_xx_14, 1)) self.connect((self.blocks_add_const_vxx_14, 0), (self.blocks_multiply_xx_14, 0)) self.connect((self.blocks_multiply_xx_14, 0), (self.blocks_add_xx_0, 14)) self.connect((self.blocks_wavfile_source_14, 0), (self.low_pass_filter_14, 0)) self.connect((self.low_pass_filter_14, 0), (self.blocks_add_const_vxx_14, 0)) # block 15 self.low_pass_filter_15 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_15 = blocks.wavfile_source( "Jackbenny-390416PhilShootsAMovieBehindJacksBack.wav", True) self.blocks_multiply_xx_15 = blocks.multiply_vff(1) self.blocks_add_const_vxx_15 = blocks.add_const_vff((1, )) self.analog_sig_source_x_15 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 710.002e3, 1, 0) # connections self.connect((self.analog_sig_source_x_15, 0), (self.blocks_multiply_xx_15, 1)) self.connect((self.blocks_add_const_vxx_15, 0), (self.blocks_multiply_xx_15, 0)) self.connect((self.blocks_multiply_xx_15, 0), (self.blocks_add_xx_0, 15)) self.connect((self.blocks_wavfile_source_15, 0), (self.low_pass_filter_15, 0)) self.connect((self.low_pass_filter_15, 0), (self.blocks_add_const_vxx_15, 0)) # block 16 self.low_pass_filter_16 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_16 = blocks.wavfile_source( "Jackbenny-390423GuestBinnieBarnesAndMarkSandrich.wav", True) self.blocks_multiply_xx_16 = blocks.multiply_vff(1) self.blocks_add_const_vxx_16 = blocks.add_const_vff((1, )) self.analog_sig_source_x_16 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 720.003e3, 1, 0) # connections self.connect((self.analog_sig_source_x_16, 0), (self.blocks_multiply_xx_16, 1)) self.connect((self.blocks_add_const_vxx_16, 0), (self.blocks_multiply_xx_16, 0)) self.connect((self.blocks_multiply_xx_16, 0), (self.blocks_add_xx_0, 16)) self.connect((self.blocks_wavfile_source_16, 0), (self.low_pass_filter_16, 0)) self.connect((self.low_pass_filter_16, 0), (self.blocks_add_const_vxx_16, 0)) # block 17 self.low_pass_filter_17 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_17 = blocks.wavfile_source( "Jackbenny-390430SeventhAnniversaryShow.wav", True) self.blocks_multiply_xx_17 = blocks.multiply_vff(1) self.blocks_add_const_vxx_17 = blocks.add_const_vff((1, )) self.analog_sig_source_x_17 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 730.004e3, 1, 0) # connections self.connect((self.analog_sig_source_x_17, 0), (self.blocks_multiply_xx_17, 1)) self.connect((self.blocks_add_const_vxx_17, 0), (self.blocks_multiply_xx_17, 0)) self.connect((self.blocks_multiply_xx_17, 0), (self.blocks_add_xx_0, 17)) self.connect((self.blocks_wavfile_source_17, 0), (self.low_pass_filter_17, 0)) self.connect((self.low_pass_filter_17, 0), (self.blocks_add_const_vxx_17, 0)) # block 18 self.low_pass_filter_18 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_18 = blocks.wavfile_source( "Jackbenny-390507TheKentuckyDerby.wav", True) self.blocks_multiply_xx_18 = blocks.multiply_vff(1) self.blocks_add_const_vxx_18 = blocks.add_const_vff((1, )) self.analog_sig_source_x_18 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 740.005e3, 1, 0) # connections self.connect((self.analog_sig_source_x_18, 0), (self.blocks_multiply_xx_18, 1)) self.connect((self.blocks_add_const_vxx_18, 0), (self.blocks_multiply_xx_18, 0)) self.connect((self.blocks_multiply_xx_18, 0), (self.blocks_add_xx_0, 18)) self.connect((self.blocks_wavfile_source_18, 0), (self.low_pass_filter_18, 0)) self.connect((self.low_pass_filter_18, 0), (self.blocks_add_const_vxx_18, 0)) # block 19 self.low_pass_filter_19 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_19 = blocks.wavfile_source( "Jackbenny-390514GungaDin.wav", True) self.blocks_multiply_xx_19 = blocks.multiply_vff(1) self.blocks_add_const_vxx_19 = blocks.add_const_vff((1, )) self.analog_sig_source_x_19 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 750.006e3, 1, 0) # connections self.connect((self.analog_sig_source_x_19, 0), (self.blocks_multiply_xx_19, 1)) self.connect((self.blocks_add_const_vxx_19, 0), (self.blocks_multiply_xx_19, 0)) self.connect((self.blocks_multiply_xx_19, 0), (self.blocks_add_xx_0, 19)) self.connect((self.blocks_wavfile_source_19, 0), (self.low_pass_filter_19, 0)) self.connect((self.low_pass_filter_19, 0), (self.blocks_add_const_vxx_19, 0)) # block 20 self.low_pass_filter_20 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_20 = blocks.wavfile_source( "Jackbenny-390521MoreGungaDin.wav", True) self.blocks_multiply_xx_20 = blocks.multiply_vff(1) self.blocks_add_const_vxx_20 = blocks.add_const_vff((1, )) self.analog_sig_source_x_20 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 760.005e3, 1, 0) # connections self.connect((self.analog_sig_source_x_20, 0), (self.blocks_multiply_xx_20, 1)) self.connect((self.blocks_add_const_vxx_20, 0), (self.blocks_multiply_xx_20, 0)) self.connect((self.blocks_multiply_xx_20, 0), (self.blocks_add_xx_0, 20)) self.connect((self.blocks_wavfile_source_20, 0), (self.low_pass_filter_20, 0)) self.connect((self.low_pass_filter_20, 0), (self.blocks_add_const_vxx_20, 0)) # block 21 self.low_pass_filter_21 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_21 = blocks.wavfile_source( "Jackbenny-390528AlexanderGrahamBell.wav", True) self.blocks_multiply_xx_21 = blocks.multiply_vff(1) self.blocks_add_const_vxx_21 = blocks.add_const_vff((1, )) self.analog_sig_source_x_21 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 770.004e3, 1, 0) # connections self.connect((self.analog_sig_source_x_21, 0), (self.blocks_multiply_xx_21, 1)) self.connect((self.blocks_add_const_vxx_21, 0), (self.blocks_multiply_xx_21, 0)) self.connect((self.blocks_multiply_xx_21, 0), (self.blocks_add_xx_0, 21)) self.connect((self.blocks_wavfile_source_21, 0), (self.low_pass_filter_21, 0)) self.connect((self.low_pass_filter_21, 0), (self.blocks_add_const_vxx_21, 0)) # block 22 self.low_pass_filter_22 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_22 = blocks.wavfile_source( "Jackbenny-390604PreviewOfHoundOfTheBaskervilles.wav", True) self.blocks_multiply_xx_22 = blocks.multiply_vff(1) self.blocks_add_const_vxx_22 = blocks.add_const_vff((1, )) self.analog_sig_source_x_22 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 780.003e3, 1, 0) # connections self.connect((self.analog_sig_source_x_22, 0), (self.blocks_multiply_xx_22, 1)) self.connect((self.blocks_add_const_vxx_22, 0), (self.blocks_multiply_xx_22, 0)) self.connect((self.blocks_multiply_xx_22, 0), (self.blocks_add_xx_0, 22)) self.connect((self.blocks_wavfile_source_22, 0), (self.low_pass_filter_22, 0)) self.connect((self.low_pass_filter_22, 0), (self.blocks_add_const_vxx_22, 0)) # block 23 self.low_pass_filter_23 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_23 = blocks.wavfile_source( "Jackbenny-390618FathersDayLeavingForWaukegan.wav", True) self.blocks_multiply_xx_23 = blocks.multiply_vff(1) self.blocks_add_const_vxx_23 = blocks.add_const_vff((1, )) self.analog_sig_source_x_23 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 790.002e3, 1, 0) # connections self.connect((self.analog_sig_source_x_23, 0), (self.blocks_multiply_xx_23, 1)) self.connect((self.blocks_add_const_vxx_23, 0), (self.blocks_multiply_xx_23, 0)) self.connect((self.blocks_multiply_xx_23, 0), (self.blocks_add_xx_0, 23)) self.connect((self.blocks_wavfile_source_23, 0), (self.low_pass_filter_23, 0)) self.connect((self.low_pass_filter_23, 0), (self.blocks_add_const_vxx_23, 0)) # block 24 self.low_pass_filter_24 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_24 = blocks.wavfile_source( "Jackbenny-390625LastShowOfTheSeasonFromWaukegan.wav", True) self.blocks_multiply_xx_24 = blocks.multiply_vff(1) self.blocks_add_const_vxx_24 = blocks.add_const_vff((1, )) self.analog_sig_source_x_24 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 800.001e3, 1, 0) # connections self.connect((self.analog_sig_source_x_24, 0), (self.blocks_multiply_xx_24, 1)) self.connect((self.blocks_add_const_vxx_24, 0), (self.blocks_multiply_xx_24, 0)) self.connect((self.blocks_multiply_xx_24, 0), (self.blocks_add_xx_0, 24)) self.connect((self.blocks_wavfile_source_24, 0), (self.low_pass_filter_24, 0)) self.connect((self.low_pass_filter_24, 0), (self.blocks_add_const_vxx_24, 0)) # block 25 self.low_pass_filter_25 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_25 = blocks.wavfile_source( "Jackbenny-391008DennisDaysFirstShow.wav", True) self.blocks_multiply_xx_25 = blocks.multiply_vff(1) self.blocks_add_const_vxx_25 = blocks.add_const_vff((1, )) self.analog_sig_source_x_25 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 810.000e3, 1, 0) # connections self.connect((self.analog_sig_source_x_25, 0), (self.blocks_multiply_xx_25, 1)) self.connect((self.blocks_add_const_vxx_25, 0), (self.blocks_multiply_xx_25, 0)) self.connect((self.blocks_multiply_xx_25, 0), (self.blocks_add_xx_0, 25)) self.connect((self.blocks_wavfile_source_25, 0), (self.low_pass_filter_25, 0)) self.connect((self.low_pass_filter_25, 0), (self.blocks_add_const_vxx_25, 0)) # block 26 self.low_pass_filter_26 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_26 = blocks.wavfile_source( "Jackbenny-391015DennissMotherInterferes.wav", True) self.blocks_multiply_xx_26 = blocks.multiply_vff(1) self.blocks_add_const_vxx_26 = blocks.add_const_vff((1, )) self.analog_sig_source_x_26 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 820.001e3, 1, 0) # connections self.connect((self.analog_sig_source_x_26, 0), (self.blocks_multiply_xx_26, 1)) self.connect((self.blocks_add_const_vxx_26, 0), (self.blocks_multiply_xx_26, 0)) self.connect((self.blocks_multiply_xx_26, 0), (self.blocks_add_xx_0, 26)) self.connect((self.blocks_wavfile_source_26, 0), (self.low_pass_filter_26, 0)) self.connect((self.low_pass_filter_26, 0), (self.blocks_add_const_vxx_26, 0)) # block 27 self.low_pass_filter_27 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_27 = blocks.wavfile_source( "Jackbenny-391022StanleyAndLivingstone.wav", True) self.blocks_multiply_xx_27 = blocks.multiply_vff(1) self.blocks_add_const_vxx_27 = blocks.add_const_vff((1, )) self.analog_sig_source_x_27 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 830.002e3, 1, 0) # connections self.connect((self.analog_sig_source_x_27, 0), (self.blocks_multiply_xx_27, 1)) self.connect((self.blocks_add_const_vxx_27, 0), (self.blocks_multiply_xx_27, 0)) self.connect((self.blocks_multiply_xx_27, 0), (self.blocks_add_xx_0, 27)) self.connect((self.blocks_wavfile_source_27, 0), (self.low_pass_filter_27, 0)) self.connect((self.low_pass_filter_27, 0), (self.blocks_add_const_vxx_27, 0)) # block 28 self.low_pass_filter_28 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_28 = blocks.wavfile_source( "Jackbenny-391029TheHalloweenMasqueradeParty.wav", True) self.blocks_multiply_xx_28 = blocks.multiply_vff(1) self.blocks_add_const_vxx_28 = blocks.add_const_vff((1, )) self.analog_sig_source_x_28 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 840.003e3, 1, 0) # connections self.connect((self.analog_sig_source_x_28, 0), (self.blocks_multiply_xx_28, 1)) self.connect((self.blocks_add_const_vxx_28, 0), (self.blocks_multiply_xx_28, 0)) self.connect((self.blocks_multiply_xx_28, 0), (self.blocks_add_xx_0, 28)) self.connect((self.blocks_wavfile_source_28, 0), (self.low_pass_filter_28, 0)) self.connect((self.low_pass_filter_28, 0), (self.blocks_add_const_vxx_28, 0)) # block 29 self.low_pass_filter_29 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_29 = blocks.wavfile_source( "Jackbenny-391105TheWomen.wav", True) self.blocks_multiply_xx_29 = blocks.multiply_vff(1) self.blocks_add_const_vxx_29 = blocks.add_const_vff((1, )) self.analog_sig_source_x_29 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 850.004e3, 1, 0) # connections self.connect((self.analog_sig_source_x_29, 0), (self.blocks_multiply_xx_29, 1)) self.connect((self.blocks_add_const_vxx_29, 0), (self.blocks_multiply_xx_29, 0)) self.connect((self.blocks_multiply_xx_29, 0), (self.blocks_add_xx_0, 29)) self.connect((self.blocks_wavfile_source_29, 0), (self.low_pass_filter_29, 0)) self.connect((self.low_pass_filter_29, 0), (self.blocks_add_const_vxx_29, 0)) # block 30 self.low_pass_filter_30 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_30 = blocks.wavfile_source( "Jackbenny-391112JacksToothache.wav", True) self.blocks_multiply_xx_30 = blocks.multiply_vff(1) self.blocks_add_const_vxx_30 = blocks.add_const_vff((1, )) self.analog_sig_source_x_30 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 860.005e3, 1, 0) # connections self.connect((self.analog_sig_source_x_30, 0), (self.blocks_multiply_xx_30, 1)) self.connect((self.blocks_add_const_vxx_30, 0), (self.blocks_multiply_xx_30, 0)) self.connect((self.blocks_multiply_xx_30, 0), (self.blocks_add_xx_0, 30)) self.connect((self.blocks_wavfile_source_30, 0), (self.low_pass_filter_30, 0)) self.connect((self.low_pass_filter_30, 0), (self.blocks_add_const_vxx_30, 0)) # block 31 self.low_pass_filter_31 = filter.interp_fir_filter_fff( fir_interp, firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_31 = blocks.wavfile_source( "Jackbenny-391119MarysThanksgivingPoem.wav", True) self.blocks_multiply_xx_31 = blocks.multiply_vff(1) self.blocks_add_const_vxx_31 = blocks.add_const_vff((1, )) self.analog_sig_source_x_31 = analog.sig_source_f( rf_sample_rate, analog.GR_SIN_WAVE, 870.006e3, 1, 0) # connections self.connect((self.analog_sig_source_x_31, 0), (self.blocks_multiply_xx_31, 1)) self.connect((self.blocks_add_const_vxx_31, 0), (self.blocks_multiply_xx_31, 0)) self.connect((self.blocks_multiply_xx_31, 0), (self.blocks_add_xx_0, 31)) self.connect((self.blocks_wavfile_source_31, 0), (self.low_pass_filter_31, 0)) self.connect((self.low_pass_filter_31, 0), (self.blocks_add_const_vxx_31, 0))
def __init__(self, input_file, output_file): gr.top_block.__init__(self) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2048000 ################################################## # Blocks ################################################## self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass( 1, samp_rate, 85000, 2000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, 200000, 1000, firdes.WIN_HAMMING, 6.76)) if input_file != None: self.blocks_wavfile_source_0 = blocks.wavfile_source(input_file, False) else: import osmosdr self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(433463000, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(10, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) if output_file == '-': self.blocks_file_sink_0 = blocks.file_descriptor_sink(4, 1) else: self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, output_file, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_const_vxx_0 = blocks.add_const_vff((0.00, )) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -420000, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) if input_file != None: self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0)) else: self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def test_001_checkwavread(self): wf = blocks.wavfile_source(g_in_file) self.assertEqual(wf.sample_rate(), 8000)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Audio Transmitter") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.variable_slider_0 = variable_slider_0 = 80e6 self.samp_rate = samp_rate = 44100 ################################################## # Blocks ################################################## _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, label="freq_slider", converter=forms.float_converter(), proportion=0, ) self._variable_slider_0_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, minimum=80e6, maximum=150e6, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_variable_slider_0_sizer) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=variable_slider_0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=195312, 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_sink_0 = uhd.usrp_sink( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(195312) self.uhd_usrp_sink_0.set_center_freq(variable_slider_0, 0) self.uhd_usrp_sink_0.set_gain(20, 0) self.uhd_usrp_sink_0.set_antenna("J2", 0) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=195312, decimation=264600, taps=None, fractional_bw=None, ) self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/ece775/Desktop/wireless_project/Theme - Friends.wav", True) self.audio_sink_0 = audio.sink(44100, "", True) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=44100, quad_rate=264600, tau=75e-6, max_dev=5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_tx_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.audio_sink_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Bl") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.rango_l = rango_l = 24000 self.range_h = range_h = 50 ################################################## # Blocks ################################################## _rango_l_sizer = wx.BoxSizer(wx.VERTICAL) self._rango_l_text_box = forms.text_box( parent=self.GetWin(), sizer=_rango_l_sizer, value=self.rango_l, callback=self.set_rango_l, label='rango_l', converter=forms.float_converter(), proportion=0, ) self._rango_l_slider = forms.slider( parent=self.GetWin(), sizer=_rango_l_sizer, value=self.rango_l, callback=self.set_rango_l, minimum=0, maximum=24000, num_steps=240, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_rango_l_sizer) _range_h_sizer = wx.BoxSizer(wx.VERTICAL) self._range_h_text_box = forms.text_box( parent=self.GetWin(), sizer=_range_h_sizer, value=self.range_h, callback=self.set_range_h, label="range_h", converter=forms.float_converter(), proportion=0, ) self._range_h_slider = forms.slider( parent=self.GetWin(), sizer=_range_h_sizer, value=self.range_h, callback=self.set_range_h, minimum=0, maximum=24000, num_steps=240, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_range_h_sizer) self.wxgui_fftsink2_0 = fftsink2.fft_sink_f( self.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 Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.low_pass_filter_0 = filter.fir_filter_fff( 1, firdes.low_pass(1, samp_rate, rango_l, 100, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, range_h, 100, firdes.WIN_HAMMING, 6.76)) self.blocks_wavfile_source_0 = blocks.wavfile_source( "/usr/share/sounds/alsa/Front_Center.wav", True) self.audio_sink_0 = audio.sink(samp_rate, "sysdefault", True) ################################################## # Connections ################################################## self.connect((self.low_pass_filter_0, 0), (self.high_pass_filter_0, 0)) self.connect((self.high_pass_filter_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.wxgui_fftsink2_0, 0))
def update_input(self): self.blocks_wavfile_source_0 = blocks.wavfile_source(self.input_file, False)
def __init__(self): gr.top_block.__init__(self, "WSPR-Transmitter") Qt.QWidget.__init__(self) self.setWindowTitle("WSPR-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", "wspr_transmitter") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.center_freq = center_freq = 50.293e6 self.samp_rate = samp_rate = 8e6 self.rf_gain = rf_gain = 0 self.ppm_cor = ppm_cor = 0 self.lo_freq = lo_freq = 10e3 self.if_gain = if_gain = 20 self.data_freq_0 = data_freq_0 = center_freq self.data_freq = data_freq = center_freq + 1500 self.audio_rate = audio_rate = 48000 ################################################## # Blocks ################################################## _rf_gain_check_box = Qt.QCheckBox('RF Gain enable') self._rf_gain_choices = {True: 14, False: 0} self._rf_gain_choices_inv = dict( (v, k) for k, v in self._rf_gain_choices.iteritems()) self._rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod( _rf_gain_check_box, "setChecked", Qt.Q_ARG("bool", self._rf_gain_choices_inv[i])) self._rf_gain_callback(self.rf_gain) _rf_gain_check_box.stateChanged.connect( lambda i: self.set_rf_gain(self._rf_gain_choices[bool(i)])) self.top_grid_layout.addWidget(_rf_gain_check_box) self._ppm_cor_range = Range(-3, 3, 0.1, 0, 200) self._ppm_cor_win = RangeWidget(self._ppm_cor_range, self.set_ppm_cor, 'PPM Correction', "counter_slider", float) self.top_grid_layout.addWidget(self._ppm_cor_win) self._if_gain_range = Range(0, 47, 1, 20, 200) self._if_gain_win = RangeWidget(self._if_gain_range, self.set_if_gain, 'IF Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._if_gain_win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=500, decimation=3, 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(center_freq - lo_freq, 0) self.osmosdr_sink_0.set_freq_corr(ppm_cor, 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(0, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self._data_freq_0_tool_bar = Qt.QToolBar(self) if None: self._data_freq_0_formatter = None else: self._data_freq_0_formatter = lambda x: eng_notation.num_to_str(x) self._data_freq_0_tool_bar.addWidget( Qt.QLabel('Set receiver frequency in USB mode' + ": ")) self._data_freq_0_label = Qt.QLabel( str(self._data_freq_0_formatter(self.data_freq_0))) self._data_freq_0_tool_bar.addWidget(self._data_freq_0_label) self.top_grid_layout.addWidget(self._data_freq_0_tool_bar) self._data_freq_tool_bar = Qt.QToolBar(self) if None: self._data_freq_formatter = None else: self._data_freq_formatter = lambda x: eng_notation.num_to_str(x) self._data_freq_tool_bar.addWidget( Qt.QLabel('WSPR data center frequency' + ": ")) self._data_freq_label = Qt.QLabel( str(self._data_freq_formatter(self.data_freq))) self._data_freq_tool_bar.addWidget(self._data_freq_label) self.top_grid_layout.addWidget(self._data_freq_tool_bar) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'D:\\WSPR.wav', False) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.band_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.band_pass(1, audio_rate, lo_freq + 1e3, lo_freq + 2e3, 250, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, lo_freq, 0.5, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.osmosdr_sink_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.factor_of_baud = factor_of_baud = 8 self.baud_rate = baud_rate = 4160 self.signal_gain = signal_gain = 5 self.samp_rate = samp_rate = 11025 self.demod_rate = demod_rate = baud_rate * factor_of_baud ################################################## # Blocks ################################################## self._signal_gain_range = Range(0, 800, 1, 5, 200) self._signal_gain_win = RangeWidget(self._signal_gain_range, self.set_signal_gain, "Signal Gain", "counter_slider", float) self.top_layout.addWidget(self._signal_gain_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( baud_rate / 2, #size baud_rate, #samp_rate 'APT Full Line', #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(-0.5, 0.5) 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.01, 0, 'SyncA') self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_control_panel(False) if not False: 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(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( baud_rate, 128, int(baud_rate / 2), ([]), ([]), "", 1, ) self.qtgui_time_raster_sink_x_0.set_update_time(0.5) self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 0.75) self.qtgui_time_raster_sink_x_0.enable_grid(False) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [1, 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_time_raster_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win) self.fm_demodulated_source = blocks.wavfile_source("/home/brian/stem_station/sample_files/N18_4827.wav", False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_float*1, "/home/brian/stem_station/raw_meta1.dat", baud_rate, 1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True) self.blocks_file_meta_sink_0.set_unbuffered(False) self.apt_am_demod_0 = apt_am_demod( parameter_apt_gain=signal_gain, parameter_samp_rate=samp_rate, ) ################################################## # Connections ################################################## self.connect((self.apt_am_demod_0, 0), (self.blocks_file_meta_sink_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.apt_am_demod_0, 0)) self.connect((self.fm_demodulated_source, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "Bpsk Receiverpoly") ################################################## # Variables ################################################## self.sps = sps = 8 self.probe_var = probe_var = 0 self.nfilts = nfilts = 32 self.eb = eb = 0.35 self.SNR = SNR = 500 self.transistion = transistion = 100 self.timing_loop_bw = timing_loop_bw = 6.28/100.0 self.sideband_rx = sideband_rx = 500 self.sideband = sideband = 500 self.samp_rate = samp_rate = 48000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts/16, nfilts/16, 1.0/float(sps), 0.35, 11*sps*nfilts/16) self.qpsk = qpsk = digital.constellation_rect(([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base() self.probe_var_n = probe_var_n = 0 self.preamble = preamble = [1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1] self.phase_bw = phase_bw = 6.28/100.0 self.noise_amp = noise_amp = probe_var/(10**(SNR/20)) self.matched_filter = matched_filter = firdes.root_raised_cosine(nfilts, nfilts, 1, eb, int(11*sps*nfilts)) self.interpolation = interpolation = 60000 self.eq_gain = eq_gain = 0.01 self.delay = delay = 0 self.decimation = decimation = 1 self.constel = constel = digital.constellation_calcdist(([1,- 1]), ([0,1]), 2, 1).base() self.carrier = carrier = 10000 self.arity = arity = 2 ################################################## # Blocks ################################################## self.probe_rms = blocks.probe_signal_f() self.probe_avg_n = blocks.probe_signal_f() self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=decimation, decimation=interpolation, taps=(rrc_taps), fractional_bw=None, ) def _probe_var_n_probe(): while True: val = self.probe_avg_n.level() try: self.set_probe_var_n(val) except AttributeError: pass time.sleep(1.0 / (10)) _probe_var_n_thread = threading.Thread(target=_probe_var_n_probe) _probe_var_n_thread.daemon = True _probe_var_n_thread.start() def _probe_var_probe(): while True: val = self.probe_rms.level() try: self.set_probe_var(val) except AttributeError: pass time.sleep(1.0 / (10)) _probe_var_thread = threading.Thread(target=_probe_var_probe) _probe_var_thread.daemon = True _probe_var_thread.start() self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(1, (filter.firdes.low_pass(1, samp_rate*10, sideband_rx,1000)), carrier, samp_rate) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, (rrc_taps), nfilts*2, nfilts/2, 1.5, 1) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(constel) script, SNRinput, inputwav, outputBinary, delay= argv self.blocks_wavfile_source_0 = blocks.wavfile_source(inputwav, False) self.blocks_throttle_1_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_rms_xx_1 = blocks.rms_cf(0.01) self.blocks_rms_xx_0 = blocks.rms_cf(0.01) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, outputBinary, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_delay_1 = blocks.delay(gr.sizeof_char*1, int(delay)) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, noise_amp, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_rms_xx_1, 0)) self.connect((self.blocks_add_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.blocks_delay_1, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.blocks_rms_xx_0, 0), (self.probe_rms, 0)) self.connect((self.blocks_rms_xx_1, 0), (self.probe_avg_n, 0)) self.connect((self.blocks_throttle_1_0_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_throttle_1_0_0, 0), (self.blocks_rms_xx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_delay_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_throttle_1_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Keyfob Decode Wav") ################################################## # Variables ################################################## self.sps = sps = 5 self.samp_rate = samp_rate = 48000 ################################################## # Blocks ################################################## self.wxgui_scopesink2_1 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Scope Plot", sample_rate=3400 * 5, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( 3400.0*sps/48000, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.keyfob_parse_packet_0 = keyfob.parse_packet() self.keyfob_manchester_decode_0 = keyfob.manchester_decode() self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb("10101000", 0, "packet_start") self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(5*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.05) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_wavfile_source_0 = blocks.wavfile_source("../gqrx_20150306_154200_434400000.wav", False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate*3,True) self.blocks_moving_average_xx_1 = blocks.moving_average_ff(sps, 1, 4000) ################################################## # Connections ################################################## self.connect((self.blocks_moving_average_xx_1, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.keyfob_manchester_decode_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.wxgui_scopesink2_1, 0)) self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.keyfob_parse_packet_0, 0)) self.connect((self.keyfob_manchester_decode_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_moving_average_xx_1, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Am Hackrf") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 1710e3 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=4096, 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 // 50000, decimation=1, 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 + 100000, 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(1, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(1.5e6, 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, 3750) self.nrsc5_l1_am_encoder_ma1_0 = nrsc5.l1_am_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 17900) 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(256, False, window.rectangular(256), True, 1) 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, 256) self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 14) for i in range(14)] + [1] * (256-14) + [math.cos(math.pi / 2 * i / 14) for i in range(14)], True, 1, []) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2 * math.pi * 100000 / samp_rate) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*256, 2) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*24000) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 270, 512, 121) 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 = blocks.add_const_ff(0.5) self.analog_sig_source_x_0 = analog.sig_source_f(50000, analog.GR_COS_WAVE, 1000, 0.1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_null_source_0, 0), (self.nrsc5_l1_am_encoder_ma1_0, 1)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.osmosdr_sink_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, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_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_am_encoder_ma1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_am_encoder_ma1_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_am_encoder_ma1_0, 2)) 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_add_xx_0, 0))
def test_001_checkwavread(self): wf = blocks.wavfile_source(g_in_file) self.assertEqual(wf.sample_rate(), 8000)
def __init__(self): gr.top_block.__init__(self, "OFDM Rx") ################################################## # Variables ################################################## self.pilot_symbols = pilot_symbols = (( 1, 1, 1, -1, ), ) self.pilot_carriers = pilot_carriers = (( -21, -7, 7, 21, ), ) self.payload_mod = payload_mod = digital.constellation_qpsk() self.packet_length_tag_key = packet_length_tag_key = "packet_len" self.occupied_carriers = occupied_carriers = ( range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27), ) self.length_tag_key = length_tag_key = "frame_len" self.header_mod = header_mod = digital.constellation_bpsk() self.fft_len = fft_len = 64 self.transistion = transistion = 500 self.sync_word2 = sync_word2 = [ 0j, 0j, 0j, 0j, 0j, 0j, (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), 0j, (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), (-1 + 0j), 0j, 0j, 0j, 0j, 0j ] self.sync_word1 = sync_word1 = [ 0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0. ] self.sideband_rx = sideband_rx = 1000 self.sideband = sideband = 1000 self.samp_rate = samp_rate = 48000 self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe( fft_len, payload_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols, 1) self.packet_len = packet_len = 4 self.interpolation = interpolation = 225 self.header_formatter = header_formatter = digital.packet_header_ofdm( occupied_carriers, n_syms=1, len_tag_key=packet_length_tag_key, frame_len_tag_key=length_tag_key, bits_per_header_sym=header_mod.bits_per_symbol(), bits_per_payload_sym=payload_mod.bits_per_symbol(), scramble_header=False) self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe( fft_len, header_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols) self.carrier = carrier = 10000 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=10, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=interpolation, taps=None, fractional_bw=None, ) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc( 1, (filter.firdes.low_pass(1, samp_rate, carrier + sideband_rx, 1000)), carrier, samp_rate) self.fft_vxx_1 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_0 = fft.fft_vcc(fft_len, True, (()), True, 1) self.digital_packet_headerparser_b_0 = digital.packet_headerparser_b( header_formatter.base()) self.digital_ofdm_sync_sc_cfb_0 = digital.ofdm_sync_sc_cfb( fft_len, fft_len / 4, False) self.digital_ofdm_serializer_vcc_payload = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, packet_length_tag_key, 1, "", True) self.digital_ofdm_serializer_vcc_header = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, "", 0, "", True) self.digital_ofdm_frame_equalizer_vcvc_1 = digital.ofdm_frame_equalizer_vcvc( payload_equalizer.base(), fft_len / 4, length_tag_key, True, 0) self.digital_ofdm_frame_equalizer_vcvc_0 = digital.ofdm_frame_equalizer_vcvc( header_equalizer.base(), fft_len / 4, length_tag_key, True, 1) self.digital_ofdm_chanest_vcvc_0 = digital.ofdm_chanest_vcvc( (sync_word1), (sync_word2), 1, 0, 3, False) self.digital_header_payload_demux_0 = digital.header_payload_demux( 3, fft_len, fft_len / 4, length_tag_key, "", True, gr.sizeof_gr_complex, "rx_time", samp_rate, (), ) self.digital_crc32_bb_0 = digital.crc32_bb(True, packet_length_tag_key, True) script, inputwav, outputBinary = argv self.digital_constellation_decoder_cb_1 = digital.constellation_decoder_cb( payload_mod.base()) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb( header_mod.base()) self.blocks_wavfile_source_0 = blocks.wavfile_source(inputwav, False) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb( payload_mod.bits_per_symbol(), 8, packet_length_tag_key, True, gr.GR_LSB_FIRST) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((10, )) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, outputBinary, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, fft_len + fft_len / 4) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 0.01, 0) self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc( -2.0 / fft_len) ################################################## # Connections ################################################## self.msg_connect((self.digital_packet_headerparser_b_0, 'header_data'), (self.digital_header_payload_demux_0, 'header_data')) self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_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.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.digital_header_payload_demux_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_crc32_bb_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_ofdm_sync_sc_cfb_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_packet_headerparser_b_0, 0)) self.connect((self.digital_constellation_decoder_cb_1, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.digital_crc32_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.digital_header_payload_demux_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_header_payload_demux_0, 1), (self.fft_vxx_1, 0)) self.connect((self.digital_ofdm_chanest_vcvc_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_0, 0), (self.digital_ofdm_serializer_vcc_header, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_1, 0), (self.digital_ofdm_serializer_vcc_payload, 0)) self.connect((self.digital_ofdm_serializer_vcc_header, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_payload, 0), (self.digital_constellation_decoder_cb_1, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0, 0), (self.analog_frequency_modulator_fc_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0, 1), (self.digital_header_payload_demux_0, 1)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_chanest_vcvc_0, 0)) self.connect((self.fft_vxx_1, 0), (self.digital_ofdm_frame_equalizer_vcvc_1, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) 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.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 = 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, args): gr.top_block.__init__(self, "Top Block") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 48000 self.seed = seed = args.seed self.m_rate = m_rate = args.m_rate self.if_rate = if_rate = samp_rate * 40 self.gauss = gauss = args.gauss self.fc = fc = args.fc self.dpp = dpp = args.dop ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_1 = filter.rational_resampler_fff( interpolation=3, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=40, decimation=1, taps=None, fractional_bw=None, ) self.low_pass_filter_1_0 = filter.fir_filter_fff( 40, firdes.low_pass(1, if_rate, 7500, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_1 = filter.fir_filter_fff( 40, firdes.low_pass(1, if_rate, 7500, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.interp_fir_filter_fff( 1, firdes.low_pass(1, samp_rate, 7500, 100, firdes.WIN_HAMMING, 6.76)) self.hilbert_fc_0 = filter.hilbert_fc(301, firdes.WIN_HAMMING, 6.76) self.high_pass_filter_0_1 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0_0_0_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0_0_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76)) self.high_pass_filter_0 = filter.fir_filter_fff( 1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76)) self.channels_fading_model_0 = channels.fading_model( 8, dpp / if_rate, True, 2, 256) self.blocks_wavfile_source_0 = blocks.wavfile_source(file1, False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (m_rate, )) self.blocks_file_sink_0_5 = blocks.file_sink(gr.sizeof_float * 1, file2, False) self.blocks_file_sink_0_5.set_unbuffered(False) self.blocks_file_sink_0_4 = blocks.file_sink(gr.sizeof_float * 1, file3, False) self.blocks_file_sink_0_4.set_unbuffered(False) self.blocks_file_sink_0_3 = blocks.file_sink(gr.sizeof_float * 1, file4, False) self.blocks_file_sink_0_3.set_unbuffered(False) self.blocks_file_sink_0_2 = blocks.file_sink(gr.sizeof_float * 1, file5, False) self.blocks_file_sink_0_2.set_unbuffered(False) self.blocks_file_sink_0_1 = blocks.file_sink(gr.sizeof_float * 1, file6, False) self.blocks_file_sink_0_1.set_unbuffered(False) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float * 1, file7, False) self.blocks_file_sink_0_0.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1, file8, False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_add_xx_0_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, )) self.band_pass_filter_0_1 = filter.fir_filter_ccf( 1, firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0_0_0 = filter.fir_filter_ccf( 1, firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0_0 = filter.fir_filter_ccf( 1, firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0_0 = analog.sig_source_f( if_rate, analog.GR_COS_WAVE, fc, 1, 0) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c( analog.GR_GAUSSIAN, gauss, seed, 8192) self.analog_am_demod_cf_0_1 = analog.am_demod_cf( channel_rate=fc, audio_decim=40, audio_pass=7500, audio_stop=10e3, ) self.analog_am_demod_cf_0_0_0_0 = analog.am_demod_cf( channel_rate=fc, audio_decim=40, audio_pass=7500, audio_stop=10e3, ) self.analog_am_demod_cf_0_0_0 = analog.am_demod_cf( channel_rate=fc, audio_decim=40, audio_pass=7500, audio_stop=10e3, ) self.analog_am_demod_cf_0_0 = analog.am_demod_cf( channel_rate=fc, audio_decim=40, audio_pass=7500, audio_stop=10e3, ) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=fc, audio_decim=40, audio_pass=7500, audio_stop=10e3, ) ################################################## # Connections ################################################## self.connect((self.analog_am_demod_cf_0, 0), (self.high_pass_filter_0, 0)) self.connect((self.analog_am_demod_cf_0_0, 0), (self.high_pass_filter_0_0, 0)) self.connect((self.analog_am_demod_cf_0_0_0, 0), (self.high_pass_filter_0_0_0, 0)) self.connect((self.analog_am_demod_cf_0_0_0_0, 0), (self.high_pass_filter_0_0_0_0, 0)) self.connect((self.analog_am_demod_cf_0_1, 0), (self.high_pass_filter_0_1, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0_0_0, 0)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1_0, 1)) self.connect((self.band_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.analog_am_demod_cf_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.analog_am_demod_cf_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.band_pass_filter_0_0_0_0, 0), (self.analog_am_demod_cf_0_0_0_0, 0)) self.connect((self.band_pass_filter_0_1, 0), (self.analog_am_demod_cf_0_1, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.band_pass_filter_0_1, 0)) self.connect((self.blocks_add_xx_0_0_0, 0), (self.band_pass_filter_0_0_0_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_multiply_xx_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0_0_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_multiply_xx_1_0, 0), (self.low_pass_filter_1_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.rational_resampler_xxx_0_1, 0)) self.connect((self.channels_fading_model_0, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.channels_fading_model_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.channels_fading_model_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.high_pass_filter_0, 0), (self.blocks_file_sink_0_5, 0)) self.connect((self.high_pass_filter_0_0, 0), (self.blocks_file_sink_0_3, 0)) self.connect((self.high_pass_filter_0_0_0, 0), (self.blocks_file_sink_0_2, 0)) self.connect((self.high_pass_filter_0_0_0_0, 0), (self.blocks_file_sink_0_1, 0)) self.connect((self.high_pass_filter_0_1, 0), (self.blocks_file_sink_0_4, 0)) self.connect((self.hilbert_fc_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.channels_fading_model_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_file_sink_0, 0)) self.connect((self.low_pass_filter_1_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.rational_resampler_xxx_0_1, 0), (self.low_pass_filter_0, 0))