Beispiel #1
0
 def __init__(self, parent):
 #   ------------------------------------------------------------------------
     """
     Initialize, create and place wrapped Gnuradio object onto the underlying 
     wx.Panel.
     """
     super(FftControl, self).__init__(parent)
     self.sink = fftsink2.fft_sink_f(
         self,
         baseband_freq=0,
         y_per_div=10,
         y_divs=10,
         ref_level=0,
         ref_scale=2.0,
         sample_rate=48000,
         fft_size=1024,
         fft_rate=15,
         average=True,
         avg_alpha=None,
         title="FFT Plot",
         peak_hold=False,
     )
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(self.sink.win, proportion=1, flag=wx.EXPAND)
     self.SetSizer(sizer)
Beispiel #2
0
    def _build_gui(self, vbox, usrp_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        if 1:
            self.fft = fftsink2.fft_sink_f(self.panel,
                                           title="Post FM Demod",
                                           fft_size=512,
                                           sample_rate=usrp_rate,
                                           y_per_div=10,
                                           ref_level=0)
            self.connect(self.fm_demod, self.fft)
            vbox.Add(self.fft.win, 4, wx.EXPAND)
        if 0:
            self.scope = scopesink2.scope_sink_f(self.panel,
                                                 title="RDS timedomain",
                                                 sample_rate=usrp_rate,
                                                 num_inputs=2)
            self.connect(self.rds_bb_filter, (rds_scope, 1))
            self.connect(self.rds_clock, (rds_scope, 0))
            vbox.Add(self.scope.win, 4, wx.EXPAND)

        self.rdspanel = rdsPanel(self.msgq, self.panel)
        vbox.Add(self.rdspanel, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 20)

        # control area form at bottom
        self.myform = form.form()
Beispiel #3
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel

        parser = OptionParser(option_class=eng_option)
        parser.add_option("-W",
                          "--waterfall",
                          action="store_true",
                          default=False,
                          help="Enable waterfall display")
        parser.add_option("-S",
                          "--oscilloscope",
                          action="store_true",
                          default=False,
                          help="Enable oscilloscope display")
        parser.add_option(
            "-I",
            "--audio-input",
            type="string",
            default="",
            help="pcm input device name.  E.g., hw:0,0 or /dev/dsp")
        parser.add_option("-r",
                          "--sample-rate",
                          type="eng_float",
                          default=48000,
                          help="set sample rate to RATE (48000)")

        (options, args) = parser.parse_args()
        sample_rate = int(options.sample_rate)

        if len(args) != 0:
            parser.print_help()
            sys.exit(1)

        self.show_debug_info = True

        # build the graph
        if options.waterfall:
            self.scope = \
              waterfallsink2.waterfall_sink_f (panel, fft_size=1024, sample_rate=sample_rate)
        elif options.oscilloscope:
            self.scope = scopesink2.scope_sink_f(panel,
                                                 sample_rate=sample_rate)
        else:
            self.scope = fftsink2.fft_sink_f(panel,
                                             fft_size=1024,
                                             sample_rate=sample_rate,
                                             fft_rate=30,
                                             ref_scale=1.0,
                                             ref_level=0,
                                             y_divs=12)

        self.src = audio.source(sample_rate, options.audio_input)

        self.connect(self.src, self.scope)

        self._build_gui(vbox)
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="AM RX")

        ##################################################
        # Variables
        ##################################################
        self.transmission_width = transmission_width = 100
        self.samp_rate = samp_rate = 256000
        self.resamp_factor = resamp_factor = 4
        self.cut_off_freq = cut_off_freq = 5000

        ##################################################
        # Blocks
        ##################################################
        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/resamp_factor,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=resamp_factor,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=resamp_factor,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, cut_off_freq, transmission_width, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/Users/ampoulog/Documents/gnuradio/Wireless-communication-systems-Lab/Lab2/example6/am_usrp710.dat', True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.audio_sink_0 = audio.sink(48000, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.rational_resampler_xxx_0_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.wxgui_fftsink2_0, 0))    
Beispiel #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        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.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(500e6, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(2, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.baz_delay_0_0 = baz.delay(gr.sizeof_gr_complex * 1, 5)
        self.baz_delay_0 = baz.delay(gr.sizeof_gr_complex * 1, -5)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.baz_delay_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.baz_delay_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.baz_delay_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.baz_delay_0_0, 0))
Beispiel #6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 50000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	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=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, 1000, 1, firdes.WIN_HAMMING, 6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/students/btech/b13236/EE304P/Lab_2/sample_signal", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_0, 0))    
Beispiel #7
0
    def __init__(self, win, sat_name, mode_name):
        gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" SSB",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.trans = trans = 500
        self.sample_rate = sample_rate = 2048000
        self.low_ssb = low_ssb = 200
        self.high_ssb = high_ssb = 2800
        self.decim = decim = 8
        self.agc_decay = agc_decay = 50e-6

        ##################################################
        # Blocks
        ##################################################
        self.fftsink_audio = fftsink2.fft_sink_f(
            win,
            baseband_freq=0,
            y_per_div=5,
            y_divs=10,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=32000,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=None,
            title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")",
            peak_hold=True,
            )

        self.multiply_const_64 = blocks.multiply_const_vff((0.1, ))
        self.complex_to_real = blocks.complex_to_real(1)

        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=32,
            decimation=64,
            taps=None,
            fractional_bw=None,
            )
        self.band_pass_filter = filter.fir_filter_ccc(4, filter.firdes.complex_band_pass(
            1, sample_rate/decim, low_ssb, high_ssb, trans, filter.firdes.WIN_HAMMING, 6.76))
        self.agc = analog.agc2_cc(0.1, agc_decay, 0.9, 1.0)
        
        ##################################################
        # Connections
        ##################################################
        #self.connect(self, (self.gr_throttle_0, 0))

        self.connect(self, (self.band_pass_filter, 0))
        self.connect((self.band_pass_filter, 0), (self.agc, 0))
        self.connect((self.agc, 0), (self.rational_resampler, 0))
        self.connect((self.rational_resampler, 0), (self.complex_to_real, 0))
        self.connect((self.complex_to_real, 0), (self.multiply_const_64, 0))
        self.connect((self.multiply_const_64, 0), (self.fftsink_audio, 0))
        self.connect((self.multiply_const_64, 0), self)
Beispiel #8
0
    def __init__(self, win, sat_name, mode_name):
        gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" SSB",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.trans = trans = 500
        self.sample_rate = sample_rate = 2048000
        self.low_ssb = low_ssb = 200
        self.high_ssb = high_ssb = 2800
        self.decim = decim = 8
        self.agc_decay = agc_decay = 50e-6

        ##################################################
        # Blocks
        ##################################################
        self.fftsink_audio = fftsink2.fft_sink_f(
            win,
            baseband_freq=0,
            y_per_div=5,
            y_divs=10,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=32000,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=None,
            title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")",
            peak_hold=True,
            )

        self.multiply_const_64 = blocks.multiply_const_vff((0.1, ))
        self.complex_to_real = blocks.complex_to_real(1)

        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=32,
            decimation=64,
            taps=None,
            fractional_bw=None,
            )
        self.band_pass_filter = filter.fir_filter_ccc(4, filter.firdes.complex_band_pass(
            1, sample_rate/decim, low_ssb, high_ssb, trans, filter.firdes.WIN_HAMMING, 6.76))
        self.agc = analog.agc2_cc(0.1, agc_decay, 0.9, 1.0)
        
        ##################################################
        # Connections
        ##################################################
        #self.connect(self, (self.gr_throttle_0, 0))

        self.connect(self, (self.band_pass_filter, 0))
        self.connect((self.band_pass_filter, 0), (self.agc, 0))
        self.connect((self.agc, 0), (self.rational_resampler, 0))
        self.connect((self.rational_resampler, 0), (self.complex_to_real, 0))
        self.connect((self.complex_to_real, 0), (self.multiply_const_64, 0))
        self.connect((self.multiply_const_64, 0), (self.fftsink_audio, 0))
        self.connect((self.multiply_const_64, 0), self)
Beispiel #9
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/home/pfb/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.gr_char_to_float_0 = gr.char_to_float()
        self.gr_scrambler_bb_0 = gr.scrambler_bb(0x8A, 0x7F, 7)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_char * 1, samp_rate)
        self.gr_vector_source_x_0 = gr.vector_source_b((0, 0, 0), True, 1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=50,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=30,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=1,
            v_offset=0,
            t_scale=0005,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
        )
        self.Add(self.wxgui_scopesink2_0.win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_scrambler_bb_0, 0), (self.gr_char_to_float_0, 0))
        self.connect((self.gr_char_to_float_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_vector_source_x_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_scrambler_bb_0, 0))
        self.connect((self.gr_char_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 0))
Beispiel #10
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 = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	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=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.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #11
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)

        sample_rate = 122880000
        ampl = 0.1

       # src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 2000000, ampl)
        src = iio.fmcomms_source()
        my_fft = fftsink2.fft_sink_f(panel, title="Spectrum Analyzer", sample_rate=sample_rate, ref_level = 10, y_divs=6)
        self.connect(src, my_fft)
        vbox.Add(my_fft.win, 1, wx.EXPAND)
Beispiel #12
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/home/pfb/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.gr_char_to_float_0 = gr.char_to_float()
		self.gr_scrambler_bb_0 = gr.scrambler_bb(0x8A, 0x7F, 7)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_char*1, samp_rate)
		self.gr_vector_source_x_0 = gr.vector_source_b((0, 0, 0), True, 1)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=50,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=1,
			v_offset=0,
			t_scale=0005,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.Add(self.wxgui_scopesink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_scrambler_bb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_scrambler_bb_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #13
0
	def _build_gui(self, vbox, usrp_rate, audio_rate):

		def _form_set_freq(kv):
			return self.set_freq(kv['freq'])

		if 1:
			self.fft = fftsink2.fft_sink_f (self.panel, title="Post FM Demod",
				fft_size=512, sample_rate=usrp_rate, y_per_div=10, ref_level=0)
			self.connect (self.fm_demod, self.fft)
			vbox.Add (self.fft.win, 4, wx.EXPAND)
		if 0:
			self.scope = scopesink2.scope_sink_f(self.panel, title="RDS timedomain",
				sample_rate=usrp_rate, num_inputs=2)
			self.connect (self.rds_bb_filter, (rds_scope,1))
			self.connect (self.rds_clock, (rds_scope,0))
			vbox.Add(self.scope.win, 4, wx.EXPAND)

		self.rdspanel = rdsPanel(self.msgq, self.panel)
		vbox.Add(self.rdspanel, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 20)

		# control area form at bottom
		self.myform = form.form()

		# 1st line
		hbox = wx.BoxSizer(wx.HORIZONTAL)
		self.myform.btn_down = wx.Button(self.panel, -1, "<<")
		self.myform.btn_down.Bind(wx.EVT_BUTTON, self.Seek_Down)
		hbox.Add(self.myform.btn_down, 0)
		self.myform['freq'] = form.float_field(
			parent=self.panel, sizer=hbox, label="Freq", weight=0,
			callback=self.myform.check_input_and_call(_form_set_freq, self._set_status_msg))
		hbox.Add((5,0), 0)
		self.myform.btn_up = wx.Button(self.panel, -1, ">>")
		self.myform.btn_up.Bind(wx.EVT_BUTTON, self.Seek_Up)
		hbox.Add(self.myform.btn_up, 0)
		self.myform['freq_slider'] = form.quantized_slider_field(
			parent=self.panel, sizer=hbox, weight=3,
			range=(87.5e6, 108e6, 0.1e6), callback=self.set_freq)
		hbox.Add((5,0), 0)
		vbox.Add(hbox, 0, wx.EXPAND)


		# 2nd line
		hbox = wx.BoxSizer(wx.HORIZONTAL)
		hbox.Add((5,0), 0)
		self.myform['volume'] = form.quantized_slider_field(parent=self.panel, sizer=hbox,
			label="Volume", weight=3, range=self.volume_range(), callback=self.set_vol)
		hbox.Add((5,0), 1)
		self.myform['gain'] = form.quantized_slider_field(parent=self.panel, sizer=hbox,
			label="Gain", weight=3, range=self.subdev.gain_range(), callback=self.set_gain)
		hbox.Add((5,0), 0)
		vbox.Add(hbox, 0, wx.EXPAND)
Beispiel #14
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 100

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	dynamic_range=140,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=True,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.mseed_seedlink_f_0 = mseed.seedlink_f("10.0.0.15", 18000, "FR_ILLK:HHZ")
        self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_float*1, "", ""); self.blocks_tag_debug_0.set_display(True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.mseed_seedlink_f_0, 0), (self.blocks_tag_debug_0, 0))    
        self.connect((self.mseed_seedlink_f_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.mseed_seedlink_f_0, 0), (self.wxgui_waterfallsink2_0, 0))    
Beispiel #15
0
    def __init__(self,frame,panel,vbox,argv):
        stdgui2.std_top_block.__init__(self,frame,panel,vbox,argv)
        
        fft = fftsink2.fft_sink_f(panel, title="FFT display", fft_size=512, sample_rate=100000)
        vbox.Add(fft.win,4,wx.EXPAND)
        

        scope = scopesink2.scope_sink_f(panel, title="Oscilloscope", sample_rate=100000)
        vbox.Add(scope.win,4,wx.EXPAND)
        
        signal = gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
        throttle = gr.throttle(gr.sizeof_float,100000)
        self.connect(signal,throttle)
        self.connect(throttle,fft)
        self.connect(throttle,scope)
Beispiel #16
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel

        parser = OptionParser(option_class=eng_option)
        parser.add_option("-W", "--waterfall", action="store_true", default=False,
                          help="Enable waterfall display")
        parser.add_option("-S", "--oscilloscope", action="store_true", default=False,
                          help="Enable oscilloscope display")
        parser.add_option("-I", "--audio-input", type="string", default="",
                          help="pcm input device name.  E.g., hw:0,0 or /dev/dsp")
        parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
                          help="set sample rate to RATE (48000)")

        (options, args) = parser.parse_args()
	sample_rate = int(options.sample_rate)

	if len(args) != 0:
            parser.print_help()
            sys.exit(1)

        self.show_debug_info = True

        # build the graph
        if options.waterfall:
            self.scope = \
              waterfallsink2.waterfall_sink_f (panel, fft_size=1024, sample_rate=sample_rate)
        elif options.oscilloscope:
            self.scope = scopesink2.scope_sink_f(panel, sample_rate=sample_rate)
        else:
            self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30,
					      ref_scale=1.0, ref_level=0, y_divs=12)

	self.src = audio.source (sample_rate, options.audio_input)

        self.connect(self.src, self.scope)

        self._build_gui(vbox)
Beispiel #17
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 = 32000

        ##################################################
        # Blocks
        ##################################################
        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.sinesource_sourceblock_0 = sinesource.sourceblock(1, 100)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.sinesource_sourceblock_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.sinesource_sourceblock_0, 0), (self.blocks_throttle_0, 0))    
Beispiel #18
0
	def _build_gui(self, vbox, usrp_rate, audio_rate):

		def _form_set_freq(kv):
			return self.set_freq(kv['freq'])

		if 1:
			self.fft = fftsink2.fft_sink_f (self.panel, title="Post FM Demod",
				fft_size=512, sample_rate=usrp_rate, y_per_div=10, ref_level=0)
			self.connect (self.fm_demod, self.fft)
			vbox.Add (self.fft.win, 4, wx.EXPAND)
		if 0:
			self.scope = scopesink2.scope_sink_f(self.panel, title="RDS timedomain",
				sample_rate=usrp_rate, num_inputs=2)
			self.connect (self.rds_bb_filter, (rds_scope,1))
			self.connect (self.rds_clock, (rds_scope,0))
			vbox.Add(self.scope.win, 4, wx.EXPAND)

		self.rdspanel = rdsPanel(self.msgq, self.panel)
		vbox.Add(self.rdspanel, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 20)

		# control area form at bottom
		self.myform = form.form()
Beispiel #19
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Sendsinetorh")
        _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 = 32000

        ##################################################
        # Blocks
        ##################################################
        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.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_SAW_WAVE, 500, 2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #20
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.quad_rate = quad_rate = 640000
        self.audio_rate = audio_rate = 40000

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "FM")
        self.n.AddPage(grc_wxgui.Panel(self.n), "FFT")
        self.Add(self.n)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.n.GetPage(0).GetWin(),
        	title="Scope Plot",
        	sample_rate=audio_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.n.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.n.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.n.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=16,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(16, firdes.low_pass(
        	1, quad_rate, 15000, 4000, firdes.WIN_HAMMING, 6.76))
        self.iir_filter_xxx_2 = filter.iir_filter_ffd(([1,0]), ([1,0.95]), True)
        self.iir_filter_xxx_1 = filter.iir_filter_ffd(([1,-0.95]), ([1,0]), True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd((25e-6, ), ([1,1]), True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, audio_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_2 = analog.sig_source_c(quad_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(audio_rate, analog.GR_COS_WAVE, 1100, 0.5, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(audio_rate, analog.GR_COS_WAVE, 11000, .5, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(2*3.14*75000)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, .2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1))    
        self.connect((self.analog_phase_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.iir_filter_xxx_1, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_delay_0, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_multiply_xx_1, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_1, 1))    
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_1, 0))    
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.iir_filter_xxx_2, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.iir_filter_xxx_1, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.iir_filter_xxx_2, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_phase_modulator_fc_0, 0))    
Beispiel #21
0
    def __init__(self,
                 antenna='RX1',
                 audioRate=192000,
                 bandwidth=40E3,
                 centerFrequency=137.1E6,
                 gain=10,
                 outputFile="/results/output.data",
                 samplingRate=1000000):
        grc_wxgui.top_block_gui.__init__(self, title="Receiver for NOAA APT")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.audioRate = audioRate
        self.bandwidth = bandwidth
        self.centerFrequency = centerFrequency
        self.gain = gain
        self.outputFile = outputFile
        self.samplingRate = samplingRate

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FMSignal")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "FMWaterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "DemodSignal")
        self.Add(self.notebook_0)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=centerFrequency,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samplingRate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=audioRate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='AudioOutput',
            peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=centerFrequency,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samplingRate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Apr\xc3\xa8s filtre',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=centerFrequency,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samplingRate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Avant filtre',
            peak_hold=False,
            win=window.hanning,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samplingRate)
        self.uhd_usrp_source_0.set_center_freq(centerFrequency, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna(antenna, 0)
        self.uhd_usrp_source_0.set_bandwidth(bandwidth, 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=192,
            decimation=48,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=audioRate,
            decimation=samplingRate,
            taps=None,
            fractional_bw=None,
        )
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            '/net/e/gtheis/code/Projet_SRT_2018/outputfiles/output', 1,
            audioRate, 8)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_gr_complex * 1,
            '/net/e/gtheis/code/Projet_SRT_2018/outputfiles/outputfile_complex',
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(1, samplingRate, centerFrequency - bandwidth / 2,
                             centerFrequency + bandwidth / 2,
                             bandwidth / 2 / 6, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=audioRate,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.wxgui_fftsink2_0_1, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
Beispiel #22
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))
Beispiel #23
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block Mfsk")
        _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 = 44100

        ##################################################
        # Blocks
        ##################################################
        self.notebook_2 = self.notebook_2 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_2.AddPage(grc_wxgui.Panel(self.notebook_2), "FFT")
        self.notebook_2.AddPage(grc_wxgui.Panel(self.notebook_2), "SCOPE")
        self.Add(self.notebook_2)
        self.notebook_1 = self.notebook_1 = wx.Notebook(
            self.notebook_2.GetPage(0).GetWin(), style=wx.NB_TOP)
        self.notebook_1.AddPage(grc_wxgui.Panel(self.notebook_1), "fftSource")
        self.notebook_1.AddPage(grc_wxgui.Panel(self.notebook_1),
                                "fftDemodulated")
        self.notebook_2.GetPage(0).Add(self.notebook_1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(
            self.notebook_2.GetPage(1).GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "ScopeRx")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "ScopeSource")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "ScopeConstellation")
        self.notebook_2.GetPage(1).Add(self.notebook_0)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=True,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(0).GetWin(),
            title="Scope Plot - Source - Modulated - Demodulated",
            sample_rate=samp_rate,
            v_scale=4,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=3,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook_1.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 Plot Source",
            peak_hold=False,
        )
        self.notebook_1.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook_1.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=30,
            ref_scale=4,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot Demodulated",
            peak_hold=False,
        )
        self.notebook_1.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Constellation Plot Modulated",
            sample_rate=samp_rate,
            frame_rate=5,
            const_size=2048,
            M=4,
            theta=0,
            loop_bw=6.28 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=samp_rate / 4.,
            omega_limit=0.005,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_constellationsink2_0_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Constellation Plot Demodulated",
            sample_rate=samp_rate,
            frame_rate=5,
            const_size=2048,
            M=4,
            theta=0,
            loop_bw=6.28 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=samp_rate / 4.,
            omega_limit=0.005,
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_constellationsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 8000, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_vector_source_x_0_0_0_2 = blocks.vector_source_b(
            (1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0), True, 1, [])
        self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_b(
            (1, 1), True, 1, [])
        self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_b(
            (1, 0), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_b((0, 1),
                                                                   True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_b((0, 0), True,
                                                                 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0 = blocks.sub_cc(1)
        self.blocks_repeat_0_2 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_1_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_1 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_multiply_xx_0_1_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((-1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, ))
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_2 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_1_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_2 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0_1_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 2)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_0_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 100, 1, 0)
        self.analog_sig_source_x_0_0_0_2 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 50, 1, 0)
        self.analog_sig_source_x_0_0_0_1_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate, 1, 0)
        self.analog_sig_source_x_0_0_0_1_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 10, 1, 0)
        self.analog_sig_source_x_0_0_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 25, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(-100)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 3)
        self.analog_const_source_x_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.blocks_sub_xx_1, 1))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1, 0),
                     (self.blocks_multiply_xx_0_1_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1_1, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_2, 0),
                     (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.analog_sig_source_x_0_0_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.wxgui_constellationsink2_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_char_to_float_0_1, 0),
                     (self.blocks_float_to_complex_0_1, 0))
        self.connect((self.blocks_char_to_float_0_1_0, 0),
                     (self.blocks_float_to_complex_0_1_0, 0))
        self.connect((self.blocks_char_to_float_0_1_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_char_to_float_0_2, 0),
                     (self.blocks_float_to_complex_0_2, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 2))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.blocks_float_to_complex_0_1, 0),
                     (self.blocks_multiply_xx_0_1_0_0, 1))
        self.connect((self.blocks_float_to_complex_0_1_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0_2, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_sub_xx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 4))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_xx_0_1_0, 0),
                     (self.blocks_add_xx_0, 3))
        self.connect((self.blocks_multiply_xx_0_1_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_repeat_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_repeat_0_1, 0),
                     (self.blocks_char_to_float_0_1, 0))
        self.connect((self.blocks_repeat_0_1_0, 0),
                     (self.blocks_char_to_float_0_1_0, 0))
        self.connect((self.blocks_repeat_0_2, 0),
                     (self.blocks_char_to_float_0_2, 0))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_sub_xx_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_repeat_0_1, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_0, 0),
                     (self.blocks_repeat_0_2, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_1, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_2, 0),
                     (self.blocks_repeat_0_1_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))
Beispiel #24
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Wideband FM Receiver 1.0")
        _icon_path = "C:\Program Files\GNURadio-3.7\share\icons\hicolor\scalable/apps\gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.gain = gain = 50
        self.fft_size = fft_size = 512
        self.f = f = 106.1e6

        ##################################################
        # Blocks
        ##################################################
        self.notebook0 = self.notebook0 = wx.Notebook(self.GetWin(),
                                                      style=wx.NB_BOTTOM)
        self.notebook0.AddPage(grc_wxgui.Panel(self.notebook0), "RF FFT")
        self.notebook0.AddPage(grc_wxgui.Panel(self.notebook0), "Waterfall")
        self.notebook0.AddPage(grc_wxgui.Panel(self.notebook0), "Audio FFT")
        self.Add(self.notebook0)
        self._fft_size_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.fft_size,
            callback=self.set_fft_size,
            label='FFT Size',
            choices=[512, 1024, 2048, 4096, 8192],
            labels=[],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._fft_size_chooser)
        _f_sizer = wx.BoxSizer(wx.VERTICAL)
        self._f_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_f_sizer,
            value=self.f,
            callback=self.set_f,
            label='f',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._f_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_f_sizer,
            value=self.f,
            callback=self.set_f,
            minimum=88e6,
            maximum=110e6,
            num_steps=220,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_f_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook0.GetPage(1).GetWin(),
            baseband_freq=f,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=fft_size,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.notebook0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.notebook0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=200e3,
            fft_size=2048,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot - Audio',
            peak_hold=False,
            win=window.rectangular,
        )
        self.notebook0.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook0.GetPage(0).GetWin(),
            baseband_freq=f,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=fft_size,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
            win=window.blackmanharris,
        )
        self.notebook0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_clock_source('internal', 0)
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(f, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(1, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(5, 0)
        self.rtlsdr_source_0.set_if_gain(5, 0)
        self.rtlsdr_source_0.set_bb_gain(5, 0)
        self.rtlsdr_source_0.set_antenna('ant0', 0)
        self.rtlsdr_source_0.set_bandwidth(250000, 0)

        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=100,
            decimation=441,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            20,
            firdes.low_pass(1, samp_rate, 100e3, 10e3, firdes.WIN_BLACKMAN,
                            6.76))
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='Gain Control',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self.audio_sink_0 = audio.sink(44100, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=100e3,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
Beispiel #25
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Ettus Fm")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 5e6
		self.freq = freq = 93.5e6

		##################################################
		# Blocks
		##################################################
		self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Spectrum")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Spectrum")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Audio")
		self.Add(self.notebook_0)
		self._freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.freq,
			callback=self.set_freq,
			label='freq',
			converter=forms.float_converter(),
		)
		self.Add(self._freq_text_box)
		self.wxgui_fftsink2_2 = fftsink2.fft_sink_f(
			self.notebook_0.GetPage(2).GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=48e3,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_2.win)
		self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
			self.notebook_0.GetPage(1).GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=250e3,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.notebook_0.GetPage(0).GetWin(),
			baseband_freq=freq,
			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.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
		self.uhd_usrp_source_0 = uhd.usrp_source(
			device_addr="addr=192.168.10.2",
			stream_args=uhd.stream_args(
				cpu_format="fc32",
				channels=range(1),
			),
		)
		self.uhd_usrp_source_0.set_samp_rate(samp_rate)
		self.uhd_usrp_source_0.set_center_freq(freq, 0)
		self.uhd_usrp_source_0.set_gain(25, 0)
		self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
		self.uhd_usrp_source_0.set_bandwidth(200e3, 0)
		self.low_pass_filter_0 = gr.fir_filter_ccf(20, firdes.low_pass(
			1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING, 6.76))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((5, ))
		self.blks2_wfm_rcv_0 = blks2.wfm_rcv(
			quad_rate=250e3,
			audio_decimation=1,
		)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=48,
			decimation=250,
			taps=None,
			fractional_bw=None,
		)
		self.audio_sink_0 = audio.sink(48000, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.blks2_wfm_rcv_0, 0))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_2, 0))
Beispiel #26
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Lesson9")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.freq = freq = 1e3

        ##################################################
        # 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=-50e3,
            maximum=50e3,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            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=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.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #27
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dsbsc")
        _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 = 320000

        ##################################################
        # Blocks
        ##################################################
        self.lab2_part2 = self.lab2_part2 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "scope")
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "fft")
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "fft1")
        self.Add(self.lab2_part2)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
            self.lab2_part2.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=samp_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.lab2_part2.GetPage(0).Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.lab2_part2.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 Plot",
            peak_hold=False,
        )
        self.lab2_part2.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.lab2_part2.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 Plot",
            peak_hold=False,
        )
        self.lab2_part2.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 30000, 100, firdes.WIN_HAMMING,
                            6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((0, ))
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
Beispiel #28
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Rds Tx")
		_icon_path = "/home/azimout/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.usrp_interp = usrp_interp = 500
		self.dac_rate = dac_rate = 128e6
		self.wav_rate = wav_rate = 44100
		self.usrp_rate = usrp_rate = int(dac_rate/usrp_interp)
		self.fm_max_dev = fm_max_dev = 120e3

		##################################################
		# Blocks
		##################################################
		self.band_pass_filter_0 = gr.interp_fir_filter_fff(1, firdes.band_pass(
			1, usrp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_1 = gr.interp_fir_filter_fff(1, firdes.band_pass(
			1, usrp_rate, 23e3, 53e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
			interpolation=usrp_rate,
			decimation=wav_rate,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_1_0 = blks2.rational_resampler_fff(
			interpolation=usrp_rate,
			decimation=wav_rate,
			taps=None,
			fractional_bw=None,
		)
		self.gr_add_xx_0 = gr.add_vff(1)
		self.gr_add_xx_1 = gr.add_vff(1)
		self.gr_char_to_float_0 = gr.char_to_float()
		self.gr_diff_encoder_bb_0 = gr.diff_encoder_bb(2)
		self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*fm_max_dev/usrp_rate)
		self.gr_map_bb_0 = gr.map_bb(([-1,1]))
		self.gr_map_bb_1 = gr.map_bb(([1,2]))
		self.gr_multiply_xx_0 = gr.multiply_vff(1)
		self.gr_multiply_xx_1 = gr.multiply_vff(1)
		self.gr_rds_data_encoder_0 = rds.data_encoder("/media/dimitris/mywork/gr/dimitris/rds/trunk/src/test/rds_data.xml")
		self.gr_rds_rate_enforcer_0 = rds.rate_enforcer(256000)
		self.gr_sig_source_x_0 = gr.sig_source_f(usrp_rate, gr.GR_COS_WAVE, 19e3, 0.3, 0)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_unpack_k_bits_bb_0 = gr.unpack_k_bits_bb(2)
		self.gr_wavfile_source_0 = gr.wavfile_source("/media/dimitris/mywork/gr/dimitris/rds/trunk/src/python/limmenso_stereo.wav", True)
		self.low_pass_filter_0 = gr.interp_fir_filter_fff(1, firdes.low_pass(
			1, usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0_0 = gr.interp_fir_filter_fff(1, firdes.low_pass(
			1, usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.usrp_simple_sink_x_0 = grc_usrp.simple_sink_c(which=0, side="A")
		self.usrp_simple_sink_x_0.set_interp_rate(500)
		self.usrp_simple_sink_x_0.set_frequency(107.2e6, verbose=True)
		self.usrp_simple_sink_x_0.set_gain(0)
		self.usrp_simple_sink_x_0.set_enable(True)
		self.usrp_simple_sink_x_0.set_auto_tr(True)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=20,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=usrp_rate,
			fft_size=1024,
			fft_rate=30,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_rds_rate_enforcer_0, 1))
		self.connect((self.gr_char_to_float_0, 0), (self.gr_rds_rate_enforcer_0, 0))
		self.connect((self.gr_map_bb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_frequency_modulator_fc_0, 0), (self.usrp_simple_sink_x_0, 0))
		self.connect((self.gr_add_xx_1, 0), (self.gr_frequency_modulator_fc_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_add_xx_1, 1))
		self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_1, 2))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 3))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 2))
		self.connect((self.blks2_rational_resampler_xxx_1_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_add_xx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_1_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.gr_wavfile_source_0, 1), (self.blks2_rational_resampler_xxx_1_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
		self.connect((self.gr_rds_data_encoder_0, 0), (self.gr_diff_encoder_bb_0, 0))
		self.connect((self.gr_diff_encoder_bb_0, 0), (self.gr_map_bb_1, 0))
		self.connect((self.gr_map_bb_1, 0), (self.gr_unpack_k_bits_bb_0, 0))
		self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_map_bb_0, 0))
		self.connect((self.gr_rds_rate_enforcer_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 0))
		self.connect((self.gr_multiply_xx_1, 0), (self.band_pass_filter_1, 0))
		self.connect((self.band_pass_filter_1, 0), (self.gr_add_xx_1, 3))
		self.connect((self.gr_add_xx_1, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0_0, 0))
		self.connect((self.low_pass_filter_0_0, 0), (self.gr_add_xx_1, 2))
Beispiel #29
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="Stereo FM receiver and RDS Decoder")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.freq_offset = freq_offset = 250000
        self.freq = freq = 95.8e6
        self.volume = volume = -3
        self.samp_rate = samp_rate = 1e6
        self.gain = gain = 20
        self.freq_tune = freq_tune = freq - freq_offset
        self.capture_base_freq = capture_base_freq = 88e6

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='Volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-20,
            maximum=10,
            num_steps=300,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_volume_sizer, 0, 1, 1, 1)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Demod")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Waterfall")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L+R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L-R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Const")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "x")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "y")
        self.GridAdd(self.nb, 2, 0, 1, 2)
        _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=88e6,
            maximum=108e6,
            num_steps=800,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_freq_sizer, 1, 0, 1, 2)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
            self.nb.GetPage(8).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.nb.GetPage(8).Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
            self.nb.GetPage(2).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=250000,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.nb.GetPage(2).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
            self.nb.GetPage(6).GetWin(),
            title='Scope Plot',
            sample_rate=2375 * 4,
            v_scale=0.4,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=True,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.nb.GetPage(6).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
            self.nb.GetPage(7).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.nb.GetPage(7).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0_0_0_1_0_1 = fftsink2.fft_sink_c(
            self.nb.GetPage(5).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=19000,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='RDS',
            peak_hold=False,
        )
        self.nb.GetPage(5).Add(self.wxgui_fftsink2_0_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_0_1 = fftsink2.fft_sink_f(
            self.nb.GetPage(4).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=48000,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='L-R',
            peak_hold=False,
        )
        self.nb.GetPage(4).Add(self.wxgui_fftsink2_0_0_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(3).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=48000,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='L+R',
            peak_hold=False,
        )
        self.nb.GetPage(3).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=250000,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.8,
            title='FM Demod',
            peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.nb.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=-30,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.8,
            title='Baseband',
            peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(
            2, firdes.root_raised_cosine(1, 19000, 2375, .35, 100))
        self.pfb_arb_resampler_xxx_1 = pfb.arb_resampler_fff(240000.0 / 250000,
                                                             taps=None,
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_1.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(19000 / 250e3,
                                                             taps=None,
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.gr_rds_parser_0 = rds.parser(True, False, 0)
        self.gr_rds_panel_0 = rds.rdsPanel(freq, self.GetWin())
        self.Add(self.gr_rds_panel_0.panel)
        self.gr_rds_decoder_0 = rds.decoder(False, False)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='RF Gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=49.6,
            num_steps=124,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 1)
        self.freq_xlating_fir_filter_xxx_2 = filter.freq_xlating_fir_filter_fcf(
            5, (firdes.low_pass(1.0, 240000, 13e3, 3e3, firdes.WIN_HAMMING)),
            38000, 240000)
        self.freq_xlating_fir_filter_xxx_1_0 = filter.freq_xlating_fir_filter_fcc(
            1,
            (firdes.low_pass(2500.0, 250000, 2.6e3, 2e3, firdes.WIN_HAMMING)),
            57e3, 250000)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 80000, 20000)), freq_offset,
            samp_rate)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(
            5, (firdes.low_pass(1.0, 240000, 13e3, 3e3, firdes.WIN_HAMMING)))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.digital_psk_demod_0 = digital.psk.psk_demod(
            constellation_points=2,
            differential=False,
            samples_per_symbol=4,
            excess_bw=0.35,
            phase_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (10**(1. * (volume) / 10), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (10**(1. * (volume) / 10), ))
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_char * 1, 2)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/deepstar/Projects/OverTheWire/advent2019/advent2019/steven/northpole-airwaves/northpole-airwaves.wav',
            True)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate,
            audio_decimation=int(samp_rate / (250e3)),
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, freq - capture_base_freq, 1, 0)
        self.analog_fm_deemph_0_0_0 = analog.fm_deemph(fs=48000, tau=75e-6)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.gr_rds_decoder_0, 'out'),
                         (self.gr_rds_parser_0, 'in'))
        self.msg_connect((self.gr_rds_parser_0, 'out'),
                         (self.gr_rds_panel_0, 'in'))
        self.connect((self.analog_fm_deemph_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.freq_xlating_fir_filter_xxx_1_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.pfb_arb_resampler_xxx_1, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.analog_fm_deemph_0_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.wxgui_fftsink2_0_0_0_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.audio_sink_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.gr_rds_decoder_0, 0))
        self.connect((self.digital_psk_demod_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_wfm_rcv_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_2, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.wxgui_fftsink2_0_0_0_1_0_1, 0))
        self.connect((self.pfb_arb_resampler_xxx_1, 0),
                     (self.fir_filter_xxx_1, 0))
        self.connect((self.pfb_arb_resampler_xxx_1, 0),
                     (self.freq_xlating_fir_filter_xxx_2, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.digital_psk_demod_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.wxgui_scopesink2_1, 0))
Beispiel #30
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 = 960000

        ##################################################
        # Blocks
        ##################################################
        self.lab2_part4 = self.lab2_part4 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.lab2_part4.AddPage(grc_wxgui.Panel(self.lab2_part4), "scope")
        self.lab2_part4.AddPage(grc_wxgui.Panel(self.lab2_part4), "fft")
        self.Add(self.lab2_part4)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.lab2_part4.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=samp_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.lab2_part4.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.lab2_part4.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 Plot",
            peak_hold=False,
        )
        self.lab2_part4.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.iir_filter_ffd_0 = filter.iir_filter_ffd((1 / 960e3, ), (1, 1),
                                                      True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(471000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.analog_phase_modulator_fc_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.iir_filter_ffd_0, 0),
                     (self.analog_phase_modulator_fc_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.iir_filter_ffd_0, 0))
Beispiel #31
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Stereo FM receiver and RDS Decoder")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.bb_decim = bb_decim = 4
        self.freq_offset = freq_offset = 250000
        self.freq = freq = 106.1e6
        self.baseband_rate = baseband_rate = samp_rate/bb_decim
        self.audio_decim = audio_decim = 5
        self.xlate_bandwidth = xlate_bandwidth = 100000
        self.volume = volume = 0
        self.gain = gain = 37.6
        self.freq_tune = freq_tune = freq - freq_offset
        self.audio_rate = audio_rate = 48000
        self.audio_decim_rate = audio_decim_rate = baseband_rate/audio_decim

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	label="Volume",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._volume_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	minimum=-20,
        	maximum=10,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_volume_sizer, 0, 1, 1, 1)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Demod")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L+R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Pilot")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "DSBSC")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L-R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS constellation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Waterfall")
        self.GridAdd(self.nb, 2, 0, 1, 2)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=49.6,
        	num_steps=124,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 1)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label="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.1e6,
        	maximum=107.9e6,
        	num_steps=99,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_freq_sizer, 1, 0, 1, 2)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
        	self.nb.GetPage(8).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.nb.GetPage(8).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.nb.GetPage(7).GetWin(),
        	title="Scope Plot",
        	sample_rate=2375,
        	v_scale=0.4,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(7).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(3).GetWin(),
        	title="Pilot",
        	sample_rate=baseband_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.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0_0_1_0_1 = fftsink2.fft_sink_c(
        	self.nb.GetPage(5).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="RDS",
        	peak_hold=False,
        )
        self.nb.GetPage(5).Add(self.wxgui_fftsink2_0_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_0_1_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(6).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L-R",
        	peak_hold=False,
        )
        self.nb.GetPage(6).Add(self.wxgui_fftsink2_0_0_0_1_0_0.win)
        self.wxgui_fftsink2_0_0_0_1 = fftsink2.fft_sink_f(
        	self.nb.GetPage(4).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="DSBSC Sub-carrier",
        	peak_hold=False,
        )
        self.nb.GetPage(4).Add(self.wxgui_fftsink2_0_0_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_decim_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L+R",
        	peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="FM Demod",
        	peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="Baseband",
        	peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq_tune, 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(gain, 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.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	1, samp_rate/bb_decim/audio_decim, 2375, 1, 100))
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.gr_rds_parser_0 = rds.parser(False, True)
        self.gr_rds_panel_0 = rds.rdsPanel(freq, self.GetWin())
        self.Add(self.gr_rds_panel_0.panel)
        self.gr_rds_decoder_0 = rds.decoder(False, False)
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_fcc(audio_decim, (firdes.low_pass(2500.0,baseband_rate,2.4e3,2e3,firdes.WIN_HAMMING)), 57e3, baseband_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1, samp_rate, xlate_bandwidth, 100000)), freq_offset, samp_rate)
        self.fir_filter_xxx_5 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,20e3,40e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_5.declare_sample_delay(0)
        self.fir_filter_xxx_3 = filter.fir_filter_fff(1, (firdes.band_pass(1.0,baseband_rate,38e3-13e3,38e3+13e3,3e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_3.declare_sample_delay(0)
        self.fir_filter_xxx_2 = filter.fir_filter_fcc(1, (firdes.complex_band_pass(1.0,baseband_rate,19e3-500,19e3+500,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_2.declare_sample_delay(0)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,13e3,3e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.digital_mpsk_receiver_cc_0 = digital.mpsk_receiver_cc(2, 0, 1*cmath.pi/100.0, -0.06, 0.06, 0.5, 0.05, samp_rate/bb_decim/audio_decim/ 2375.0, 0.001, 0.005)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((10**(1.*(volume+15)/10), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(1.*(volume+15)/10), ))
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_char*1, 2)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=bb_decim,
        )
        self.analog_pll_refout_cc_0 = analog.pll_refout_cc(0.001, 2 * math.pi * (19000+200) / baseband_rate, 2 * math.pi * (19000-200) / baseband_rate)
        self.analog_fm_deemph_0_0_0 = analog.fm_deemph(fs=audio_decim_rate, tau=75e-6)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=audio_decim_rate, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.fir_filter_xxx_1, 0), (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.fir_filter_xxx_3, 0), (self.wxgui_fftsink2_0_0_0_1, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.fir_filter_xxx_5, 0))
        self.connect((self.analog_fm_deemph_0_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.analog_fm_deemph_0_0_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_0_0_0_1_0_0, 0))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.fir_filter_xxx_3, 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.analog_fm_deemph_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_3, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_2, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.analog_pll_refout_cc_0, 0))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.wxgui_fftsink2_0_0_0_1_0_1, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.root_raised_cosine_filter_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0), (self.digital_mpsk_receiver_cc_0, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.gr_rds_decoder_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_null_sink_0, 1))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.gr_rds_decoder_0, "out", self.gr_rds_parser_0, "in")
        self.msg_connect(self.gr_rds_parser_0, "out", self.gr_rds_panel_0, "in")
Beispiel #32
0
    def __init__(self, win, sat_name, mode_name, nbfm = True):
        gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" FM",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.trans_fm = trans_fm = 1500
        self.samp_rate = samp_rate = 2048000
        self.mode = mode = 1
        self.decim = decim = 8

        self.low_pass_filter = filter.fir_filter_ccf(4, filter.firdes.low_pass(
            1, samp_rate/decim, 10000, trans_fm, filter.firdes.WIN_HAMMING, 6.76))

        if nbfm:
            self.fm_demod = analog.fm_demod_cf(
                channel_rate=64000,
                audio_decim=2,
                deviation=5000,
                audio_pass=4500,
                audio_stop=4900,
                gain=1.0,
                tau=75e-6,
                )
        else:
            if mode_name == 'APT':
                self.fm_demod = analog.fm_demod_cf(
                    channel_rate=64000,
                    audio_decim=2,
                    deviation=17000,
                    audio_pass=5300,
                    audio_stop=5500,
                    gain=1.0,
                    tau=75e-6,
                    )
            else:
                self.fm_demod = analog.fm_demod_cf(
                    channel_rate=64000,
                    audio_decim=2,
                    deviation=45000,
                    audio_pass=17000,
                    audio_stop=18000,
                    gain=1.0,
                    tau=75e-6,
                    )

        self.fftsink_audio = fftsink2.fft_sink_f(
            win,
            baseband_freq=0,
            y_per_div=5,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=32000,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=None,
            title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")",
            peak_hold=True,
            )

        self.connect(self, (self.low_pass_filter, 0))
        self.connect((self.low_pass_filter, 0), (self.fm_demod, 0))
        self.connect((self.fm_demod, 0), (self.fftsink_audio, 0))
        self.connect((self.fm_demod, 0), self)
Beispiel #33
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fm Stereo Tx")

        ##################################################
        # Variables
        ##################################################
        self.st_gain = st_gain = 10
        self.samp_rate = samp_rate = 195.312e3
        self.pilot_gain = pilot_gain = 80e-3
        self.mpx_rate = mpx_rate = 160e3
        self.Mono_gain = Mono_gain = 300e-3
        self.FM_freq = FM_freq = 96.5e6

        ##################################################
        # Blocks
        ##################################################
        _st_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._st_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_st_gain_sizer,
            value=self.st_gain,
            callback=self.set_st_gain,
            label='st_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._st_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_st_gain_sizer,
            value=self.st_gain,
            callback=self.set_st_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_st_gain_sizer)
        _pilot_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pilot_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            label='pilot_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._pilot_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_pilot_gain_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FM")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "audio")
        self.Add(self.notebook_0)
        _Mono_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._Mono_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_Mono_gain_sizer,
            value=self.Mono_gain,
            callback=self.set_Mono_gain,
            label='Mono_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._Mono_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_Mono_gain_sizer,
            value=self.Mono_gain,
            callback=self.set_Mono_gain,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_Mono_gain_sizer)
        _FM_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._FM_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_FM_freq_sizer,
            value=self.FM_freq,
            callback=self.set_FM_freq,
            label='FM_freq',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._FM_freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_FM_freq_sizer,
            value=self.FM_freq,
            callback=self.set_FM_freq,
            minimum=88e6,
            maximum=108e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_FM_freq_sizer)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.notebook_0.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 Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=FM_freq,
            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.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="addr=192.168.10.2",
            stream_args=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(FM_freq, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.low_pass(Mono_gain, mpx_rate, 15000, 2000,
                            firdes.WIN_HAMMING, 6.76))
        self.gr_vector_to_streams_0 = gr.vector_to_streams(
            gr.sizeof_short * 1, 2)
        self.gr_sub_xx_0 = gr.sub_ff(1)
        self.gr_sig_source_x_1 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 19000,
                                                 pilot_gain, 0)
        self.gr_sig_source_x_0 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 38000,
                                                 30e-3, 0)
        self.gr_short_to_float_1 = gr.short_to_float(1, 1)
        self.gr_short_to_float_0 = gr.short_to_float(1, 1)
        self.gr_multiply_xx_0 = gr.multiply_vff(1)
        self.gr_multiply_const_vxx_2 = gr.multiply_const_vcc((32.768e3, ))
        self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((30e-6, ))
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((30e-6, ))
        self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(980e-3)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_short * 2,
            "/home/kranthi/Documents/project/FM Transceiver/FM Transmitter/test.raw",
            True)
        self.gr_add_xx_1 = gr.add_vff(1)
        self.gr_add_xx_0 = gr.add_vff(1)
        self.blks2_rational_resampler_xxx_2 = blks2.rational_resampler_fff(
            interpolation=4,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
            interpolation=5,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=5,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_fm_preemph_0 = blks2.fm_preemph(fs=mpx_rate, tau=50e-6)
        self.band_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.band_pass(st_gain, mpx_rate, 23000, 53000, 2000,
                             firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0),
                     (self.gr_vector_to_streams_0, 0))
        self.connect((self.gr_vector_to_streams_0, 0),
                     (self.gr_short_to_float_0, 0))
        self.connect((self.gr_vector_to_streams_0, 1),
                     (self.gr_short_to_float_1, 0))
        self.connect((self.gr_short_to_float_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_short_to_float_1, 0),
                     (self.gr_multiply_const_vxx_1, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.gr_multiply_const_vxx_1, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.gr_add_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.gr_sub_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_sub_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_add_xx_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_0, 1))
        self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.gr_sig_source_x_1, 0), (self.gr_add_xx_1, 0))
        self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 1))
        self.connect((self.low_pass_filter_0, 0), (self.gr_add_xx_1, 2))
        self.connect((self.gr_add_xx_1, 0), (self.blks2_fm_preemph_0, 0))
        self.connect((self.blks2_fm_preemph_0, 0),
                     (self.blks2_rational_resampler_xxx_2, 0))
        self.connect((self.blks2_rational_resampler_xxx_2, 0),
                     (self.gr_frequency_modulator_fc_0, 0))
        self.connect((self.gr_frequency_modulator_fc_0, 0),
                     (self.gr_multiply_const_vxx_2, 0))
        self.connect((self.gr_multiply_const_vxx_2, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.gr_multiply_const_vxx_2, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_multiply_const_vxx_1, 0),
                     (self.wxgui_fftsink2_1, 0))
Beispiel #34
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fm Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.transition = transition = 1e6
        self.samp_rate = samp_rate = 1.6e6
        self.quadrature = quadrature = 500e3
        self.freq_2 = freq_2 = 70e6
        self.freq = freq = 97.7e6
        self.cutoff = cutoff = 100e3

        ##################################################
        # 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=65e6,
            maximum=110e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='RAW FFT Plot',
            peak_hold=False,
            size=(100, 200),
        )
        self.Add(self.wxgui_fftsink2_1.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=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.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 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(20, 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.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=441,
            decimation=5000,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(samp_rate / quadrature),
            firdes.low_pass(1, samp_rate, cutoff, transition,
                            firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(44100, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=500e3,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_1, 0))
Beispiel #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Stereo Receiver")

        ##################################################
        # Variables
        ##################################################
        self.smux_filt_samprate = smux_filt_samprate = 256e3
        self.smux_decim = smux_decim = 8
        self.samp_rate = samp_rate = 2.048e6
        self.right_gain = right_gain = 3
        self.left_gain = left_gain = 3
        self.bpf_base = bpf_base = 23e3
        self.RF_Gain = RF_Gain = 45
        self.CF = CF = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.samp_rate,
        	callback=self.set_samp_rate,
        	label="Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._samp_rate_text_box, 1, 0, 1, 1)
        _right_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._right_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	label="R Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._right_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_right_gain_sizer, 0, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "BB Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Signal")
        self.GridAdd(self.notebook_0, 2, 0, 1, 2)
        _left_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._left_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	label="L Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._left_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_left_gain_sizer, 0, 0, 1, 1)
        _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_Gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._RF_Gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	minimum=0,
        	maximum=100,
        	num_steps=45,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 1, 1, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Baseband Waterfall",
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 3, 0, 1, 2)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.notebook_0.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=32e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=(800,500),
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Difference FFT ",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate/8,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Demodulated FFT",
        	peak_hold=False,
        	size=(800,800),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.notebook_0.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="Baseband FFT",
        	peak_hold=False,
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_fftsink2_0_0.win, 2, 0, 1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Sum FFT",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.rfgain = blocks.multiply_const_vcc((RF_Gain, ))
        self.low_pass_filter_1_0 = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_HAMMING, 1))
        self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass(
        	2, samp_rate/4, 100e3, 500, firdes.WIN_KAISER, 6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ccf((-0.00266, 0.00504, -0.00309, -0.00136, 0.00663, -0.01052, 0.01103, -0.00731, 0.00016, 0.00800, -0.01396, 0.01490, -0.00971, -0.00035, 0.01173, -0.01979, 0.02054, -0.01240, -0.00273, 0.01960, -0.03122, 0.03124, -0.01669, -0.01017, 0.04137, -0.06448, 0.06476, -0.02634, -0.07449, 0.33571, -0.00000, -0.33571, 0.07449, 0.02634, -0.06476, 0.06448, -0.04137, 0.01017, 0.01669, -0.03124, 0.03122, -0.01960, 0.00273, 0.01240, -0.02054, 0.01979, -0.01173, 0.00035, 0.00971, -0.01490, 0.01396, -0.00800, -0.00016, 0.00731, -0.01103, 0.01052, -0.00663, 0.00136, 0.00309, -0.00504, 0.00266
        ), (1 , ), False)
        self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(4, (1,1,1,1))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((right_gain, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((left_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/Users/bretttt/iCloud_drive/16S/engs110/project/radio_dat/IQ_Data_STEREO1", True)
        self.blocks_divide_xx_1 = blocks.divide_cc(1)
        self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex*1, 30)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.1, ))
        self.baseband_LPF = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass(
        	1, smux_filt_samprate, 18000, 20000, 1000, firdes.WIN_KAISER, 1))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, smux_filt_samprate, bpf_base, bpf_base+30e3, 500, firdes.WIN_KAISER, 6.76))
        self.audio_sink_0_0_0_0 = audio.sink(32000, "", True)
        self.analog_pll_refout_cc_0_0 = analog.pll_refout_cc(3.14/100, 0.152*3.14, 0.144*3.14)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        _CF_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CF_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	label="Center Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._CF_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	minimum=80e6,
        	maximum=108e6,
        	num_steps=280,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_CF_sizer, 3, 0, 1, 2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.analog_fm_deemph_0, 0), (self.audio_sink_0_0_0_0, 0))    
        self.connect((self.analog_fm_deemph_0_0, 0), (self.audio_sink_0_0_0_0, 1))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 0))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 1))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.band_pass_filter_0_0_0, 0), (self.analog_pll_refout_cc_0_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_divide_xx_1, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0_0_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.baseband_LPF, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.wxgui_fftsink2_0_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_delay_2, 0), (self.blocks_multiply_conjugate_cc_0, 1))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_delay_2, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_file_source_0_0, 0), (self.rfgain, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_imag_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_fm_deemph_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.analog_fm_deemph_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_fftsink2_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_scopesink2_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_1_0, 0))    
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.fir_filter_xxx_0_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_divide_xx_1, 0))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.rfgain, 0), (self.blocks_throttle_0, 0))    
Beispiel #36
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Lesson 3 - FM Rx")
        _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 = 4e6
        self.rx_gain = rx_gain = 15
        self.lpf_decim = lpf_decim = 20
        self.freq = freq = 90.1e6
        self.audio_samp_rate = audio_samp_rate = 96e3

        ##################################################
        # Blocks
        ##################################################
        _rx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rx_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rx_gain_sizer,
            value=self.rx_gain,
            callback=self.set_rx_gain,
            label='rx_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rx_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rx_gain_sizer,
            value=self.rx_gain,
            callback=self.set_rx_gain,
            minimum=0,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rx_gain_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Audio")
        self.Add(self.notebook_0)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label='freq',
            converter=forms.float_converter(),
        )
        self.Add(self._freq_text_box)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / lpf_decim,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=freq,
            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.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            lpf_decim,
            firdes.low_pass(1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                            6.76))
        self.gr_wavfile_sink_0 = blocks.wavfile_sink("fm_record.wav", 1,
                                                     int(audio_samp_rate), 8)
        self.blks2_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate / lpf_decim,
            audio_decimation=1,
        )
        self.blks2_rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=96,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.audio_sink_0 = audio.sink(int(audio_samp_rate), "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.gr_wavfile_sink_0, 0))
        self.connect((self.blks2_wfm_rcv_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.blks2_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blks2_wfm_rcv_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #37
0
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        if 1:
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP",
                                               fft_size=512,
                                               sample_rate=usrp_rate,
                                               ref_scale=32768.0,
                                               ref_level=0,
                                               y_divs=12)
            self.connect(self.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)

        if 1:
            post_fm_demod_fft = fftsink2.fft_sink_f(self.panel,
                                                    title="Post FM Demod",
                                                    fft_size=512,
                                                    sample_rate=demod_rate,
                                                    y_per_div=10,
                                                    ref_level=0)
            self.connect(self.guts.fm_demod, post_fm_demod_fft)
            vbox.Add(post_fm_demod_fft.win, 4, wx.EXPAND)

        if 0:
            post_stereo_carrier_generator_fft = fftsink2.fft_sink_c(
                self.panel,
                title="Post Stereo_carrier_generator",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0)
            self.connect(self.guts.stereo_carrier_generator,
                         post_stereo_carrier_generator_fft)
            vbox.Add(post_stereo_carrier_generator_fft.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_left = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Left",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0)
            self.connect(self.guts.deemph_Left, post_deemphasis_left)
            vbox.Add(post_deemphasis_left.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_right = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Right",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=-20)
            self.connect(self.guts.deemph_Left, post_deemphasis_right)
            vbox.Add(post_deemphasis_right.win, 4, wx.EXPAND)

        if 0:
            LmR_fft = fftsink2.fft_sink_f(self.panel,
                                          title="LmR",
                                          fft_size=512,
                                          sample_rate=audio_rate,
                                          y_per_div=10,
                                          ref_level=-20)
            self.connect(self.guts.LmR_real, LmR_fft)
            vbox.Add(LmR_fft.win, 4, wx.EXPAND)

        if 0:
            self.scope = scopesink2.scope_sink_f(self.panel,
                                                 sample_rate=demod_rate)
            self.connect(self.guts.fm_demod, self.scope)
            vbox.Add(self.scope.win, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform['freq'] = form.float_field(parent=self.panel,
                                          sizer=hbox,
                                          label="Freq",
                                          weight=1,
                                          callback=myform.check_input_and_call(
                                              _form_set_freq,
                                              self._set_status_msg))

        hbox.Add((5, 0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(self.fm_freq_min, self.fm_freq_max, 0.1e6),
                                        callback=self.set_freq)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5, 0), 1)

        g = self.u.get_gain_range()
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_gain)
        hbox.Add((5, 0), 0)

        myform['sqlch_thrsh'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Stereo Squelch Threshold",
                                        weight=3, range=(0.0,1.0,0.01),
                                        callback=self.set_squelch)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #38
0
    def _build_gui(self, vbox, no_gui):

        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])


        self.src_fft = None
        if 0 and not(no_gui):
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP",
                                               fft_size=512,
                                               sample_rate=self.rxpath.if_rate,
                                               ref_scale=32768.0,
                                               ref_level=0,
                                               y_per_div=10,
                                               y_divs=12)
            self.connect (self.rxpath.u, self.src_fft)
            vbox.Add (self.src_fft.win, 4, wx.EXPAND)
        if 1 and not(no_gui):
            rx_fft = fftsink2.fft_sink_c(self.panel,
                                         title="Post s/w Resampling",
                                         fft_size=512,
                                         sample_rate=self.rxpath.quad_rate,
                                         ref_level=80,
                                         y_per_div=20)
            self.connect (self.rxpath.resamp, rx_fft)
            vbox.Add (rx_fft.win, 4, wx.EXPAND)
        
        if 1 and not(no_gui):
            post_deemph_fft = fftsink2.fft_sink_f(self.panel,
                                                  title="Post Deemph",
                                                  fft_size=512,
                                                  sample_rate=self.rxpath.audio_rate,
                                                  y_per_div=10,
                                                  ref_level=-40)
            self.connect (self.rxpath.fmrx.deemph, post_deemph_fft)
            vbox.Add (post_deemph_fft.win, 4, wx.EXPAND)

        if 0:
            post_filt_fft = fftsink2.fft_sink_f(self.panel,
                                                title="Post Filter", 
                                                fft_size=512,
                                                sample_rate=audio_rate,
                                                y_per_div=10,
                                                ref_level=-40)
            self.connect (self.guts.audio_filter, post_filt)
            vbox.Add (fft_win4, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)
        myform['freq'] = form.float_field(
            parent=self.panel, sizer=hbox, label="Freq", weight=1,
            callback=myform.check_input_and_call(_form_set_freq,
                                                 self._set_status_msg))

        #hbox.Add((5,0), 0)
        #myform['freq_slider'] = \
        #    form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
        #                                range=(87.9e6, 108.1e6, 0.1e6),
        #                                callback=self.set_freq)

        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_volume)
        hbox.Add((5,0), 0)
        myform['squelch'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Squelch",
                                        weight=3, range=self.rxpath.squelch_range(),
                                        callback=self.set_squelch)
        g = self.rxpath.u.get_gain_range()
        hbox.Add((5,0), 0)
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_gain)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #39
0
    def __init__(self,file_name):
        grc_wxgui.top_block_gui.__init__(self, title="Test")
        _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 = 10e6
        self.freq = freq = 93.5e6

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Specturm")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Spectrum")
        self.Add(self.notebook_0)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label='freq',
        	converter=forms.float_converter(),
        )
        self.Add(self._freq_text_box)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=500e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot (Demod)",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	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 (RF)",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(15, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=96,
                decimation=500,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(20, firdes.low_pass(
        	1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING, 6.76))
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
        	sample_rate=samp_rate,
        	fft_size=1024,
        	ref_scale=2,
        	frame_rate=15,
        	avg_alpha=0.133333,
        	average=True,
        )
        save_file_name = "/home/xi/fm_location/data/"+file_name+".dat"
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1024, save_file_name, False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.audio_sink_0 = audio.sink(96000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=500e3,
        	audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.logpwrfft_x_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.logpwrfft_x_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #40
0
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):

        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])


        if 1:
            self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP2",
                                               fft_size=512, sample_rate=usrp_rate,
					       ref_scale=1.0, ref_level=0, y_divs=12)
            self.connect (self.u, self.src_fft)
            vbox.Add (self.src_fft.win, 4, wx.EXPAND)

        if 1:
            post_filt_fft = fftsink2.fft_sink_f(self.panel, title="Post Demod", 
                                                fft_size=1024, sample_rate=usrp_rate,
                                                y_per_div=10, ref_level=0)
            self.connect (self.guts.fm_demod, post_filt_fft)
            vbox.Add (post_filt_fft.win, 4, wx.EXPAND)

        if 0:
            post_deemph_fft = fftsink2.fft_sink_f(self.panel, title="Post Deemph",
                                                  fft_size=512, sample_rate=audio_rate,
                                                  y_per_div=10, ref_level=-20)
            self.connect (self.guts.deemph, post_deemph_fft)
            vbox.Add (post_deemph_fft.win, 4, wx.EXPAND)

        
        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)
        myform['freq'] = form.float_field(
            parent=self.panel, sizer=hbox, label="Freq", weight=1,
            callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg))

        hbox.Add((5,0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(87.9e6, 108.1e6, 0.1e6),
                                        callback=self.set_freq)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5,0), 1)

        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=self.u.gain_range(),
                                        callback=self.set_gain)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button)
        except:
            pass
Beispiel #41
0
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        if 1:
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP2",
                                               fft_size=512,
                                               sample_rate=usrp_rate,
                                               ref_scale=1.0,
                                               ref_level=0,
                                               y_divs=12)
            self.connect(self.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)

        if 1:
            post_filt_fft = fftsink2.fft_sink_f(self.panel,
                                                title="Post Demod",
                                                fft_size=1024,
                                                sample_rate=usrp_rate,
                                                y_per_div=10,
                                                ref_level=0)
            self.connect(self.guts.fm_demod, post_filt_fft)
            vbox.Add(post_filt_fft.win, 4, wx.EXPAND)

        if 0:
            post_deemph_fft = fftsink2.fft_sink_f(self.panel,
                                                  title="Post Deemph",
                                                  fft_size=512,
                                                  sample_rate=audio_rate,
                                                  y_per_div=10,
                                                  ref_level=-20)
            self.connect(self.guts.deemph, post_deemph_fft)
            vbox.Add(post_deemph_fft.win, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform['freq'] = form.float_field(parent=self.panel,
                                          sizer=hbox,
                                          label="Freq",
                                          weight=1,
                                          callback=myform.check_input_and_call(
                                              _form_set_freq,
                                              self._set_status_msg))

        hbox.Add((5, 0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(87.9e6, 108.1e6, 0.1e6),
                                        callback=self.set_freq)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5, 0), 1)

        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=self.u.gain_range(),
                                        callback=self.set_gain)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            pass
Beispiel #42
0
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):

        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])


        if 0:
            self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
                                               fft_size=512, sample_rate=usrp_rate,
					       ref_scale=32768.0, ref_level=0.0, y_divs=12)
            self.connect (self.u, self.src_fft)
            vbox.Add (self.src_fft.win, 4, wx.EXPAND)

        if 0:
            self.post_filt_fft = fftsink2.fft_sink_c(self.panel, title="Post Channel filter",
                                               fft_size=512, sample_rate=demod_rate)
            self.connect (self.chan_filt, self.post_filt_fft)
            vbox.Add (self.post_filt_fft.win, 4, wx.EXPAND)

        if 0:
            post_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post Demod",
                                                fft_size=1024, sample_rate=demod_rate,
                                                y_per_div=10, ref_level=0)
            self.connect (self.am_demod, post_demod_fft)
            vbox.Add (post_demod_fft.win, 4, wx.EXPAND)

        if 1:
            audio_fft = fftsink2.fft_sink_f(self.panel, title="Audio",
                                                  fft_size=512, sample_rate=audio_rate,
                                                  y_per_div=10, ref_level=20)
            self.connect (self.audio_filt, audio_fft)
            vbox.Add (audio_fft.win, 4, wx.EXPAND)


        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)
        myform['freq'] = form.float_field(
            parent=self.panel, sizer=hbox, label="Freq", weight=1,
            callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg))

        hbox.Add((5,0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(520.0e3, 1611.0e3, 1.0e3),
                                        callback=self.set_freq)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5,0), 1)

        g = self.u.get_gain_range()
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_gain)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #43
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fm Receiver")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8e6
        self.frequency = frequency = 981e5
        self.filter_width = filter_width = 200e3

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Raw")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "After Demoduation")
        self.Add(self.notebook_0)
        _frequency_sizer = wx.BoxSizer(wx.VERTICAL)
        self._frequency_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_frequency_sizer,
            value=self.frequency,
            callback=self.set_frequency,
            label='frequency',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._frequency_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_frequency_sizer,
            value=self.frequency,
            callback=self.set_frequency,
            minimum=90e6,
            maximum=108e6,
            num_steps=100,
            style=wx.SL_VERTICAL,
            cast=float,
            proportion=1,
        )
        self.Add(_frequency_sizer)
        _filter_width_sizer = wx.BoxSizer(wx.VERTICAL)
        self._filter_width_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_filter_width_sizer,
            value=self.filter_width,
            callback=self.set_filter_width,
            label='filter_width',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._filter_width_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_filter_width_sizer,
            value=self.filter_width,
            callback=self.set_filter_width,
            minimum=50e3,
            maximum=400e3,
            num_steps=100,
            style=wx.SL_VERTICAL,
            cast=float,
            proportion=1,
        )
        self.Add(_filter_width_sizer)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=250e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=1015e5,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=500,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=400,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(frequency, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(20, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            20,
            firdes.low_pass(1, samp_rate, filter_width, 10e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            "/Users/myla/SDR/FM Reciever/fm2.wav", 1, 48000, 8)
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=250e3,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
Beispiel #44
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5e6
        self.freqScan = freqScan = 100.5e6
        self.freqC = freqC = 100.5e6
        self.fftSize = fftSize = 512
        self.decimation = decimation = 20

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Waterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod")
        self.Add(self.notebook_0)
        _freqC_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freqC_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freqC_sizer,
        	value=self.freqC,
        	callback=self.set_freqC,
        	label='freqC',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freqC_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freqC_sizer,
        	value=self.freqC,
        	callback=self.set_freqC,
        	minimum=87.7e6,
        	maximum=107.7e6,
        	num_steps=int((107.7-87.7)*10/2.0+1),
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freqC_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=freqC,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=fftSize,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
        	self.notebook_0.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 Plot",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=freqC,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=fftSize,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freqC, 0)
        self.uhd_usrp_source_0.set_gain(25, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=int(48e3),
                decimation=int(samp_rate/decimation),
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(decimation, firdes.low_pass(
        	1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING, 6.76))
        _freqScan_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freqScan_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freqScan_sizer,
        	value=self.freqScan,
        	callback=self.set_freqScan,
        	label='freqScan',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freqScan_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freqScan_sizer,
        	value=self.freqScan,
        	callback=self.set_freqScan,
        	minimum=87.7e6,
        	maximum=107.7e6,
        	num_steps=int((107.7-87.7)*10/2.0+1),
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freqScan_sizer)
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate/decimation,
        	audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_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 = 48000
        self.seed = seed = 128
        self.m_rate = m_rate = 0.8
        self.if_rate = if_rate = samp_rate * 40
        self.gauss = gauss = 0
        self.fc = fc = 511e3
        self.dpp = dpp = 100.0

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_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_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=if_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.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_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.channels_fading_model_0 = channels.fading_model(
            8, dpp / if_rate, False, 2, 256)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/media/akio/ssd1/fading_generator/5-263831-B-6.wav', True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (m_rate, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 8e3, fc + 8e3, 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_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_agc_xx_0 = analog.agc_cc(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc_xx_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.band_pass_filter_0, 0), (self.analog_agc_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.hilbert_fc_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))
        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.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))
Beispiel #46
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Non Linear Junction Detector")

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = -19
        self.variable_check_box_0 = variable_check_box_0 = 0
        self.samp_rate = samp_rate = 4000000
        self.demod_rate = demod_rate = 40000
        self.audio_rate = audio_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        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=audio_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)
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-20,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self._variable_check_box_0_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.variable_check_box_0,
            callback=self.set_variable_check_box_0,
            label='rf_on_off',
            true=60,
            false=0,
        )
        self.Add(self._variable_check_box_0_check_box)
        self.sdr_source_0 = sdr.source({}, "CF32", ([0]), {})
        self.sdr_source_0.set_samp_rate(samp_rate)
        self.sdr_source_0.set_center_freq(999000000, 0)
        self.sdr_source_0.set_gain(10, 0)
        self.sdr_sink_0 = sdr.sink({}, "CF32", ([0]), {})
        self.sdr_sink_0.set_samp_rate(samp_rate)
        self.sdr_sink_0.set_center_freq(5875000000, 0)
        self.sdr_sink_0.set_gain(0, 0)
        self.sdr_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=40,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(
            100,
            firdes.low_pass(3, samp_rate, 10000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.high_pass(2, demod_rate, 100, 50, firdes.WIN_HANN, 6.76))
        self.fosphor_wx_sink_c_0 = fosphor.wx_sink_c(self.GetWin())
        self.fosphor_wx_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_wx_sink_c_0.set_frequency_range(999000000, samp_rate)
        self.Add(self.fosphor_wx_sink_c_0.win)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_abs_xx_0 = blocks.abs_ii(1)
        self.audio_sink_0 = audio.sink(audio_rate, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, -1000000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            100000, analog.GR_COS_WAVE, 0, 2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_abs_xx_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.sdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.high_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_abs_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.sdr_source_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.sdr_source_0, 0), (self.fosphor_wx_sink_c_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 = 1e6
        self.m = m = 50
        self.kf = kf = 17
        self.fm = fm = 1.1e3

        ##################################################
        # Blocks
        ##################################################
        _kf_sizer = wx.BoxSizer(wx.VERTICAL)
        self._kf_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_kf_sizer,
        	value=self.kf,
        	callback=self.set_kf,
        	label='kf',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._kf_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_kf_sizer,
        	value=self.kf,
        	callback=self.set_kf,
        	minimum=0,
        	maximum=25,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_kf_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	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=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.message_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 11e3, 0.5, 0)
        self.message = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1.1e3, 0.5, 0)
        _m_sizer = wx.BoxSizer(wx.VERTICAL)
        self._m_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_m_sizer,
        	value=self.m,
        	callback=self.set_m,
        	label='m',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._m_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_m_sizer,
        	value=self.m,
        	callback=self.set_m,
        	minimum=1,
        	maximum=80,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_m_sizer)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd(([1.0/samp_rate]), ([1,1]), True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        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((10e3, ))
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 100e3, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(kf)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1))    
        self.connect((self.analog_phase_modulator_fc_0, 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.blocks_add_xx_0, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_delay_0, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.blocks_complex_to_arg_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_complex_to_arg_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_phase_modulator_fc_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_complex_to_arg_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_1, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.message, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.message_0, 0), (self.blocks_add_xx_0, 1))    
Beispiel #48
0
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        if 0:
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP",
                                               fft_size=512,
                                               sample_rate=usrp_rate,
                                               ref_scale=32768.0,
                                               ref_level=0.0,
                                               y_divs=12)
            self.connect(self.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)

        if 0:
            self.post_filt_fft = fftsink2.fft_sink_c(
                self.panel,
                title="Post Channel filter",
                fft_size=512,
                sample_rate=demod_rate)
            self.connect(self.chan_filt, self.post_filt_fft)
            vbox.Add(self.post_filt_fft.win, 4, wx.EXPAND)

        if 0:
            post_demod_fft = fftsink2.fft_sink_f(self.panel,
                                                 title="Post Demod",
                                                 fft_size=1024,
                                                 sample_rate=demod_rate,
                                                 y_per_div=10,
                                                 ref_level=0)
            self.connect(self.am_demod, post_demod_fft)
            vbox.Add(post_demod_fft.win, 4, wx.EXPAND)

        if 1:
            audio_fft = fftsink2.fft_sink_f(self.panel,
                                            title="Audio",
                                            fft_size=512,
                                            sample_rate=audio_rate,
                                            y_per_div=10,
                                            ref_level=20)
            self.connect(self.audio_filt, audio_fft)
            vbox.Add(audio_fft.win, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform['freq'] = form.float_field(parent=self.panel,
                                          sizer=hbox,
                                          label="Freq",
                                          weight=1,
                                          callback=myform.check_input_and_call(
                                              _form_set_freq,
                                              self._set_status_msg))

        hbox.Add((5, 0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(520.0e3, 1611.0e3, 1.0e3),
                                        callback=self.set_freq)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5, 0), 1)

        g = self.u.get_gain_range()
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_gain)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv["freq"])

        if 1:
            self.src_fft = fftsink2.fft_sink_c(
                self.panel,
                title="Data from USRP",
                fft_size=512,
                sample_rate=usrp_rate,
                ref_scale=32768.0,
                ref_level=0,
                y_divs=12,
            )
            self.connect(self.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)

        if 1:
            post_fm_demod_fft = fftsink2.fft_sink_f(
                self.panel, title="Post FM Demod", fft_size=512, sample_rate=demod_rate, y_per_div=10, ref_level=0
            )
            self.connect(self.guts.fm_demod, post_fm_demod_fft)
            vbox.Add(post_fm_demod_fft.win, 4, wx.EXPAND)

        if 0:
            post_stereo_carrier_generator_fft = fftsink2.fft_sink_c(
                self.panel,
                title="Post Stereo_carrier_generator",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0,
            )
            self.connect(self.guts.stereo_carrier_generator, post_stereo_carrier_generator_fft)
            vbox.Add(post_stereo_carrier_generator_fft.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_left = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Left",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0,
            )
            self.connect(self.guts.deemph_Left, post_deemphasis_left)
            vbox.Add(post_deemphasis_left.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_right = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Right",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=-20,
            )
            self.connect(self.guts.deemph_Left, post_deemphasis_right)
            vbox.Add(post_deemphasis_right.win, 4, wx.EXPAND)

        if 0:
            LmR_fft = fftsink2.fft_sink_f(
                self.panel, title="LmR", fft_size=512, sample_rate=audio_rate, y_per_div=10, ref_level=-20
            )
            self.connect(self.guts.LmR_real, LmR_fft)
            vbox.Add(LmR_fft.win, 4, wx.EXPAND)

        if 0:
            self.scope = scopesink2.scope_sink_f(self.panel, sample_rate=demod_rate)
            self.connect(self.guts.fm_demod_a, self.scope)
            vbox.Add(self.scope.win, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform["freq"] = form.float_field(
            parent=self.panel,
            sizer=hbox,
            label="Freq",
            weight=1,
            callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg),
        )

        hbox.Add((5, 0), 0)
        myform["freq_slider"] = form.quantized_slider_field(
            parent=self.panel, sizer=hbox, weight=3, range=(87.9e6, 108.1e6, 0.1e6), callback=self.set_freq
        )
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform["volume"] = form.quantized_slider_field(
            parent=self.panel, sizer=hbox, label="Volume", weight=3, range=self.volume_range(), callback=self.set_vol
        )
        hbox.Add((5, 0), 1)

        myform["gain"] = form.quantized_slider_field(
            parent=self.panel,
            sizer=hbox,
            label="Gain",
            weight=3,
            range=self.subdev.gain_range(),
            callback=self.set_gain,
        )
        hbox.Add((5, 0), 0)

        myform["sqlch_thrsh"] = form.quantized_slider_field(
            parent=self.panel,
            sizer=hbox,
            label="Stereo Squelch Threshold",
            weight=3,
            range=(0.0, 1.0, 0.01),
            callback=self.set_squelch,
        )
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #50
0
    def _build_gui(self, vbox, no_gui):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        self.src_fft = None
        if 1 and not (no_gui):
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP",
                                               fft_size=512,
                                               sample_rate=self.rxpath.if_rate,
                                               ref_scale=32768.0,
                                               ref_level=0,
                                               y_per_div=10,
                                               y_divs=12)
            self.connect(self.rxpath.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)
        if 1 and not (no_gui):
            rx_fft = fftsink2.fft_sink_c(self.panel,
                                         title="Post s/w DDC",
                                         fft_size=512,
                                         sample_rate=self.rxpath.quad_rate,
                                         ref_level=80,
                                         y_per_div=20)
            self.connect(self.rxpath.ddc, rx_fft)
            vbox.Add(rx_fft.win, 4, wx.EXPAND)

        if 1 and not (no_gui):
            post_deemph_fft = fftsink2.fft_sink_f(
                self.panel,
                title="Post Deemph",
                fft_size=512,
                sample_rate=self.rxpath.audio_rate,
                y_per_div=10,
                ref_level=-40)
            self.connect(self.rxpath.fmrx.deemph, post_deemph_fft)
            vbox.Add(post_deemph_fft.win, 4, wx.EXPAND)

        if 0:
            post_filt_fft = fftsink2.fft_sink_f(self.panel,
                                                title="Post Filter",
                                                fft_size=512,
                                                sample_rate=audio_rate,
                                                y_per_div=10,
                                                ref_level=-40)
            self.connect(self.guts.audio_filter, post_filt)
            vbox.Add(fft_win4, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform['freq'] = form.float_field(parent=self.panel,
                                          sizer=hbox,
                                          label="Freq",
                                          weight=1,
                                          callback=myform.check_input_and_call(
                                              _form_set_freq,
                                              self._set_status_msg))

        #hbox.Add((5,0), 0)
        #myform['freq_slider'] = \
        #    form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
        #                                range=(87.9e6, 108.1e6, 0.1e6),
        #                                callback=self.set_freq)

        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_volume)
        hbox.Add((5, 0), 0)
        myform['squelch'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Squelch",
                                        weight=3, range=self.rxpath.squelch_range(),
                                        callback=self.set_squelch)
        hbox.Add((5, 0), 0)
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=self.rxpath.subdev.gain_range(),
                                        callback=self.set_gain)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #51
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "FFT")
        self.n.AddPage(grc_wxgui.Panel(self.n), "Time")
        self.Add(self.n)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.n.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_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.n.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_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 Plot",
        	peak_hold=False,
        )
        self.n.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.hilbert_fc_0 = filter.hilbert_fc(10000, firdes.WIN_HAMMING, 6.76)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_2 = blocks.add_vff(1)
        self.analog_sig_source_x_0_2 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_TRI_WAVE, 500, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_2, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_2, 1))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #52
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.volume = volume = 0.05
		self.samp_rate = samp_rate = 256000
		self.resamp_factor = resamp_factor = 4

		##################################################
		# Blocks
		##################################################
		_volume_sizer = wx.BoxSizer(wx.VERTICAL)
		self._volume_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			label='volume',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._volume_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_volume_sizer)
		self.wxgui_scopesink2_1_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_1_0.win)
		self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=True,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_1.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=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 = gr.fir_filter_ccf(resamp_factor, firdes.low_pass(
			1, samp_rate/resamp_factor, 5000, 100, firdes.WIN_HAMMING, 6.76))
		self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, ))
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/Jack_Sparrow/EE304P/Lab04/am_usrp710.dat", True)
		self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=3,
			decimation=4,
			taps=None,
			fractional_bw=None,
		)
		self.audio_sink_0 = audio.sink(48000, "", True)
		self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -80000, 1, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.wxgui_scopesink2_1, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_scopesink2_1_0, 0))
Beispiel #53
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 0
        self.tuner = tuner = 93.9e6
        self.samp_rate = samp_rate = 2e6
        self.rfgain = rfgain = 15
        self.down_rate = down_rate = 250e3

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='Volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_volume_sizer, 1, 5, 1, 8)
        self._tuner_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.tuner,
            callback=self.set_tuner,
            label='Station Select',
            choices=[93.9e6, 91.5e6, 97.9e6, 93.1e6],
            labels=["Hip-Hop", "Classical", "Rock", "Country"],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._tuner_chooser)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            label='RF Gain',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._rfgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            minimum=10,
            maximum=70,
            num_steps=12,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.GridAdd(_rfgain_sizer, 1, 0, 1, 4)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=tuner,
            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='Sampling Bandpass',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        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(tuner, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(rfgain, 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.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=24,
            decimation=250,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(samp_rate / down_rate),
            firdes.low_pass(2, samp_rate, 100e3, 10e3, firdes.WIN_KAISER,
                            6.76))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume / 100, ))
        self.audio_sink_0 = audio.sink(24000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=down_rate,
            audio_decimation=1,
        )
        self.Demod_Out = 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=down_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Demod Out',
            peak_hold=False,
        )
        self.Add(self.Demod_Out.win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.Demod_Out, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #54
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Fm Tx Fifo")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 195.312e3
		self.FM_freq = FM_freq = 96.5e6

		##################################################
		# Blocks
		##################################################
		self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Audio")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FM")
		self.Add(self.notebook_0)
		_FM_freq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._FM_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_FM_freq_sizer,
			value=self.FM_freq,
			callback=self.set_FM_freq,
			label="FM Frequency",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._FM_freq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_FM_freq_sizer,
			value=self.FM_freq,
			callback=self.set_FM_freq,
			minimum=87.5e6,
			maximum=108e6,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_FM_freq_sizer)
		self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
			self.notebook_0.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 Plot",
			peak_hold=False,
			win=window.hamming,
		)
		self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_1.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.notebook_0.GetPage(1).GetWin(),
			baseband_freq=FM_freq,
			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.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0.win)
		self.uhd_usrp_sink_0 = uhd.usrp_sink(
			device_addr="addr=192.168.10.2",
			stream_args=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(FM_freq, 0)
		self.uhd_usrp_sink_0.set_gain(60, 0)
		self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
		self.gr_short_to_float_0 = gr.short_to_float(1, 1)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((400e-6, ))
		self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "/home/kranthi/documents/project/FM Transceiver Original/test.raw", True)
		self.blks2_wfm_tx_0 = blks2.wfm_tx(
			audio_rate=32000,
			quad_rate=800000,
			tau=75e-6,
			max_dev=75e3,
		)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_ccc(
			interpolation=1,
			decimation=2,
			taps=None,
			fractional_bw=None,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blks2_wfm_tx_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.blks2_wfm_tx_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.wxgui_fftsink2_1, 0))
		self.connect((self.gr_short_to_float_0, 0), (self.gr_multiply_const_vxx_0, 0))
Beispiel #55
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Intensity Interferometer")
        _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.magnitude = magnitude = 0.05
        self.integ = integ = 1
        self.beat = beat = 1

        ##################################################
        # Blocks
        ##################################################
        _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",
            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.05,
            maximum=0.5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_magnitude_sizer)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            label="Integration Time (Sec)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._integ_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            minimum=1,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_integ_sizer)
        _beat_sizer = wx.BoxSizer(wx.VERTICAL)
        self._beat_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            label="Beat Frequency (kHz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._beat_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            minimum=1,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_beat_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="2nd detector power level",
            sample_rate=2,
            v_scale=0,
            v_offset=0,
            t_scale=450,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_STRIPCHART,
            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=samp_rate / 10,
            fft_size=1024,
            fft_rate=8,
            average=True,
            avg_alpha=0.1,
            title="First Detector Spectrum",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(
            1.0 / ((samp_rate / 10) * integ), 1)
        self.low_pass_filter_0 = gr.fir_filter_fff(
            int(samp_rate / 25e3),
            firdes.low_pass(1, samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_float * 1, int(samp_rate / 20))
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.band_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / 10, (beat * 1000) - 100,
                             (beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                             6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3, magnitude, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3 - (beat * 1000), magnitude, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
Beispiel #56
0
	def __init__(self, devid="type=b100", rdsfile="rds_fifo", gain=35.0, freq=101.1e6, xmlport=13777, arate=int(48e3), mute=-15.0, ftune=0, ant="J1", subdev="A:0", ahw="pulse", deemph=75.0e-6, prenames='["UWRF","89.3","950","WEVR"]', prefreqs="[88.715e6,89.3e6,950.735e6,106.317e6]", volume=1.0):
		grc_wxgui.top_block_gui.__init__(self, title="Simple FM (Stereo) Receiver")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.devid = devid
		self.rdsfile = rdsfile
		self.gain = gain
		self.freq = freq
		self.xmlport = xmlport
		self.arate = arate
		self.mute = mute
		self.ftune = ftune
		self.ant = ant
		self.subdev = subdev
		self.ahw = ahw
		self.deemph = deemph
		self.prenames = prenames
		self.prefreqs = prefreqs
		self.volume = volume

		##################################################
		# Variables
		##################################################
		self.pthresh = pthresh = 350
		self.preselect = preselect = eval(prefreqs)[0]
		self.pilot_level = pilot_level = 0
		self.ifreq = ifreq = freq
		self.stpilotdet = stpilotdet = True if (pilot_level > pthresh) else False
		self.stereo = stereo = True
		self.rf_pwr_lvl = rf_pwr_lvl = 0
		self.cur_freq = cur_freq = simple_fm_helper.freq_select(ifreq,preselect)
		self.vol = vol = volume
		self.variable_static_text_0 = variable_static_text_0 = 10.0*math.log(rf_pwr_lvl+1.0e-11)/math.log(10)
		self.tone_med = tone_med = 5
		self.tone_low = tone_low = 5
		self.tone_high = tone_high = 5
		self.stereo_0 = stereo_0 = stpilotdet
		self.st_enabled = st_enabled = 1 if (stereo == True and pilot_level > pthresh) else 0
		self.squelch_probe = squelch_probe = 0
		self.sq_thresh = sq_thresh = mute
		self.samp_rate = samp_rate = 250e3
		self.rtext_0 = rtext_0 = cur_freq
		self.record = record = False
		self.rdsrate = rdsrate = 25e3
		self.osmo_taps = osmo_taps = firdes.low_pass(1.0,1.00e6,95e3,20e3,firdes.WIN_HAMMING,6.76)
		self.mod_reset = mod_reset = 0
		self.igain = igain = gain
		self.fine = fine = ftune
		self.farate = farate = arate
		self.dm = dm = deemph
		self.discrim_dc = discrim_dc = 0
		self.capture_file = capture_file = "capture.wav"
		self.asrate = asrate = 125e3

		##################################################
		# Blocks
		##################################################
		_sq_thresh_sizer = wx.BoxSizer(wx.VERTICAL)
		self._sq_thresh_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_sq_thresh_sizer,
			value=self.sq_thresh,
			callback=self.set_sq_thresh,
			label="Mute Level",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._sq_thresh_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_sq_thresh_sizer,
			value=self.sq_thresh,
			callback=self.set_sq_thresh,
			minimum=-30.0,
			maximum=-5.0,
			num_steps=40,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_sq_thresh_sizer, 1, 5, 1, 1)
		self.input_power = gr.probe_avg_mag_sqrd_c(sq_thresh, 1.0/(samp_rate/10))
		self.dc_level = gr.probe_signal_f()
		_vol_sizer = wx.BoxSizer(wx.VERTICAL)
		self._vol_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			label="Volume",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._vol_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			minimum=0,
			maximum=11,
			num_steps=110,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_vol_sizer, 0, 3, 1, 1)
		_tone_med_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_med_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_med_sizer,
			value=self.tone_med,
			callback=self.set_tone_med,
			label="1Khz-4Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_med_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_med_sizer,
			value=self.tone_med,
			callback=self.set_tone_med,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_med_sizer, 1, 3, 1, 1)
		_tone_low_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_low_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_low_sizer,
			value=self.tone_low,
			callback=self.set_tone_low,
			label="0-1Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_low_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_low_sizer,
			value=self.tone_low,
			callback=self.set_tone_low,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_low_sizer, 1, 2, 1, 1)
		_tone_high_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_high_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_high_sizer,
			value=self.tone_high,
			callback=self.set_tone_high,
			label="4Khz-15Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_high_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_high_sizer,
			value=self.tone_high,
			callback=self.set_tone_high,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_high_sizer, 1, 4, 1, 1)
		def _squelch_probe_probe():
			while True:
				val = self.input_power.unmuted()
				try: self.set_squelch_probe(val)
				except AttributeError, e: pass
				time.sleep(1.0/(10))
		_squelch_probe_thread = threading.Thread(target=_squelch_probe_probe)
		_squelch_probe_thread.daemon = True
		_squelch_probe_thread.start()
		self._record_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.record,
			callback=self.set_record,
			label="Record Audio",
			true=True,
			false=False,
		)
		self.GridAdd(self._record_check_box, 2, 2, 1, 1)
		self.pilot_probe = gr.probe_signal_f()
		_fine_sizer = wx.BoxSizer(wx.VERTICAL)
		self._fine_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_fine_sizer,
			value=self.fine,
			callback=self.set_fine,
			label="Fine Tuning",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._fine_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_fine_sizer,
			value=self.fine,
			callback=self.set_fine,
			minimum=-50.0e3,
			maximum=50.e03,
			num_steps=400,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_fine_sizer, 1, 0, 1, 1)
		def _discrim_dc_probe():
			while True:
				val = self.dc_level.level()
				try: self.set_discrim_dc(val)
				except AttributeError, e: pass
				time.sleep(1.0/(2.5))
		_discrim_dc_thread = threading.Thread(target=_discrim_dc_probe)
		_discrim_dc_thread.daemon = True
		_discrim_dc_thread.start()
		self._capture_file_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.capture_file,
			callback=self.set_capture_file,
			label="Record Filename",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._capture_file_text_box, 2, 0, 1, 2)
		self.Main = self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.Main.AddPage(grc_wxgui.Panel(self.Main), "L/R")
		self.Main.AddPage(grc_wxgui.Panel(self.Main), "FM Demod Spectrum")
		self.Add(self.Main)
		self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
			self.GetWin(),
			baseband_freq=0,
			dynamic_range=100,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=512,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Waterfall Plot",
		)
		self.Add(self.wxgui_waterfallsink2_0.win)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.Main.GetPage(0).GetWin(),
			title="Audio Channels (L and R)",
			sample_rate=farate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Rel. Audio Level",
		)
		self.Main.GetPage(0).Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.Main.GetPage(1).GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=asrate,
			fft_size=1024,
			fft_rate=6,
			average=True,
			avg_alpha=0.1,
			title="FM Demod Spectrum",
			peak_hold=False,
		)
		self.Main.GetPage(1).Add(self.wxgui_fftsink2_0.win)
		self._variable_static_text_0_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.variable_static_text_0,
			callback=self.set_variable_static_text_0,
			label="RF Power ",
			converter=forms.float_converter(formatter=lambda x: "%4.1f" % x),
		)
		self.GridAdd(self._variable_static_text_0_static_text, 0, 2, 1, 1)
		self._stereo_0_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.stereo_0,
			callback=self.set_stereo_0,
			label="Stereo Detect",
			true=True,
			false=False,
		)
		self.GridAdd(self._stereo_0_check_box, 2, 5, 1, 1)
		self._stereo_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.stereo,
			callback=self.set_stereo,
			label="Stereo",
			true=True,
			false=False,
		)
		self.GridAdd(self._stereo_check_box, 2, 4, 1, 1)
		self.rtl2832_source_0 = baz.rtl_source_c(defer_creation=True)
		self.rtl2832_source_0.set_verbose(True)
		self.rtl2832_source_0.set_vid(0x0)
		self.rtl2832_source_0.set_pid(0x0)
		self.rtl2832_source_0.set_tuner_name("")
		self.rtl2832_source_0.set_default_timeout(0)
		self.rtl2832_source_0.set_use_buffer(True)
		self.rtl2832_source_0.set_fir_coefficients(([]))
		
		
		
		
		
		if self.rtl2832_source_0.create() == False: raise Exception("Failed to create RTL2832 Source: rtl2832_source_0")
		
		
		self.rtl2832_source_0.set_sample_rate(1.0e6)
		
		self.rtl2832_source_0.set_frequency(cur_freq+200e3)
		
		
		self.rtl2832_source_0.set_auto_gain_mode(False)
		self.rtl2832_source_0.set_relative_gain(True)
		self.rtl2832_source_0.set_gain(gain)
		  
		self._rtext_0_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.rtext_0,
			callback=self.set_rtext_0,
			label="CURRENT FREQUENCY>>",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._rtext_0_static_text, 0, 1, 1, 1)
		def _rf_pwr_lvl_probe():
			while True:
				val = self.input_power.level()
				try: self.set_rf_pwr_lvl(val)
				except AttributeError, e: pass
				time.sleep(1.0/(2))
		_rf_pwr_lvl_thread = threading.Thread(target=_rf_pwr_lvl_probe)
		_rf_pwr_lvl_thread.daemon = True
		_rf_pwr_lvl_thread.start()
		self._preselect_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.preselect,
			callback=self.set_preselect,
			label='preselect',
			choices=eval(prefreqs),
			labels=eval(prenames),
			style=wx.RA_HORIZONTAL,
		)
		self.GridAdd(self._preselect_chooser, 0, 4, 1, 1)
		def _pilot_level_probe():
			while True:
				val = self.pilot_probe.level()
				try: self.set_pilot_level(val)
				except AttributeError, e: pass
				time.sleep(1.0/(5))
		_pilot_level_thread = threading.Thread(target=_pilot_level_probe)
		_pilot_level_thread.daemon = True
		_pilot_level_thread.start()
		self.low_pass_filter_3 = gr.fir_filter_fff(1, firdes.low_pass(
			3, asrate/500, 10, 3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_2 = gr.fir_filter_fff(10, firdes.low_pass(
			3, asrate/50, 100, 30, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_1 = gr.fir_filter_fff(10, firdes.low_pass(
			3, asrate/5, 1e3, 200, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0 = gr.fir_filter_fff(5, firdes.low_pass(
			3, asrate, 10e3, 2e3, firdes.WIN_HAMMING, 6.76))
		_igain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._igain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_igain_sizer,
			value=self.igain,
			callback=self.set_igain,
			label="RF Gain",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._igain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_igain_sizer,
			value=self.igain,
			callback=self.set_igain,
			minimum=0,
			maximum=50,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_igain_sizer, 1, 1, 1, 1)
		_ifreq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._ifreq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_ifreq_sizer,
			value=self.ifreq,
			callback=self.set_ifreq,
			label="Center Frequency",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._ifreq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_ifreq_sizer,
			value=self.ifreq,
			callback=self.set_ifreq,
			minimum=88.1e6,
			maximum=108.1e6,
			num_steps=200,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_ifreq_sizer, 0, 0, 1, 1)
		self.gr_wavfile_sink_0 = gr.wavfile_sink("/dev/null" if record == False else capture_file, 2, int(farate), 16)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_single_pole_iir_filter_xx_1 = gr.single_pole_iir_filter_ff(2.5/(asrate/500), 1)
		self.gr_single_pole_iir_filter_xx_0 = gr.single_pole_iir_filter_ff(1.0/(asrate/3), 1)
		self.gr_multiply_xx_1 = gr.multiply_vff(1)
		self.gr_multiply_xx_0_0 = gr.multiply_vff(1)
		self.gr_multiply_xx_0 = gr.multiply_vff(1)
		self.gr_multiply_const_vxx_3 = gr.multiply_const_vff((3.16e3 if st_enabled else 0, ))
		self.gr_multiply_const_vxx_2 = gr.multiply_const_vff((1.0 if st_enabled else 1.414, ))
		self.gr_multiply_const_vxx_1_0 = gr.multiply_const_vff((0 if st_enabled else 1, ))
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((0 if squelch_probe == 0 else 1.0, ))
		self.gr_multiply_const_vxx_0_0 = gr.multiply_const_vff((vol*1.5*10.0, ))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((vol*1.5*10.0 if st_enabled else 0, ))
		self.gr_keep_one_in_n_0 = gr.keep_one_in_n(gr.sizeof_float*1, int(asrate/3))
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(4, (osmo_taps), 200e3+fine+(-12e3*discrim_dc), 1.0e6)
		self.gr_fractional_interpolator_xx_0_0 = gr.fractional_interpolator_ff(0, asrate/farate)
		self.gr_fractional_interpolator_xx_0 = gr.fractional_interpolator_ff(0, asrate/farate)
		self.gr_fft_filter_xxx_1_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_high/10.0,asrate,3.5e3,15.0e3,5.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_1_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_med/10.0,asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_1 = gr.fft_filter_fff(1, (firdes.low_pass(tone_low/10.0,asrate,1.2e3,500,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_high/10.0,asrate,3.5e3,13.5e3,3.5e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_med/10.0,asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0 = gr.fft_filter_fff(1, (firdes.low_pass(tone_low/10.0,asrate,1.2e3,500,firdes.WIN_HAMMING)), 1)
		self.gr_divide_xx_0 = gr.divide_ff(1)
		self.gr_agc_xx_1 = gr.agc_cc(1e-2, 0.35, 1.0, 5000)
		self.gr_add_xx_2_0 = gr.add_vff(1)
		self.gr_add_xx_2 = gr.add_vff(1)
		self.gr_add_xx_1 = gr.add_vff(1)
		self.gr_add_xx_0 = gr.add_vff(1)
		self.gr_add_const_vxx_0 = gr.add_const_vff((1.0e-7, ))
		self._dm_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.dm,
			callback=self.set_dm,
			label="FM Deemphasis",
			choices=[75.0e-6, 50.0e-6],
			labels=["NA", "EU"],
			style=wx.RA_HORIZONTAL,
		)
		self.GridAdd(self._dm_chooser, 0, 5, 1, 1)
		self.blks2_wfm_rcv_0 = blks2.wfm_rcv(
			quad_rate=samp_rate,
			audio_decimation=2,
		)
		self.blks2_fm_deemph_0_0 = blks2.fm_deemph(fs=farate, tau=deemph)
		self.blks2_fm_deemph_0 = blks2.fm_deemph(fs=farate, tau=deemph)
		self.band_pass_filter_2_0 = gr.fir_filter_fff(1, firdes.band_pass(
			20, asrate, 17.5e3, 17.9e3, 250, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_2 = gr.fir_filter_fff(1, firdes.band_pass(
			10, asrate, 18.8e3, 19.2e3, 350, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, asrate, 38e3-(15e3), 38e3+(15e3), 4.0e3, firdes.WIN_HAMMING, 6.76))
		self.audio_sink_0 = audio.sink(int(farate), "" if ahw == "Default" else ahw, True)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_add_xx_1, 0), (self.gr_fractional_interpolator_xx_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.gr_fractional_interpolator_xx_0_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_multiply_xx_1, 0))
		self.connect((self.gr_multiply_const_vxx_1_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.band_pass_filter_2_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.band_pass_filter_2_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_multiply_xx_0_0, 0), (self.gr_divide_xx_0, 0))
		self.connect((self.gr_divide_xx_0, 0), (self.gr_single_pole_iir_filter_xx_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.gr_add_const_vxx_0, 0))
		self.connect((self.gr_add_const_vxx_0, 0), (self.gr_divide_xx_0, 1))
		self.connect((self.gr_single_pole_iir_filter_xx_0, 0), (self.gr_keep_one_in_n_0, 0))
		self.connect((self.gr_keep_one_in_n_0, 0), (self.pilot_probe, 0))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_1, 2))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.gr_add_xx_1, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.gr_multiply_const_vxx_3, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.gr_multiply_const_vxx_3, 0), (self.gr_add_xx_1, 1))
		self.connect((self.gr_fractional_interpolator_xx_0, 0), (self.gr_multiply_const_vxx_0_0, 0))
		self.connect((self.gr_fractional_interpolator_xx_0_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0, 0))
		self.connect((self.gr_fft_filter_xxx_1, 0), (self.gr_add_xx_2, 0))
		self.connect((self.gr_fft_filter_xxx_1_0, 0), (self.gr_add_xx_2, 1))
		self.connect((self.gr_fft_filter_xxx_1_0_0, 0), (self.gr_add_xx_2, 2))
		self.connect((self.gr_add_xx_2, 0), (self.gr_multiply_const_vxx_2, 0))
		self.connect((self.gr_add_xx_2_0, 0), (self.gr_multiply_const_vxx_3, 0))
		self.connect((self.gr_fft_filter_xxx_0, 0), (self.gr_add_xx_2_0, 0))
		self.connect((self.gr_fft_filter_xxx_0_0, 0), (self.gr_add_xx_2_0, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0_0, 0))
		self.connect((self.gr_fft_filter_xxx_0_0_0, 0), (self.gr_add_xx_2_0, 2))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0_0_0, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.gr_multiply_const_vxx_1_0, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.gr_wavfile_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_multiply_const_vxx_0_0, 0), (self.blks2_fm_deemph_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.audio_sink_0, 1))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.blks2_fm_deemph_0_0, 0))
		self.connect((self.blks2_fm_deemph_0_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_0_0, 1))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_2, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.audio_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_2_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_0_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_wavfile_sink_0, 1))
		self.connect((self.blks2_fm_deemph_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.wxgui_scopesink2_0, 1))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.gr_agc_xx_1, 0), (self.blks2_wfm_rcv_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.gr_agc_xx_1, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.input_power, 0))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.low_pass_filter_1, 0))
		self.connect((self.low_pass_filter_1, 0), (self.low_pass_filter_2, 0))
		self.connect((self.low_pass_filter_2, 0), (self.low_pass_filter_3, 0))
		self.connect((self.gr_single_pole_iir_filter_xx_1, 0), (self.dc_level, 0))
		self.connect((self.low_pass_filter_3, 0), (self.gr_single_pole_iir_filter_xx_1, 0))
		self.connect((self.rtl2832_source_0, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_waterfallsink2_0, 0))
Beispiel #57
0
 def __init__(self, app, samp_rate, inter, dec):
     '''
     in:
         - app = object of type TXApp
         - samp_rate = sample rate in Herz
         - inter = interpolation factor
         - dec = decimation factor
     '''
     gr.hier_block2.__init__(self, "TXGui",
                             gr.io_signature(1, 1, gr.sizeof_gr_complex),
                             gr.io_signature(0, 0, 0))
       
     # instance variables
     self.app = app
     self.gui = wxgui.top_block_gui("BPSK TX", size=default_gui_size) 
     self.nb = self.__createNoteBook()
     
     self.throttle = gr.throttle(gr.sizeof_gr_complex, samp_rate)
     
     # resampler
     if inter == 1 and dec == 1:
         self.resampler = gr.multiply_const_vcc((1,))
         print("i: resampler not need")
     else:
         self.resampler = blks2.rational_resampler_ccc(
             interpolation=inter,
             decimation=dec,
             taps=None,
             fractional_bw=None,
         )
     # samples
     self.fft = fftsink2.fft_sink_c(
             self.nb.GetPage(0).GetWin(),
             baseband_freq=0,
             y_per_div=5,
             y_divs=10,
             ref_level=-40,
             sample_rate= inter*samp_rate/dec,
             fft_size=512,
             fft_rate=10,
             average=True,
             avg_alpha=0.1,
             title="FFT Plot",
             peak_hold=False,
     )
     self.scope_IQ = scopesink2.scope_sink_c(
             self.nb.GetPage(1).GetWin(),
             title="Scope IQ",
             sample_rate = inter*samp_rate/dec,
             v_scale=0.001,
             t_scale=0.001,
             ac_couple=False,
             xy_mode=False,
             num_inputs=1,
     )
     
     # adding the visual components to the notebook
     self.nb.GetPage(0).Add(self.fft.win)
     self.nb.GetPage(1).Add(self.scope_IQ.win)
     
     # phase
     self.cmp2arg = gr.complex_to_arg()
     
     self.fftPhase = fftsink2.fft_sink_f(
             self.nb.GetPage(2).GetWin(),
             baseband_freq=0,
             y_per_div=5,
             y_divs=10,
             ref_level=-40,
             sample_rate= inter*samp_rate/dec,
             fft_size=512,
             fft_rate=10,
             average=True,
             avg_alpha=0.1,
             title="FFT phase Plot",
             peak_hold=False,
     )
     self.scopePhase = scopesink2.scope_sink_f(
             self.nb.GetPage(3).GetWin(),
             title="Scope phase",
             sample_rate = inter*samp_rate/dec,
             v_scale=0.001,
             t_scale=0.001,
             ac_couple=False,
             xy_mode=False,
             num_inputs=1,
     )
     # adding the visual components to the notebook
     self.nb.GetPage(2).Add(self.fftPhase.win)
     self.nb.GetPage(3).Add(self.scopePhase.win)
     
     self.__makeConnections()
    def __init__(self, frame, panel, vbox, argv, panel_info):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        signal_type = default_signal_type # not yet an option

        # command line options
        parser = OptionParser(option_class=eng_option)
        parser.add_option("-r", "--sample-rate",type="eng_float",
                          default=default_rate,
                          help="set flow graph sample rate [default=%s]" % default_rate)
        parser.add_option ("-f", "--freq", type="eng_float",
                           default=default_freq,
                           help="set signal frequency [default=%s]" % default_freq)
        parser.add_option ("-a", "--amplitude", type="eng_float",
                           default=default_ampl,
                           help="set signal amplitude [default %s]" % default_ampl)
        parser.add_option ("--gaussian", dest="noise_type",
                           action="store_const", const=gr.GR_GAUSSIAN,
                           help="generate Gaussian noise (-x is variance)",
                           default=default_noise_type)
        parser.add_option ("--uniform", dest="noise_type",
                           action="store_const", const=gr.GR_UNIFORM,
                           help="generate Uniform noise (-x is peak-to-peak)")
        parser.add_option ("-x", "--noise_amplitude", type="eng_float",
                           default=default_noise_ampl,
                           help="set noise amplitude (variance or p-p) [default %s]" % default_noise_ampl)
        parser.add_option("-n", "--frame_decim", type="int",
                          default=default_frame_decim,
                          help="set oscope frame decimation factor to DECIM [default=%s]" % default_frame_decim)
        parser.add_option("-v", "--v_scale", type="eng_float",
                          default=default_v_scale,
                          help="set oscope initial V/div [default=%s]" % default_v_scale)
        parser.add_option("-t", "--t_scale", type="eng_float",
                          default=default_t_scale,
                          help="set oscope initial s/div [default=%s]" % default_t_scale)
        parser.add_option("-l", "--ref_level", type="eng_float",
                          default=default_ref_level,
                          help="set fft reference level [default=%sdB]" % default_ref_level)
        (options, args) = parser.parse_args ()
        if len(args) != 0:
            parser.print_help()
            raise SystemExit, 1

        # flow graph, including scope and fft frames
        sample_rate = int(options.sample_rate)

        # signal, noise sources need to be attributes so callbacks can get them
        self.signal = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, options.freq,
                                    options.amplitude, 0.0)

        # Seed copied from example at cswiger/noise_source.html
        self.noise = gr.noise_source_f(options.noise_type,
                                       options.noise_amplitude,
                                       2482)
        add = gr.add_ff()
        
        throttle = gr.throttle(gr.sizeof_float, sample_rate)

        (scope_title, scope_panel, scope_vbox) = panel_info[1] #0 is ctrl panel
        scope = scopesink2.scope_sink_f(scope_panel,
                                       sample_rate=sample_rate,
                                       frame_decim=options.frame_decim,
                                       v_scale=options.v_scale,
                                       t_scale=options.t_scale)
        scope_vbox.Add (scope.win, 1, wx.EXPAND)

        fft_size = 256
        (fft_title, fft_panel, fft_vbox) = panel_info[2] # 0 is control panel
        fft = fftsink2.fft_sink_f (fft_panel,title=fft_title,
                                  fft_size=fft_size*2,
                                  sample_rate=sample_rate, baseband_freq=0,
                                  ref_level=options.ref_level,
                                  y_per_div=10)
        fft_vbox.Add (fft.win, 1, wx.EXPAND)

        self.connect (self.signal, (add,0))
        self.connect (self.noise, (add,1))
        self.connect (add, throttle)
        # self.connect (throttle, (scope, 0))
        # self.connect (throttle, (scope, 1)) # can't leave scope in unconnected
        self.connect (throttle, scope)
        self.connect (throttle, fft)

        # control panel frame
        sliders = form.form()
        
        vbox.Add((0,10), 0)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((10,0), 0)
        sliders['signal_type'] = form.static_text_field(parent=panel,sizer=hbox)
        vbox.Add(hbox, 0, wx.EXPAND)
        
        vbox.Add((0,10), 0)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((10,0), 0)
        sliders['signal_freq'] = form.slider_field(parent=panel, sizer=hbox,
                                                 label="Frequency",
                                                 weight=3,
                                                 min=0, max=2*options.freq,
                                                 callback=self.set_signal_freq)
        vbox.Add(hbox, 0, wx.EXPAND)
        
        vbox.Add((0,10), 0)
        hbox = wx.BoxSizer(wx.HORIZONTAL) # apparently you can rebind hbox
        hbox.Add((10,0), 0)
        sliders['signal_ampl'] = form.slider_field(parent=panel, sizer=hbox,
                                                 label="Amplitude",
                                                 weight=3,
                                                 min=0, max=usrp_full_scale,
                                                 callback=self.set_signal_ampl)
        vbox.Add(hbox, 0, wx.EXPAND)

        vbox.Add((0,20), 0)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((10,0), 0)
        sliders['noise_type'] = form.static_text_field(parent=panel,sizer=hbox)
        vbox.Add(hbox, 0, wx.EXPAND)

        vbox.Add((0,10), 0)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((10,0), 0)
        sliders['noise_ampl'] = form.slider_field(parent=panel, sizer=hbox,
                                                  label="Amplitude",
                                                  weight=3,
                                                  min=0, max=usrp_full_scale,
                                                  callback=self.set_noise_ampl)
        vbox.Add(hbox, 0, wx.EXPAND)
        vbox.Add((0,10), 0)
        
        sliders['signal_type'].set_value("Signal: %s"
                                        % signal_string[signal_type])    
        sliders['noise_type'].set_value("Noise: %s"
                                        % noise_string[options.noise_type])
        sliders['signal_freq'].set_value(options.freq)
        sliders['signal_ampl'].set_value(options.amplitude)        
        sliders['noise_ampl'].set_value(options.noise_amplitude)