コード例 #1
0
	def set_wbfm(self, wbfm):
		self.wbfm = wbfm
		self.set_main_taps(firdes.low_pass(1.0,self.wbfm,mh.get_mode_deviation(self.mode,self.bw)*1.05,mh.get_mode_deviation(self.mode,self.bw)/2.0,firdes.WIN_HAMMING,6.76))
		self.set_aratio(int(self.wbfm/self.audio_int_rate))
		self.gr_keep_one_in_n_0.set_n(int(self.wbfm/self.digi_rate))
		self.gr_fft_filter_xxx_2_0.set_taps((firdes.low_pass(1.0,self.wbfm,14.5e3,8.5e3,firdes.WIN_HAMMING,6.76)))
		self.set_k(self.wbfm/(2*math.pi*mh.get_mode_deviation(self.mode,self.bw)))
コード例 #2
0
ファイル: TxUsrp.py プロジェクト: spino327/sdr_testbed
 def postProcessing(self, inSampRate, dxcFreq, sampRate):
     
     # xlating
     if dxcFreq != 0:
         xlateFilterTaps = firdes.low_pass(1, sampRate, sampRate / 2, sampRate / 10, firdes.WIN_HAMMING, 6.76)
         self.xlatingFilter = gr.freq_xlating_fir_filter_ccc(1, (xlateFilterTaps), 
             dxcFreq, 
             sampRate)
         print "i: xlating filter fixed to " + str(dxcFreq)
     else:
         self.xlatingFilter = gr.multiply_const_vcc((1, ))
         print "i: xlating filter not needed"
         
     # pfb resampler
     self.resamplerFactor = sampRate / inSampRate
     nphases = 32
     frac_bw = 0.45
     rs_taps = firdes.low_pass(nphases, nphases, frac_bw, 0.5 - frac_bw)
     self.resampler = blks2.pfb_arb_resampler_ccf(self.resamplerFactor, 
         (rs_taps), 
         nphases)
     print "i: re-sampler relation new_freq/old_freq = " + str(self.resamplerFactor)
     #EO instance variables
     
     self.isRTEnable = gr.enable_realtime_scheduling()
     if self.isRTEnable == gr.RT_OK:
         print "i: realtime enable: True"
     else:
         print "i: realtime enable: False"
     
     # Connections
     self.connect((self, 0), (self.resampler, 0), (self.xlatingFilter, 0), (self.tx, 0))
コード例 #3
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.low_pass_filter_0_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 500000, 10000,
                         firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 500000, 10000,
                         firdes.WIN_HAMMING, 6.76))
コード例 #4
0
ファイル: rds_tx.py プロジェクト: Crazybond/gr-rds
	def set_usrp_rate(self, usrp_rate):
		self.usrp_rate = usrp_rate
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.usrp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_1.set_taps(firdes.band_pass(1, self.usrp_rate, 23e3, 53e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.gr_sig_source_x_0.set_sampling_freq(self.usrp_rate)
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.usrp_rate)
コード例 #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.dec_rate = dec_rate = 2

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(1000000)
        self.uhd_usrp_source_0.set_center_freq(2400490000, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.low_pass_filter_0_0 = gr.interp_fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 500000, 10000, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 500000, 10000, firdes.WIN_HAMMING,
                            6.76))
        self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
        self.gr_pwr_squelch_xx_0 = gr.pwr_squelch_cc(-100, 0.001, 0, True)
        self.flysky_dumpsync_0 = flysky.dumpsync()
        self.digital_correlate_access_code_bb_0_1 = digital.correlate_access_code_bb(
            "010101010101010101010101010101010101010001110101", 1)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            2, 0.0076562, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.gr_quadrature_demod_cf_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.gr_pwr_squelch_xx_0, 0),
                     (self.gr_quadrature_demod_cf_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.gr_pwr_squelch_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_correlate_access_code_bb_0_1, 0))
        self.connect((self.digital_correlate_access_code_bb_0_1, 0),
                     (self.flysky_dumpsync_0, 0))
コード例 #6
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.osmosdr_source_c_0.set_sample_rate(self.samp_rate)
		self.set_zoom_taps(firdes.low_pass(1.0,self.samp_rate,self.zoomed_lp,self.zoomed_lp/3,firdes.WIN_HAMMING,6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate/self.zoom)
		self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate/self.zoom)
		self.set_variable_static_text_0_0(self.samp_rate)
		self.gr_freq_xlating_fir_filter_xxx_0_1.set_center_freq((self.offset+self.fine+self.xfine)/(self.samp_rate/1.0e6))
		self.gr_fft_filter_xxx_0.set_taps((firdes.low_pass(1.0,self.samp_rate,98.5e3,66e3,firdes.WIN_HAMMING,6.76)))
		self.set_zoomed_lp((self.samp_rate/2.1)/self.zoom)
コード例 #7
0
	def __init__(self):
		gr.top_block.__init__(self, "FM Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.freq = freq = 144800000
		self.af_gain = af_gain = 2
		self.sat_file_name = sat_file_name = "Undefined"

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.nbfm_normal = blks2.nbfm_rx(
			audio_rate=48000,
			quad_rate=96000,
			tau=75e-6,
			max_dev=5e3,
		)
		self.low_pass_filter = gr.fir_filter_ccf(1, firdes.low_pass(
			1, samp_rate, 12500, 1500, firdes.WIN_HAMMING, 6.76))
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((af_gain, ))
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-32)
		    
		self.audio_sink = audio.sink(48000, "", True)
		
		self.wavfile_sink = gr.wavfile_sink(self.sat_file_name, 1, 11025, 16)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=11025,
			decimation=48000,
			taps=None,
			fractional_bw=None,
		)
		

		##################################################
		# Connections
		##################################################
		self.connect((self.xlating_fir_filter, 0), (self.low_pass_filter, 0))
		self.connect((self.low_pass_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.audio_sink, 1))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.audio_sink, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.nbfm_normal, 0))
		self.connect((self.nbfm_normal, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
		self.connect((self.nbfm_normal, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wavfile_sink, 0))
コード例 #8
0
    def __init__(self, input_path, sample_rate, output_path):
        gr.top_block.__init__(self)

        # We don't use the existing NBFM demodulator block because it
        # contains a lowpass output filter which is unsuitable for 9600
        # GMSK (it's designed for voice).

        self.source = gr.file_source(gr.sizeof_gr_complex * 1, input_path,
                                     False)
        self.low_pass_filter = gr.fir_filter_ccf(
            4,
            firdes.low_pass(1, sample_rate, 15000, 100, firdes.WIN_HAMMING,
                            6.76))

        # High pass filter to remove the DC component. This is important
        # when the signal is near the SDR's local oscillator.
        # NOTE(tstranex): Disabled since we are now shifting the FCD
        # center frequency instead.
        #self.high_pass_filter = gr.fir_filter_ccf(1, firdes.high_pass(
        #	1, sample_rate/4, 100, 100, firdes.WIN_HAMMING, 6.76))

        self.quadrature_demod = gr.quadrature_demod_cf(sample_rate / 4 /
                                                       (2 * 3.14 * 3000))
        self.fm_deemph = blks2.fm_deemph(fs=sample_rate / 4, tau=75e-6)
        self.boost_volume = gr.multiply_const_vff((1.52, ))
        self.sink = gr.wavfile_sink(output_path, 1, sample_rate / 4, 16)

        self.connect((self.source, 0), (self.low_pass_filter, 0))
        #self.connect((self.low_pass_filter, 0), (self.high_pass_filter, 0))
        #self.connect((self.high_pass_filter, 0), (self.quadrature_demod, 0))
        self.connect((self.low_pass_filter, 0), (self.quadrature_demod, 0))

        self.connect((self.quadrature_demod, 0), (self.fm_deemph, 0))
        self.connect((self.fm_deemph, 0), (self.boost_volume, 0))
        self.connect((self.boost_volume, 0), (self.sink, 0))
コード例 #9
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate/self.resamp_factor, 5000, 100, firdes.WIN_HAMMING, 6.76))
		self.wxgui_scopesink2_1_0.set_sample_rate(self.samp_rate)
		self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate)
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
コード例 #10
0
ファイル: tp_modes.py プロジェクト: abelvdavid/SDR
	def set_srate(self, srate):
		self.srate = srate
		self.single_pole_iir_filter_xx_0.set_taps(1.0/((self.srate/10)*self.integ))
		self.blocks_keep_one_in_n_0.set_n(int(self.srate/20))
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.srate, 200e3, 24e3, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.srate)
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.srate/5, self.bp_low, self.bp_high, 24e3, firdes.WIN_HAMMING, 6.76))
コード例 #11
0
ファイル: usrp_rx_flex.py プロジェクト: GREO/GNU-Radio
	def set_channel_rate(self, channel_rate):
		self.channel_rate = channel_rate
		self.wxgui_fftsink2_1.set_sample_rate(self.channel_rate)
		self.set_channel_decim(int(self.sample_rate/self.channel_rate))
		self.set_demod_k(3*self.channel_rate/(2*math.pi*self.deviation))
		self.set_channel_taps(firdes.low_pass(10, self.sample_rate, self.passband/2.0, (self.channel_rate-self.passband)/2.0))
		self.set_ma_ntaps(int(self.channel_rate/self.symbol_rate))
コード例 #12
0
ファイル: nbfm9600.py プロジェクト: tstranex/carpcomm
    def __init__(self, input_path, sample_rate, output_path):
        gr.top_block.__init__(self)

        # We don't use the existing NBFM demodulator block because it
        # contains a lowpass output filter which is unsuitable for 9600
        # GMSK (it's designed for voice).

        self.source = gr.file_source(gr.sizeof_gr_complex * 1, input_path, False)
        self.low_pass_filter = gr.fir_filter_ccf(
            4, firdes.low_pass(1, sample_rate, 15000, 100, firdes.WIN_HAMMING, 6.76)
        )

        # High pass filter to remove the DC component. This is important
        # when the signal is near the SDR's local oscillator.
        # NOTE(tstranex): Disabled since we are now shifting the FCD
        # center frequency instead.
        # self.high_pass_filter = gr.fir_filter_ccf(1, firdes.high_pass(
        # 	1, sample_rate/4, 100, 100, firdes.WIN_HAMMING, 6.76))

        self.quadrature_demod = gr.quadrature_demod_cf(sample_rate / 4 / (2 * 3.14 * 3000))
        self.fm_deemph = blks2.fm_deemph(fs=sample_rate / 4, tau=75e-6)
        self.boost_volume = gr.multiply_const_vff((1.52,))
        self.sink = gr.wavfile_sink(output_path, 1, sample_rate / 4, 16)

        self.connect((self.source, 0), (self.low_pass_filter, 0))
        # self.connect((self.low_pass_filter, 0), (self.high_pass_filter, 0))
        # self.connect((self.high_pass_filter, 0), (self.quadrature_demod, 0))
        self.connect((self.low_pass_filter, 0), (self.quadrature_demod, 0))

        self.connect((self.quadrature_demod, 0), (self.fm_deemph, 0))
        self.connect((self.fm_deemph, 0), (self.boost_volume, 0))
        self.connect((self.boost_volume, 0), (self.sink, 0))
コード例 #13
0
 def set_sample_rate(self, sample_rate):
     self.sample_rate = sample_rate
     self.wxgui_fftsink2_0.set_sample_rate(self.sample_rate)
     self.set_channel_decim(int(self.sample_rate / self.channel_rate))
     self.set_channel_taps(
         firdes.low_pass(10, self.sample_rate, self.passband / 2.0,
                         (self.channel_rate - self.passband) / 2.0))
コード例 #14
0
    def __init__(self):
        gr.top_block.__init__(self)

        self.samp_rate = samp_rate = 1000000
        self.dump_freq = dump_freq = 2400490000

        self._u = uhd.usrp_source(
                device_addr="%default",
                io_type=uhd.io_type.COMPLEX_FLOAT32,
                num_channels=1)
                
        self._u.set_gain(0, 0)
        self._u.set_samp_rate(self.samp_rate)       


        treq = uhd.tune_request(self.dump_freq, 0)
        tr = self._u.set_center_freq(treq)

        if tr == None:
            sys.stderr.write('Failed to set center frequency\n')
            raise SystemExit, 1


        self.filter1 = gr.interp_fir_filter_ccf(1, firdes.low_pass(1, samp_rate, 500000, 10000, firdes.WIN_HAMMING, 6.76))
        self.squelch = gr.pwr_squelch_cc(-100, 0.001, 0, True)
        self.demod = gr.quadrature_demod_cf(1)
        
        self.sync = digital.clock_recovery_mm_ff(2, 0.0076562, 0.5, 0.175, 0.005)
        self.slicer = digital.binary_slicer_fb()
        self.detect_seq = digital.correlate_access_code_bb("01010101010101010101010101010101", 1)
        self.dump = flysky.dumpsync()

        self.connect(self._u,self.filter1,self.squelch,self.demod,self.sync,self.slicer,self.detect_seq, self.dump)
コード例 #15
0
ファイル: ettus_fm.py プロジェクト: rubiruchi/FM-Transceiver
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                         6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
     self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
コード例 #16
0
ファイル: rds_tx.py プロジェクト: Shmuma/gr-rds
 def set_usrp_rate(self, usrp_rate):
     self.usrp_rate = usrp_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.usrp_rate, 54e3, 60e3, 3e3,
                          firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_1.set_taps(
         firdes.band_pass(1, self.usrp_rate, 23e3, 53e3, 2e3,
                          firdes.WIN_HAMMING, 6.76))
     self.gr_sig_source_x_0.set_sampling_freq(self.usrp_rate)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING,
                         6.76))
     self.low_pass_filter_0_0.set_taps(
         firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING,
                         6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.usrp_rate)
コード例 #17
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 150e3, 100e3,
                         firdes.WIN_HAMMING, 6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
コード例 #18
0
ファイル: top_block.py プロジェクト: strayptr/rf-projects
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)
		self.blocks_throttle_0.set_sample_rate(self.samp_rate)
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff_freq, self.transition_width, firdes.WIN_BLACKMAN, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
		self.osmosdr_sink_c_0.set_sample_rate(self.samp_rate)
コード例 #19
0
 def set_Mono_gain(self, Mono_gain):
     self.Mono_gain = Mono_gain
     self._Mono_gain_slider.set_value(self.Mono_gain)
     self._Mono_gain_text_box.set_value(self.Mono_gain)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(self.Mono_gain, self.mpx_rate, 15000, 2000,
                         firdes.WIN_HAMMING, 6.76))
コード例 #20
0
	def __init__(self, center_freq, offset_freq, decimate_am=1, play_audio=False):
		"""Configure the RTL-SDR and GNU Radio"""
		super(rtlsdr_am_stream, self).__init__()
		
		audio_rate = 44100
		device_rate = audio_rate * 25
		output_rate = audio_rate / float(decimate_am)
		self.rate = output_rate

		self.osmosdr_source = osmosdr.source_c("")
		self.osmosdr_source.set_center_freq(freq)
		self.osmosdr_source.set_sample_rate(device_rate)

		taps = firdes.low_pass(1, device_rate, 40000, 5000, firdes.WIN_HAMMING, 6.76)
		self.freq_filter = gr.freq_xlating_fir_filter_ccc(25, taps, -freq_offs, device_rate)

		self.am_demod = blks2.am_demod_cf(
			channel_rate=audio_rate,
			audio_decim=1,
			audio_pass=5000,
			audio_stop=5500,
		)
		self.resampler = blks2.rational_resampler_fff(
			interpolation=1,
			decimation=decimate_am,
		)
		self.sink = gr_queue.queue_sink_f()
		
		self.connect(self.osmosdr_source, self.freq_filter, self.am_demod)
		self.connect(self.am_demod, self.resampler, self.sink)
		
		if play_audio:
			self.audio_sink = audio.sink(audio_rate, "", True)
			self.connect(self.am_demod, self.audio_sink)
コード例 #21
0
ファイル: ec3k.py プロジェクト: asdil12/ec3k
	def _setup_top_block(self):

		self.tb = gr.top_block()

		samp_rate = 96000
		oversample = 10
		center_freq = 868.280e6

		# Radio receiver, initial downsampling
		args = str("nchan=1 rtl=%s,buffers=16,offset_tune=1" % self.device)
		osmosdr_source = osmosdr.source_c(args=args)
		osmosdr_source.set_sample_rate(samp_rate*oversample)
		osmosdr_source.set_center_freq(center_freq, 0)
		osmosdr_source.set_freq_corr(0, 0)
		osmosdr_source.set_gain_mode(1, 0)
		osmosdr_source.set_gain(0, 0)

		low_pass_filter = gr.fir_filter_ccf(oversample, 
				firdes.low_pass(1, samp_rate*oversample, 90e3, 8e3, firdes.WIN_HAMMING, 6.76))

		self.tb.connect((osmosdr_source, 0), (low_pass_filter, 0))

		# Squelch
		self.noise_probe = gr.probe_avg_mag_sqrd_c(0, 1.0/samp_rate/1e2)
		self.squelch = gr.simple_squelch_cc(self.noise_level, 1)

		noise_probe_thread = threading.Thread(target=self._noise_probe_thread)
		noise_probe_thread.start()
		self.threads.append(noise_probe_thread)

		self.tb.connect((low_pass_filter, 0), (self.noise_probe, 0))
		self.tb.connect((low_pass_filter, 0), (self.squelch, 0))

		# FM demodulation
		quadrature_demod = gr.quadrature_demod_cf(1)

		self.tb.connect((self.squelch, 0), (quadrature_demod, 0))

		# Binary slicing, transformation into capture-compatible format

		add_offset = gr.add_const_vff((-1e-3, ))

		binary_slicer = digital.binary_slicer_fb()

		char_to_float = gr.char_to_float(1, 1)

		multiply_const = gr.multiply_const_vff((255, ))

		float_to_uchar = gr.float_to_uchar()

		pipe_sink = gr.file_sink(gr.sizeof_char*1, self.pipe)
		pipe_sink.set_unbuffered(False)

		self.tb.connect((quadrature_demod, 0), (add_offset, 0))
		self.tb.connect((add_offset, 0), (binary_slicer, 0))
		self.tb.connect((binary_slicer, 0), (char_to_float, 0))
		self.tb.connect((char_to_float, 0), (multiply_const, 0))
		self.tb.connect((multiply_const, 0), (float_to_uchar, 0))
		self.tb.connect((float_to_uchar, 0), (pipe_sink, 0))
コード例 #22
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.osmosdr_source_c_0.set_sample_rate(self.samp_rate)
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
		self.wxgui_waterfallsink2_1.set_sample_rate(self.samp_rate)
		self.wxgui_fftsink2_1.set_sample_rate(self.samp_rate)
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
		self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate)
コード例 #23
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76
         )
     )
コード例 #24
0
	def set_bw(self, bw):
		self.bw = bw
		self._bw_slider.set_value(self.bw)
		self._bw_text_box.set_value(self.bw)
		self.set_ssbo(-self.bw/2 if self.mode == "LSB" else 0.0)
		self.gr_multiply_const_vxx_0.set_k(((1.0/math.sqrt(mh.get_mode_deviation(self.mode,self.bw))*250), ))
		self.set_main_taps(firdes.low_pass(1.0,self.wbfm,mh.get_mode_deviation(self.mode,self.bw)*1.05,mh.get_mode_deviation(self.mode,self.bw)/2.0,firdes.WIN_HAMMING,6.76))
		self.set_k(self.wbfm/(2*math.pi*mh.get_mode_deviation(self.mode,self.bw)))
コード例 #25
0
 def set_mpx_rate(self, mpx_rate):
     self.mpx_rate = mpx_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(self.st_gain, self.mpx_rate, 23000, 53000, 2000,
                          firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(self.Mono_gain, self.mpx_rate, 15000, 2000,
                         firdes.WIN_HAMMING, 6.76))
コード例 #26
0
ファイル: LowpassAdapter.py プロジェクト: ludwigf/radio
 def __init__(self, samprate=48000, cutoff=1000, transit=100):
 #   ------------------------------------------------------------------------
     super(LowpassAdapter, self).__init__()
     self.filter = gr.fir_filter_fff(1, firdes.low_pass(
         1, samprate, cutoff, transit, firdes.WIN_HAMMING, 6.76))
     self.samprate = samprate
     self.cutoff = cutoff
     self.transit = transit
コード例 #27
0
ファイル: top_block.py プロジェクト: solfatari/GNURadio
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_post_decim(self.samp_rate / self.decim)
     self.osmosdr_source_c_0.set_sample_rate(self.samp_rate)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, self.samp_rate / 4, self.samp_rate / 4, firdes.WIN_HAMMING, 6.76)
     )
     self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate * 0 + self.post_decim)
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate * 0 + self.post_decim)
コード例 #28
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_pre_channel_rate(self.samp_rate / self.decim)
     self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate)
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
     self.gr_freq_xlating_fir_filter_xxx_0.set_taps(
         (firdes.low_pass(1, self.samp_rate, self.xlate_bandwidth / 2,
                          6000)))
     self.osmosdr_source_c_0.set_sample_rate(self.samp_rate)
コード例 #29
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.dec_rate = dec_rate = 2

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="", stream_args=uhd.stream_args(cpu_format="fc32", channels=range(1))
        )
        self.uhd_usrp_source_0.set_samp_rate(1000000)
        self.uhd_usrp_source_0.set_center_freq(2400490000, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.low_pass_filter_0_0 = gr.interp_fir_filter_ccf(
            1, firdes.low_pass(1, samp_rate, 500000, 10000, firdes.WIN_HAMMING, 6.76)
        )
        self.low_pass_filter_0 = gr.fir_filter_fff(
            1, firdes.low_pass(1, samp_rate, 500000, 10000, firdes.WIN_HAMMING, 6.76)
        )
        self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
        self.gr_pwr_squelch_xx_0 = gr.pwr_squelch_cc(-100, 0.001, 0, True)
        self.flysky_dumpsync_0 = flysky.dumpsync()
        self.digital_correlate_access_code_bb_0_1 = digital.correlate_access_code_bb(
            "010101010101010101010101010101010101010001110101", 1
        )
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2, 0.0076562, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.gr_quadrature_demod_cf_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.gr_pwr_squelch_xx_0, 0), (self.gr_quadrature_demod_cf_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.gr_pwr_squelch_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_bb_0_1, 0))
        self.connect((self.digital_correlate_access_code_bb_0_1, 0), (self.flysky_dumpsync_0, 0))
コード例 #30
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 25000000
		self.dec_rate = dec_rate = 25

		##################################################
		# Blocks
		##################################################
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate/dec_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.gr_unpacked_to_packed_xx_0 = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(dec_rate, (firdes.low_pass(1,samp_rate,1000000,100000)), -1000000, samp_rate)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/shampoo/sdr/capture/j9Pro-capture/2400000000-25M-1.cap", False)
		self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char*1, "/shampoo/sdr/projects/gr-nineeagles/gmsk-packed.out")
		self.gr_file_sink_0_0.set_unbuffered(False)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/shampoo/sdr/projects/gr-nineeagles/gmsk-unpacked.out")
		self.gr_file_sink_0.set_unbuffered(False)
		self.digital_gmsk_demod_0 = digital.gmsk_demod(
			samples_per_symbol=2,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			freq_error=0.0,
			verbose=False,
			log=False,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_unpacked_to_packed_xx_0, 0), (self.gr_file_sink_0_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.gr_unpacked_to_packed_xx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.digital_gmsk_demod_0, 0))
コード例 #31
0
	def __init__(self):
		gr.top_block.__init__(self, "FM Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.freq = freq = 144800000
		self.af_gain = af_gain = 2

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.nbfm_normal = blks2.nbfm_rx(
			audio_rate=48000,
			quad_rate=96000,
			tau=75e-6,
			max_dev=5e3,
		)
		self.low_pass_filter = gr.fir_filter_ccf(1, firdes.low_pass(
			1, samp_rate, 12500, 1500, firdes.WIN_HAMMING, 6.76))
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((af_gain, ))
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-32)
		    
		self.audio_sink = audio.sink(48000, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.xlating_fir_filter, 0), (self.low_pass_filter, 0))
		self.connect((self.low_pass_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.audio_sink, 1))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.audio_sink, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.nbfm_normal, 0))
		self.connect((self.nbfm_normal, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
コード例 #32
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING, 6.76))
		self.blocks_throttle_0.set_sample_rate(self.samp_rate)
		self.blocks_keep_one_in_n_0.set_n(int(self.samp_rate/20))
		self.single_pole_iir_filter_xx_0.set_taps(1.0/((self.samp_rate/10)*self.integ))
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate/10, (self.beat*1000)-100, (self.beat*1000)+100, 50, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate/10)
		self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
		self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
コード例 #33
0
 def set_channel_rate(self, channel_rate):
     self.channel_rate = channel_rate
     self.wxgui_fftsink2_1.set_sample_rate(self.channel_rate)
     self.set_channel_decim(int(self.sample_rate / self.channel_rate))
     self.set_demod_k(3 * self.channel_rate /
                      (2 * math.pi * self.deviation))
     self.set_channel_taps(
         firdes.low_pass(10, self.sample_rate, self.passband / 2.0,
                         (self.channel_rate - self.passband) / 2.0))
     self.set_ma_ntaps(int(self.channel_rate / self.symbol_rate))
コード例 #34
0
	def set_mode(self, mode):
		self.mode = mode
		self.gr_file_sink_0.open("/dev/null" if mh.get_mode_type(self.mode) != "DIG" else self.dfifo)
		self.set_ssbo(-self.bw/2 if self.mode == "LSB" else 0.0)
		self.gr_multiply_const_vxx_0.set_k(((1.0/math.sqrt(mh.get_mode_deviation(self.mode,self.bw))*250), ))
		self.set_main_taps(firdes.low_pass(1.0,self.wbfm,mh.get_mode_deviation(self.mode,self.bw)*1.05,mh.get_mode_deviation(self.mode,self.bw)/2.0,firdes.WIN_HAMMING,6.76))
		self.gr_multiply_const_vxx_0_0.set_k((0.85 if mh.get_mode_type(self.mode) == "SSB" else 0.0, ))
		self.gr_multiply_const_vxx_0_0_0.set_k((0.85 if mh.get_mode_type(self.mode) == "AM" else 0.0, ))
		self._mode_chooser.set_value(self.mode)
		self.gr_multiply_const_vxx_2.set_k((1.0 if mh.get_mode_type(self.mode) == "FM" else 0.0, ))
		self.set_k(self.wbfm/(2*math.pi*mh.get_mode_deviation(self.mode,self.bw)))
コード例 #35
0
	def __init__(self):
		gr.top_block.__init__(self, "CW/SSB Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.pass_trans = pass_trans = 600
		self.pass_low = pass_low = 300
		self.pass_high = pass_high = 1200
		self.freq = freq = 144800000
		self.af_gain = af_gain = 5
		self.sat_file_name = sat_file_name = "Undefined"

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((af_gain, ))
		self.gr_complex_to_real_0 = gr.complex_to_real(1)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 20.8e-6, 0.3, 1.0, 0.0)
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-10)
		    
		self.band_pass_filter_0 = gr.fir_filter_ccf(2, firdes.band_pass(
			1, samp_rate, pass_low, pass_high, pass_trans, firdes.WIN_HAMMING, 6.76))
		self.audio_sink = audio.sink(48000, "", True)

		self.wavfile_sink = gr.wavfile_sink(self.sat_file_name, 1, 11025, 16)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=11025,
			decimation=48000,
			taps=None,
			fractional_bw=None,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
		self.connect((self.xlating_fir_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_complex_to_real_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_complex_to_real_0, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 1))
		self.connect((self.gr_complex_to_real_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wavfile_sink, 0))
コード例 #36
0
ファイル: LowpassAdapter.py プロジェクト: ludwigf/radio
 def ProcessCommand(self, command):
 #   ------------------------------------------------------------------------
     print "LowpassAdapter", command
     if command[0] == "cutoff":
         self.cutoff = int(command[1])
     if command[0] == "transit":
         self.transit = int(command[1])
     self.filter.set_taps(
         firdes.low_pass(1, self.samprate, self.cutoff, self.transit, 
         firdes.WIN_HAMMING, 6.76))
     print "Adjusted", self.cutoff
     
コード例 #37
0
ファイル: rtty_decode.py プロジェクト: Flupsy/gr-rtty
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="RTTY decoder example")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 44100

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate/40,
			v_scale=1,
			v_offset=0,
			t_scale=25e-3,
			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_0.win)
		self.rtty_decode_ff_0 = rtty.decode_ff(
		  samp_rate=samp_rate/40, 
		  baud_rate=45.45, 
		  polarity=True,
		)
		self.low_pass_filter_0 = gr.fir_filter_fff(40, firdes.low_pass(
			100, samp_rate, 45.45*3, 20, firdes.WIN_HANN, 6.76))
		self.gr_wavfile_source_0 = gr.wavfile_source("/home/nick/Downloads/ksm_rtty.wav", False)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
		self.gr_moving_average_xx_0 = gr.moving_average_ff(5000, 1.0/5000, 20000)
		self.gr_hilbert_fc_0 = gr.hilbert_fc(64)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/home/nick/Desktop/rtty/test.dat")
		self.gr_file_sink_0.set_unbuffered(False)

		##################################################
		# Connections
		##################################################
		self.connect((self.low_pass_filter_0, 0), (self.gr_moving_average_xx_0, 0))
		self.connect((self.gr_moving_average_xx_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.gr_sub_xx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.rtty_decode_ff_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.rtty_decode_ff_0, 0))
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.gr_hilbert_fc_0, 0), (self.gr_quadrature_demod_cf_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.gr_hilbert_fc_0, 0))
コード例 #38
0
 def set_xlate_bandwidth(self, xlate_bandwidth):
     self.xlate_bandwidth = xlate_bandwidth
     self._xlate_bandwidth_slider.set_value(self.xlate_bandwidth)
     self._xlate_bandwidth_text_box.set_value(self.xlate_bandwidth)
     self._config_xlate_bandwidth_config = ConfigParser.ConfigParser()
     self._config_xlate_bandwidth_config.read(".grc_op25")
     if not self._config_xlate_bandwidth_config.has_section("main"):
         self._config_xlate_bandwidth_config.add_section("main")
     self._config_xlate_bandwidth_config.set("main", "xlate_bandwidth",
                                             str(self.xlate_bandwidth))
     self._config_xlate_bandwidth_config.write(open(".grc_op25", 'w'))
     self.gr_freq_xlating_fir_filter_xxx_0.set_taps(
         (firdes.low_pass(1, self.samp_rate, self.xlate_bandwidth / 2,
                          6000)))
コード例 #39
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING,
                         6.76))
     self.blocks_throttle_0.set_sample_rate(self.samp_rate)
     self.blocks_keep_one_in_n_0.set_n(int(self.samp_rate / 20))
     self.single_pole_iir_filter_xx_0.set_taps(
         1.0 / ((self.samp_rate / 10) * self.integ))
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate / 10, (self.beat * 1000) - 100,
                          (self.beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                          6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate / 10)
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
     self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
コード例 #40
0
    def __init__(self, outputfile, options):
        gr.top_block.__init__(self)

        if options.dsp:
            self.dst = audio.sink( options.dsp_sample_rate )
        else:
            self.dst = gr.wavfile_sink(outputfile, 2, options.wav_sample_rate, 16)

        self.c_to_iq = gr.complex_to_float()
        self.connect( (self.c_to_iq, 0), (self.dst, 0))
        self.connect( (self.c_to_iq, 1), (self.dst, 1))

        # settings for the modulator: /usr/local/lib/python2.5/site-packages/gnuradio/blks2impl/gmsk.py

        self.modulator = blks2.gmsk_mod(samples_per_symbol=options.samples_per_symbol)
        self.pkt_queue = blks2.mod_pkts( modulator=self.modulator )

        if options.carrier_frequency == 0:
            self.mixer = self.pkt_queue
        else:
            self.mixer   = gr.multiply_vcc(1)
            self.carrier = gr.sig_source_c( options.carrier_sample_rate, gr.GR_SIN_WAVE, options.carrier_frequency, 1.0 )
            self.lowpass = gr.fir_filter_ccf(1, firdes.low_pass(1, 48000, 48000/(2*options.samples_per_symbol)+500, 500, firdes.WIN_HAMMING, 6.76))
            self.connect(self.pkt_queue, self.lowpass, (self.mixer, 0) )
            self.connect(self.carrier,   (self.mixer, 1) )

        self.amp = gr.multiply_const_cc(1); self.amp.set_k(options.amp_amplitude)
        self.connect(self.mixer, self.amp, self.c_to_iq)

        if options.debug_wavs:
            from myblks import debugwav
            self._dpassw = debugwav("tx_passband", options)
            self._dprefw = debugwav("tx_prefband", options)
            self._dbasew = debugwav("tx_baseband", options)
            self.connect(self.amp, self._dpassw)
            self.connect(self.lowpass, self._dbasew)
            self.connect(self.pkt_queue, self._dprefw)

        if options.debug_files:
            self._dpassf = gr.file_sink(gr.sizeof_gr_complex*1, "debug_tx_passband.d_c")
            self._dpreff = gr.file_sink(gr.sizeof_gr_complex*1, "debug_tx_prefband.d_c")
            self._dbasef = gr.file_sink(gr.sizeof_gr_complex*1, "debug_tx_baseband.d_c")
            self.connect(self.amp, self._dpassf)
            self.connect(self.pkt_queue, self._dpreff)
            self.connect(self.lowpass, self._dbasef)
コード例 #41
0
ファイル: afsk1200_lsb.py プロジェクト: tstranex/carpcomm
	def __init__(self, input_path, sample_rate, output_path):
		gr.top_block.__init__(self)

		self.source = gr.file_source(
			gr.sizeof_gr_complex, input_path, False)
		self.lowpass_and_decimate = gr.fir_filter_ccf(
			8, firdes.low_pass(1, sample_rate, FREQ_SPACE, 100))
		self.lsb_tune = gr.freq_xlating_fir_filter_ccc(
			1, (1,), -FREQ_SPACE, sample_rate/8)
		self.boost_volume = gr.multiply_const_vcc((10, ))
		self.complex_to_real = gr.complex_to_real(1)
		self.sink = gr.wavfile_sink(output_path, 1, sample_rate/8, 16)

		self.connect((self.source, 0), (self.lowpass_and_decimate, 0))
		self.connect((self.lowpass_and_decimate, 0), (self.lsb_tune, 0))
		self.connect((self.lsb_tune, 0), (self.boost_volume, 0))
		self.connect((self.boost_volume, 0), (self.complex_to_real, 0))
		self.connect((self.complex_to_real, 0), (self.sink, 0))
コード例 #42
0
ファイル: RXData.py プロジェクト: spino327/sdr_testbed
    def __init__(self, app, samp_rate, inter, dec, filename):
        '''
        in:
            - app = object of type RXApp
            - samp_rate = sample rate in Hertz
            - inter = interpolation factor
            - dec = decimation factor
            - filename
            
        output
            - port 0 = MF
        '''
        gr.hier_block2.__init__(self, "RXData",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(0, 0, 0))
        
        # instance variables
        self.filename = filename
        self.isRecording = False
        self.app = app
        
        #  "bandpass" to new sample rate
        # cleaning the out-of-band interferences, low pass filter around the shape 
        lowPassTaps = firdes.low_pass(1, samp_rate, samp_rate/2, samp_rate/20, firdes.WIN_HAMMING, 6.76)
        self.lowPass = gr.multiply_const_vcc([1, ]) #gr.fir_filter_ccc(1, lowPassTaps)
        
        #Matched Filter
#        self.matched = gr.multiply_const_cc(1)   #RXMatchedFilter(1, 20, 1, 0.8, 10)
        
        # resampler after Matched-filter
        self.resampler = blks2.rational_resampler_ccc(
                interpolation=inter,
                decimation=dec,
                taps=None,
                fractional_bw=None,
        )
        
        # saving the IQ samples
        self.fileSink = gr.file_sink(gr.sizeof_gr_complex*1, self.filename) if(self.filename <> None and len(self.filename) > 0) else None
        
        #EO instance variables
        
        self.__makeConnections()
コード例 #43
0
	def __init__(self):
		gr.top_block.__init__(self, "CW/SSB Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.pass_trans = pass_trans = 600
		self.pass_low = pass_low = 300
		self.pass_high = pass_high = 1200
		self.freq = freq = 144800000
		self.af_gain = af_gain = 5

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((af_gain, ))
		self.gr_complex_to_real_0 = gr.complex_to_real(1)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 20.8e-6, 0.3, 1.0, 0.0)
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-10)
		    
		self.band_pass_filter_0 = gr.fir_filter_ccf(2, firdes.band_pass(
			1, samp_rate, pass_low, pass_high, pass_trans, firdes.WIN_HAMMING, 6.76))
		self.audio_sink = audio.sink(48000, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
		self.connect((self.xlating_fir_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_complex_to_real_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_complex_to_real_0, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 1))
コード例 #44
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 2000000
		self.dec_rate = dec_rate = 4

		##################################################
		# Blocks
		##################################################
		self.gr_unpacked_to_packed_xx_0 = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
		self.gr_throttle_1 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate/dec_rate)
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(dec_rate, (firdes.low_pass(1,samp_rate,500000,100000)), -535000, samp_rate)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/shampoo/sdr/capture/nrf-capture/2410500000-2M-1.cap", False)
		self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char*1, "/shampoo/sdr/projects/gr-nordic/qam-packed.out")
		self.gr_file_sink_0_0.set_unbuffered(False)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/shampoo/sdr/projects/gr-nordic/qam-unpacked.out")
		self.gr_file_sink_0.set_unbuffered(False)
		self.digital_qam_demod_0 = digital.qam.qam_demod(
		  constellation_points=4,
		  differential=False,
		  samples_per_symbol=2,
		  excess_bw=.035,
		  freq_bw=6.28/100.0,
		  timing_bw=6.28/100.0,
		  phase_bw=6.28/100.0,
		  gray_coded=False,
		  verbose=False,
		  log=False,
		  )

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.gr_throttle_1, 0))
		self.connect((self.gr_unpacked_to_packed_xx_0, 0), (self.gr_file_sink_0_0, 0))
		self.connect((self.digital_qam_demod_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.digital_qam_demod_0, 0), (self.gr_unpacked_to_packed_xx_0, 0))
		self.connect((self.gr_throttle_1, 0), (self.digital_qam_demod_0, 0))
コード例 #45
0
ファイル: wmbus_demod.py プロジェクト: otilrac/gr-wmbus
	def __init__(self, samp_rate=1600000, samp_per_sym=16, freq_error=-0.0025000):
		gr.hier_block2.__init__(
			self, "Wireless M-Bus Demod",
			gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
			gr.io_signature(1, 1, gr.sizeof_char*1),
		)

		##################################################
		# Parameters
		##################################################
		self.samp_rate = samp_rate
		self.samp_per_sym = samp_per_sym
		self.freq_error = freq_error

		##################################################
		# Variables
		##################################################
		self.cutoff = cutoff = 120e3
		self.chip_rate = chip_rate = samp_rate/samp_per_sym

		##################################################
		# Blocks
		##################################################
		self.low_pass_filter_0 = gr.fir_filter_ccf(1, firdes.low_pass(
			1, samp_rate, cutoff, cutoff/2, firdes.WIN_HAMMING, 6.76))
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_single_pole_iir_filter_xx_0 = gr.single_pole_iir_filter_ff(0.0512/samp_per_sym, 1)
		self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
		self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+freq_error), .25 *0.06*0.06*4, 0.5, 0.06*2, 0.002*2)
		self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.gr_single_pole_iir_filter_xx_0, 0))
		self.connect((self.gr_single_pole_iir_filter_xx_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
		self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.gr_quadrature_demod_cf_0, 0))
		self.connect((self.digital_binary_slicer_fb_0, 0), (self, 0))
		self.connect((self, 0), (self.low_pass_filter_0, 0))
コード例 #46
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 2000000
		self.dec_rate = dec_rate = 4

		##################################################
		# Blocks
		##################################################
		self.gr_throttle_1 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate/dec_rate)
		self.gr_or_xx_0 = gr.or_bb()
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(dec_rate, (firdes.low_pass(1,samp_rate,500000,100000)), -535000, samp_rate)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/shampoo/sdr/capture/nrf-capture/2410500000-2M-1.cap", False)
		self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char*1, "/shampoo/sdr/projects/gr-nordic/gmsk-correlate2.out")
		self.gr_file_sink_0_0.set_unbuffered(False)
		self.digital_gmsk_demod_0 = digital.gmsk_demod(
			samples_per_symbol=2,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			freq_error=0.0,
			verbose=False,
			log=False,
		)
		self.digital_correlate_access_code_bb_0_0 = digital.correlate_access_code_bb("010101010", 0)
		self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb("101010101", 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.gr_throttle_1, 0))
		self.connect((self.gr_throttle_1, 0), (self.digital_gmsk_demod_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.digital_correlate_access_code_bb_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.digital_correlate_access_code_bb_0_0, 0))
		self.connect((self.digital_correlate_access_code_bb_0_0, 0), (self.gr_or_xx_0, 1))
		self.connect((self.digital_correlate_access_code_bb_0, 0), (self.gr_or_xx_0, 0))
		self.connect((self.gr_or_xx_0, 0), (self.gr_file_sink_0_0, 0))
コード例 #47
0
    def __init__(self,
                 center_freq,
                 offset_freq,
                 decimate_am=1,
                 play_audio=False):
        """Configure the RTL-SDR and GNU Radio"""
        super(rtlsdr_am_stream, self).__init__()

        audio_rate = 44100
        device_rate = audio_rate * 25
        output_rate = audio_rate / float(decimate_am)
        self.rate = output_rate

        self.osmosdr_source = osmosdr.source_c("")
        self.osmosdr_source.set_center_freq(freq)
        self.osmosdr_source.set_sample_rate(device_rate)

        taps = firdes.low_pass(1, device_rate, 40000, 5000, firdes.WIN_HAMMING,
                               6.76)
        self.freq_filter = gr.freq_xlating_fir_filter_ccc(
            25, taps, -freq_offs, device_rate)

        self.am_demod = blks2.am_demod_cf(
            channel_rate=audio_rate,
            audio_decim=1,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.resampler = blks2.rational_resampler_fff(
            interpolation=1,
            decimation=decimate_am,
        )
        self.sink = gr_queue.queue_sink_f()

        self.connect(self.osmosdr_source, self.freq_filter, self.am_demod)
        self.connect(self.am_demod, self.resampler, self.sink)

        if play_audio:
            self.audio_sink = audio.sink(audio_rate, "", True)
            self.connect(self.am_demod, self.audio_sink)
コード例 #48
0
ファイル: simple_fm_rcv.py プロジェクト: rpgsystem/sdr
	def set_asrate(self, asrate):
		self.asrate = asrate
		self.gr_single_pole_iir_filter_xx_0.set_taps(1.0/(self.asrate/3))
		self.gr_keep_one_in_n_0.set_n(int(self.asrate/3))
		self.gr_fractional_interpolator_xx_0.set_interp_ratio(self.asrate/self.farate)
		self.gr_fft_filter_xxx_1.set_taps((firdes.low_pass(self.tone_low/10.0,self.asrate,1.2e3,500,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_1_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_1_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,15.0e3,5.0e3,firdes.WIN_HAMMING)))
		self.band_pass_filter_2_0.set_taps(firdes.band_pass(20, self.asrate, 17.5e3, 17.9e3, 250, firdes.WIN_HAMMING, 6.76))
		self.gr_fractional_interpolator_xx_0_0.set_interp_ratio(self.asrate/self.farate)
		self.band_pass_filter_2.set_taps(firdes.band_pass(10, self.asrate, 18.8e3, 19.2e3, 350, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.asrate)
		self.gr_fft_filter_xxx_0.set_taps((firdes.low_pass(self.tone_low/10.0,self.asrate,1.2e3,500,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_0_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,13.5e3,3.5e3,firdes.WIN_HAMMING)))
		self.low_pass_filter_0.set_taps(firdes.low_pass(3, self.asrate, 10e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_1.set_taps(firdes.low_pass(3, self.asrate/5, 1e3, 200, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_2.set_taps(firdes.low_pass(3, self.asrate/50, 100, 30, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_3.set_taps(firdes.low_pass(3, self.asrate/500, 10, 3, firdes.WIN_HAMMING, 6.76))
		self.gr_single_pole_iir_filter_xx_1.set_taps(2.5/(self.asrate/500))
		self.gr_fft_filter_xxx_0_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
		self.band_pass_filter_0_0.set_taps(firdes.band_pass(1, self.asrate, 38e3-(15e3), 38e3+(15e3), 4.0e3, firdes.WIN_HAMMING, 6.76))
コード例 #49
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))
コード例 #50
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter.set_taps(firdes.low_pass(1, self.samp_rate, 12500, 1500, firdes.WIN_HAMMING, 6.76))
コード例 #51
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76))
コード例 #52
0
	def __init__(self, talkgroup, options):
		gr.hier_block2.__init__(self, "fsk_demod",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
                                gr.io_signature(0, 0, gr.sizeof_char)) # Output signature

		#print "Starting log_receiver init()"
		self.samp_rate = samp_rate = int(options.rate)
		self.samp_per_sym = samp_per_sym = 5+1
		self.decim = decim = 20
		self.xlate_bandwidth = xlate_bandwidth = 24260.0
		self.xlate_offset = xlate_offset = 0
		self.channel_rate = channel_rate = op25.SYMBOL_RATE*samp_per_sym
		self.audio_mul = audio_mul = 2
		self.pre_channel_rate = pre_channel_rate = int(samp_rate/decim)


		self.auto_tune_offset = auto_tune_offset = 0	
		self.audiorate = 44100 #options.audiorate
		self.rate = options.rate
		self.talkgroup = talkgroup
		self.directory = options.directory

		if options.squelch is None:
			options.squelch = 28

		if options.volume is None:
			options.volume = 3.0


		##################################################
		# Message Queues
		##################################################
		op25_fsk4_0_msgq_out = baz_message_callback_0_msgq_in = gr.msg_queue(2)
		op25_decoder_simple_0_msgq_out = op25_traffic_pane_0_msgq_in = gr.msg_queue(2)

		##################################################
		# Blocks
		##################################################

		self.op25_fsk4_0 = op25.op25_fsk4(channel_rate=channel_rate, auto_tune_msgq=op25_fsk4_0_msgq_out,)
		self.op25_decoder_simple_0 = op25.op25_decoder_simple(key="",traffic_msgq=op25_decoder_simple_0_msgq_out,)
		self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf((channel_rate/(2.0 * math.pi * op25.SYMBOL_DEVIATION)))
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(decim, 
										       (firdes.low_pass(1, samp_rate, xlate_bandwidth/2, 4000)),
										       0, 
										       samp_rate)
		self.gr_fir_filter_xxx_0 = gr.fir_filter_fff(1, ((1.0/samp_per_sym,)*samp_per_sym))



		
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10.**(audio_mul/10.), ))
		self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_ccc(
			interpolation=channel_rate,
			decimation=pre_channel_rate,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=self.audiorate,
			decimation=8000,
			taps=None,
			fractional_bw=None,
		)
		self.baz_message_callback_0 = message_callback.message_callback(msgq=baz_message_callback_0_msgq_in,	callback=auto_tune_offset	, msg_part="arg1", custom_parts="",	dummy=False)
			

		#here we generate a random filename in the form /tmp/[random].wav, and then use it for the wavstamp block. this avoids collisions later on. remember to clean up these files when deallocating.

		self.tmpfilename = "/tmp/%s.wav" % ("".join([random.choice(string.letters+string.digits) for x in range(8)])) #if this looks glaringly different, it's because i totally cribbed it from a blog.

		self.valve = grc_blks2.valve(gr.sizeof_float, bool(1))


		#open the logfile for appending
		self.timestampfilename = "%s/%i.txt" % (self.directory, self.talkgroup)
		self.timestampfile = open(self.timestampfilename, 'a');

		self.filename = "%s/%i.wav" % (self.directory, self.talkgroup)
		self.audiosink = smartnet.wavsink(self.filename, 1, self.audiorate, 8) #this version allows appending to existing files.

		self.audio_sink_0 = audio.sink(44100, "", True)


		self.timestamp = 0.0

		#print "Finishing logging receiver init()."

		self.mute() #start off muted.



	##################################################
	# Connections
		##################################################
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_quadrature_demod_cf_0, 0))
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.gr_fir_filter_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))

		self.connect((self.gr_fir_filter_xxx_0, 0), (self.op25_fsk4_0, 0))
		self.connect((self.op25_fsk4_0, 0), (self.op25_decoder_simple_0, 0))
		self.connect((self.op25_decoder_simple_0, 0), (self.blks2_rational_resampler_xxx_0, 0))

		## Start
		self.connect(self, (self.gr_freq_xlating_fir_filter_xxx_0, 0))

		## End
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0,0))
コード例 #53
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Op25 Grc")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self._config_freq_config = ConfigParser.ConfigParser()
        self._config_freq_config.read(".grc_op25")
        try:
            config_freq = self._config_freq_config.getfloat("main", "freq")
        except:
            config_freq = 489075000
        self.config_freq = config_freq
        self.freq = freq = config_freq
        self._config_xlate_offset_config = ConfigParser.ConfigParser()
        self._config_xlate_offset_config.read(".grc_op25")
        try:
            config_xlate_offset = self._config_xlate_offset_config.getfloat(
                "main", "xlate_offset")
        except:
            config_xlate_offset = 0
        self.config_xlate_offset = config_xlate_offset
        self.click_freq = click_freq = freq - config_xlate_offset
        self.xlate_offset_fine = xlate_offset_fine = 0
        self.xlate_offset = xlate_offset = freq - click_freq
        self.samp_rate = samp_rate = 2000000
        self.samp_per_sym = samp_per_sym = 6
        self.decim = decim = 20
        self._config_xlate_bandwidth_config = ConfigParser.ConfigParser()
        self._config_xlate_bandwidth_config.read(".grc_op25")
        try:
            config_xlate_bandwidth = self._config_xlate_bandwidth_config.getfloat(
                "main", "xlate_bandwidth")
        except:
            config_xlate_bandwidth = 24000
        self.config_xlate_bandwidth = config_xlate_bandwidth
        self.auto_tune_offset = auto_tune_offset = 0
        self.xlate_bandwidth = xlate_bandwidth = config_xlate_bandwidth
        self.variable_static_text_0 = variable_static_text_0 = freq + xlate_offset + xlate_offset_fine + auto_tune_offset
        self.pre_channel_rate = pre_channel_rate = samp_rate / decim
        self.gain = gain = 20
        self.fine_click_freq = fine_click_freq = 0
        self.channel_rate = channel_rate = op25.SYMBOL_RATE * samp_per_sym
        self.auto_tune_offset_freq = auto_tune_offset_freq = auto_tune_offset * op25.SYMBOL_DEVIATION
        self.audio_mul = audio_mul = 0

        ##################################################
        # Message Queues
        ##################################################
        op25_decoder_simple_0_msgq_out = op25_traffic_pane_0_msgq_in = gr.msg_queue(
            2)
        op25_fsk4_0_msgq_out = baz_message_callback_0_msgq_in = gr.msg_queue(2)

        ##################################################
        # Blocks
        ##################################################
        _xlate_offset_fine_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlate_offset_fine_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_xlate_offset_fine_sizer,
            value=self.xlate_offset_fine,
            callback=self.set_xlate_offset_fine,
            label="Fine Offset",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._xlate_offset_fine_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_xlate_offset_fine_sizer,
            value=self.xlate_offset_fine,
            callback=self.set_xlate_offset_fine,
            minimum=-10000,
            maximum=10000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_xlate_offset_fine_sizer)
        self._xlate_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.xlate_offset,
            callback=self.set_xlate_offset,
            label="Xlate Offset",
            converter=forms.float_converter(),
        )
        self.Add(self._xlate_offset_text_box)
        _xlate_bandwidth_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlate_bandwidth_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_xlate_bandwidth_sizer,
            value=self.xlate_bandwidth,
            callback=self.set_xlate_bandwidth,
            label="Xlate BW",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._xlate_bandwidth_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_xlate_bandwidth_sizer,
            value=self.xlate_bandwidth,
            callback=self.set_xlate_bandwidth,
            minimum=5000,
            maximum=50000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_xlate_bandwidth_sizer)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB-1")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB-2")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Xlate-1")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Xlate-2")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "4FSK")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Dibits")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Traffic")
        self.Add(self.nb)
        _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",
            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=50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label="Frequency",
            converter=forms.float_converter(),
        )
        self.Add(self._freq_text_box)
        self._auto_tune_offset_freq_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.auto_tune_offset_freq,
            callback=self.set_auto_tune_offset_freq,
            label="Auto tune",
            converter=forms.float_converter(),
        )
        self.Add(self._auto_tune_offset_freq_static_text)
        _audio_mul_sizer = wx.BoxSizer(wx.VERTICAL)
        self._audio_mul_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_audio_mul_sizer,
            value=self.audio_mul,
            callback=self.set_audio_mul,
            label="Audio mul",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._audio_mul_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_audio_mul_sizer,
            value=self.audio_mul,
            callback=self.set_audio_mul,
            minimum=-30,
            maximum=10,
            num_steps=40,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_audio_mul_sizer)
        self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
            self.nb.GetPage(3).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=50,
            ref_scale=2.0,
            sample_rate=channel_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
        )
        self.nb.GetPage(3).Add(self.wxgui_waterfallsink2_0_0.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.nb.GetPage(1).GetWin(),
            baseband_freq=freq,
            dynamic_range=100,
            ref_level=50,
            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(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.nb.GetPage(4).GetWin(),
            title="Scope Plot",
            sample_rate=channel_rate,
            v_scale=1.5,
            v_offset=0,
            t_scale=0.05,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(4).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.nb.GetPage(5).GetWin(),
            title="Scope Plot",
            sample_rate=op25.SYMBOL_RATE,
            v_scale=1,
            v_offset=0,
            t_scale=0.05,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(5).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.nb.GetPage(2).GetWin(),
            baseband_freq=fine_click_freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=channel_rate,
            fft_size=1024,
            fft_rate=30,
            average=True,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0.win)

        def wxgui_fftsink2_0_0_callback(x, y):
            self.set_fine_click_freq(x)

        self.wxgui_fftsink2_0_0.set_callback(wxgui_fftsink2_0_0_callback)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.nb.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=30,
            average=True,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)

        def wxgui_fftsink2_0_callback(x, y):
            self.set_click_freq(x)

        self.wxgui_fftsink2_0.set_callback(wxgui_fftsink2_0_callback)
        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="Final freq",
            converter=forms.float_converter(),
        )
        self.Add(self._variable_static_text_0_static_text)
        self.osmosdr_source_c_0 = osmosdr.source_c(args="nchan=" + str(1) +
                                                   " " + "hackrf=0")
        self.osmosdr_source_c_0.set_sample_rate(samp_rate)
        self.osmosdr_source_c_0.set_center_freq(freq, 0)
        self.osmosdr_source_c_0.set_freq_corr(0, 0)
        self.osmosdr_source_c_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_c_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_c_0.set_gain_mode(0, 0)
        self.osmosdr_source_c_0.set_gain(14, 0)
        self.osmosdr_source_c_0.set_if_gain(gain, 0)
        self.osmosdr_source_c_0.set_bb_gain(gain, 0)
        self.osmosdr_source_c_0.set_antenna("", 0)
        self.osmosdr_source_c_0.set_bandwidth(0, 0)

        self.op25_traffic_pane_0 = op25_traffic_pane.TrafficPane(
            parent=self.nb.GetPage(6).GetWin(),
            msgq=op25_traffic_pane_0_msgq_in)
        self.nb.GetPage(6).Add(self.op25_traffic_pane_0)
        self.op25_fsk4_0 = op25.op25_fsk4(
            channel_rate=channel_rate,
            auto_tune_msgq=op25_fsk4_0_msgq_out,
        )
        self.op25_decoder_simple_0 = op25.op25_decoder_simple(
            key="",
            traffic_msgq=op25_decoder_simple_0_msgq_out,
        )
        self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(
            (channel_rate / (2.0 * math.pi * op25.SYMBOL_DEVIATION)))
        self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(
            decim, (firdes.low_pass(1, samp_rate, xlate_bandwidth / 2, 6000)),
            xlate_offset + xlate_offset_fine - fine_click_freq -
            auto_tune_offset_freq, samp_rate)
        self.gr_fir_filter_xxx_0 = gr.fir_filter_fff(
            1, ((1.0 / samp_per_sym, ) * samp_per_sym))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (10.**(audio_mul / 10.), ))
        self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_ccc(
            interpolation=channel_rate,
            decimation=pre_channel_rate,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=44100,
            decimation=8000,
            taps=None,
            fractional_bw=None,
        )
        self.baz_message_callback_0 = message_callback.message_callback(
            msgq=baz_message_callback_0_msgq_in,
            callback=auto_tune_offset,
            msg_part="arg1",
            custom_parts="",
            dummy=False)

        self.audio_sink_0 = audio.sink(44100, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.wxgui_waterfallsink2_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_quadrature_demod_cf_0, 0))
        self.connect((self.gr_quadrature_demod_cf_0, 0),
                     (self.gr_fir_filter_xxx_0, 0))
        self.connect((self.gr_fir_filter_xxx_0, 0),
                     (self.wxgui_scopesink2_1, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.gr_fir_filter_xxx_0, 0), (self.op25_fsk4_0, 0))
        self.connect((self.op25_decoder_simple_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.op25_fsk4_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.osmosdr_source_c_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_c_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.osmosdr_source_c_0, 0),
                     (self.gr_freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.op25_fsk4_0, 0), (self.op25_decoder_simple_0, 0))
コード例 #54
0
	def __init__(self,infile, outfile, input_rate, channel_rate, codec_provoice, codec_p25, sslevel, svlevel):
		gr.top_block.__init__(self, "Top Block")
		
		self.input_rate = input_rate
		self.channel_rate = channel_rate
		
		self.source = blocks.file_source(gr.sizeof_gr_complex*1, infile, False)
		self.lp1_decim = int(input_rate/(channel_rate*1.6))
		print self.lp1_decim
		self.lp1 = filter.fir_filter_ccc(self.lp1_decim,firdes.low_pass( 1.0, self.input_rate, (self.channel_rate/2), ((self.channel_rate/2)*0.6), firdes.WIN_HAMMING))

		#self.audiodemod =  gr.quadrature_demod_cf(1)

		audio_pass = (input_rate/self.lp1_decim)*0.25
		audio_stop = audio_pass+2000
		self.audiodemod = analog.fm_demod_cf(channel_rate=(input_rate/self.lp1_decim), audio_decim=1, deviation=15000, audio_pass=audio_pass, audio_stop=audio_stop, gain=8, tau=75e-6)
		
		self.throttle = blocks.throttle(gr.sizeof_gr_complex*1, self.input_rate)

		self.signal_squelch = analog.pwr_squelch_cc(sslevel,0.01, 0, True)
		self.vox_squelch = analog.pwr_squelch_ff(svlevel, 0.0005, 0, True)
		
		self.audiosink = blocks.wavfile_sink(outfile, 1, 8000)

		if codec_provoice:
			self.dsd = dsd.block_ff(dsd.dsd_FRAME_PROVOICE,dsd.dsd_MOD_AUTO_SELECT,1,0,False)
			channel_rate = input_rate/self.lp1_decim
			self.resampler_in = filter.rational_resampler_fff(interpolation=48000, decimation=channel_rate, taps=None, fractional_bw=None, )
			output_rate = 8000
			resampler = filter.rational_resampler_fff(
                                        interpolation=(input_rate/self.lp1_decim),
                                        decimation=output_rate,
                                        taps=None,
                                        fractional_bw=None,
                                )
		elif codec_p25:
			symbol_deviation = 600.0
			symbol_rate = 4800
			channel_rate = input_rate/self.lp1_decim
			
		        fm_demod_gain = channel_rate / (2.0 * pi * symbol_deviation)
		        fm_demod = analog.quadrature_demod_cf(fm_demod_gain)

		        symbol_decim = 1
		        samples_per_symbol = channel_rate // symbol_rate
		        symbol_coeffs = (1.0/samples_per_symbol,) * samples_per_symbol
		        symbol_filter = filter.fir_filter_fff(symbol_decim, symbol_coeffs)

		        autotuneq = gr.msg_queue(2)
		        demod_fsk4 = op25.fsk4_demod_ff(autotuneq, channel_rate, symbol_rate)


		        # symbol slicer
		        levels = [ -2.0, 0.0, 2.0, 4.0 ]
		        slicer = op25.fsk4_slicer_fb(levels)

			imbe = repeater.vocoder(False, True, 0, "", 0, False)
			self.decodequeue = decodequeue = gr.msg_queue(10000)
			decoder = repeater.p25_frame_assembler('', 0, 0, True, True, False, decodequeue)
	
		        float_conversion = blocks.short_to_float(1, 8192)
		        resampler = filter.rational_resampler_fff(
		                        interpolation=8000,
		                        decimation=8000,
		                        taps=None,
		                        fractional_bw=None,
		                )
	
					
		#Tone squelch, custom GRC block that rips off CTCSS squelch to detect 4800 hz tone and latch squelch after that
		if not codec_provoice and not codec_p25:
			#self.tone_squelch = gr.tone_squelch_ff(audiorate, 4800.0, 0.05, 300, 0, True)
			#tone squelch is EDACS ONLY
			self.high_pass = filter.fir_filter_fff(1, firdes.high_pass(1, (input_rate/self.lp1_decim), 300, 30, firdes.WIN_HAMMING, 6.76))
			#output_rate = channel_rate
			resampler = filter.rational_resampler_fff(
                                        interpolation=8000,
                                        decimation=(input_rate/self.lp1_decim),
                                        taps=None,
                                        fractional_bw=None,
			)
		if(codec_provoice):
			self.connect(self.source, self.throttle, self.lp1, self.audiodemod, self.resampler_in, self.dsd, self.audiosink)
		elif(codec_p25):
			self.connect(self.source, self.throttle, self.lp1, fm_demod, symbol_filter, demod_fsk4, slicer, decoder, imbe, float_conversion, resampler, self.audiosink)
		else:
			self.connect(self.source, self.throttle, self.lp1, self.signal_squelch, self.audiodemod, self.high_pass, self.vox_squelch, resampler, self.audiosink)

		self.time_open = time.time()
		self.time_tone = 0
		self.time_activity = 0
コード例 #55
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Example bitcpf - 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 = 8e6
        self.rx_gain = rx_gain = 15
        self.lpf_decim = lpf_decim = 20
        self.freq = freq = 106.7e6
        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(
            device_addr="",
            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(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_0 = gr.fir_filter_ccf(
            lpf_decim,
            firdes.low_pass(1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                            6.76))
        self.gr_wavfile_sink_0 = gr.wavfile_sink("fm_record.wav", 1,
                                                 int(audio_samp_rate), 8)
        self.blks2_wfm_rcv_0 = blks2.wfm_rcv(
            quad_rate=samp_rate / lpf_decim,
            audio_decimation=1,
        )
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=96,
            decimation=int(samp_rate / lpf_decim / 1000),
            taps=None,
            fractional_bw=None,
        )
        self.audio_sink_0 = audio.sink(int(audio_samp_rate), "", True)

        ##################################################
        # Connections
        ##################################################
        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_rational_resampler_xxx_0, 0),
                     (self.gr_wavfile_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blks2_wfm_rcv_0, 0), (self.wxgui_fftsink2_1, 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))