From 719cdac4aad79c3923aa0bd8d78bc427b2917291 Mon Sep 17 00:00:00 2001 From: mer0m Date: Sat, 18 Mar 2017 09:59:51 +0100 Subject: [PATCH] minor modif --- sdr/fm_radio/fm_radio.grc | 77 +++++++++++++++++++--- sdr/fm_radio/fm_radio.py | 53 +++++++++------ sdr/fm_radio/fm_radio_comp_decim_lpf.grc | 16 ++--- ...fm_radio_comp.py => fm_radio_comp_decim_lpf.py} | 50 +++++--------- 4 files changed, 126 insertions(+), 70 deletions(-) rename sdr/fm_radio/{fm_radio_comp.py => fm_radio_comp_decim_lpf.py} (85%) diff --git a/sdr/fm_radio/fm_radio.grc b/sdr/fm_radio/fm_radio.grc index 2617a9e..548e38e 100644 --- a/sdr/fm_radio/fm_radio.grc +++ b/sdr/fm_radio/fm_radio.grc @@ -89,7 +89,7 @@ value - 91e6 + 160011000 _enabled @@ -129,7 +129,7 @@ step - 1e6 + 1e3 stop @@ -265,6 +265,53 @@ int(samp_rate) + + blocks_wavfile_sink + + bits_per_sample + 16 + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + file + a.wav + + + _coordinate + (1104, 528) + + + _rotation + 0 + + + id + blocks_wavfile_sink_0 + + + nchan + 1 + + + samp_rate + int(samp_rate) + + low_pass_filter @@ -293,7 +340,7 @@ _enabled - 0 + 1 type @@ -368,7 +415,7 @@ _enabled - 0 + 1 type @@ -443,7 +490,7 @@ _enabled - 0 + 1 fftsize @@ -629,11 +676,11 @@ decim - 10 + 4 _enabled - 1 + 0 fbw @@ -688,11 +735,11 @@ decim - 4 + 10 _enabled - 1 + 0 fbw @@ -2168,12 +2215,24 @@ 0 0 + + low_pass_filter_0_0 + blocks_wavfile_sink_0 + 0 + 0 + rational_resampler_xxx_0 audio_sink_0 0 0 + + rational_resampler_xxx_0 + blocks_wavfile_sink_0 + 0 + 0 + rational_resampler_xxx_0_0 analog_wfm_rcv_0 diff --git a/sdr/fm_radio/fm_radio.py b/sdr/fm_radio/fm_radio.py index 18def04..8ae9f4a 100755 --- a/sdr/fm_radio/fm_radio.py +++ b/sdr/fm_radio/fm_radio.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Fm Radio -# Generated: Thu Mar 16 21:47:51 2017 +# Generated: Fri Mar 17 17:36:39 2017 ################################################## if __name__ == '__main__': @@ -62,12 +62,12 @@ class fm_radio(gr.top_block, Qt.QWidget): # Variables ################################################## self.samp_rate = samp_rate = 48e3 - self.freq = freq = 91e6 + self.freq = freq = 160011000 ################################################## # Blocks ################################################## - self._freq_range = Range(52e6, 2e9, 1e6, 91e6, 200) + self._freq_range = Range(52e6, 2e9, 1e3, 160011000, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win, 0,0) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) @@ -83,18 +83,6 @@ class fm_radio(gr.top_block, Qt.QWidget): self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) - self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( - interpolation=1, - decimation=4, - taps=None, - fractional_bw=None, - ) - self.rational_resampler_xxx_0 = filter.rational_resampler_fff( - interpolation=1, - decimation=10, - taps=None, - fractional_bw=None, - ) self.qtgui_sink_x_1 = qtgui.sink_f( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -114,6 +102,29 @@ class fm_radio(gr.top_block, Qt.QWidget): + self.qtgui_sink_x_0 = qtgui.sink_c( + 1024, #fftsize + firdes.WIN_BLACKMAN_hARRIS, #wintype + 0, #fc + samp_rate*10*4, #bw + "", #name + True, #plotfreq + True, #plotwaterfall + True, #plottime + True, #plotconst + ) + self.qtgui_sink_x_0.set_update_time(1.0/10) + self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win, 9,0) + + self.qtgui_sink_x_0.enable_rf_freq(False) + + + + self.low_pass_filter_0_0 = filter.fir_filter_fff(10, firdes.low_pass( + 1, samp_rate*10, samp_rate*2, 1e4, firdes.WIN_HAMMING, 6.76)) + self.low_pass_filter_0 = filter.fir_filter_ccf(4, firdes.low_pass( + 1, samp_rate*10*4, 500e3, 10e3, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(int(samp_rate), '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate*10, @@ -123,11 +134,12 @@ class fm_radio(gr.top_block, Qt.QWidget): ################################################## # Connections ################################################## + self.connect((self.analog_wfm_rcv_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_sink_x_1, 0)) - self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0)) - self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) - self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_wfm_rcv_0, 0)) - self.connect((self.rtlsdr_source_0, 0), (self.rational_resampler_xxx_0_0, 0)) + self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0)) + self.connect((self.low_pass_filter_0_0, 0), (self.audio_sink_0, 0)) + self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0)) + self.connect((self.rtlsdr_source_0, 0), (self.qtgui_sink_x_0, 0)) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "fm_radio") @@ -141,6 +153,9 @@ class fm_radio(gr.top_block, Qt.QWidget): self.samp_rate = samp_rate self.rtlsdr_source_0.set_sample_rate(self.samp_rate*10*4) self.qtgui_sink_x_1.set_frequency_range(0, self.samp_rate*10) + self.qtgui_sink_x_0.set_frequency_range(0, self.samp_rate*10*4) + self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate*10, self.samp_rate*2, 1e4, firdes.WIN_HAMMING, 6.76)) + self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate*10*4, 500e3, 10e3, firdes.WIN_HAMMING, 6.76)) def get_freq(self): return self.freq diff --git a/sdr/fm_radio/fm_radio_comp_decim_lpf.grc b/sdr/fm_radio/fm_radio_comp_decim_lpf.grc index 70974a9..665255d 100644 --- a/sdr/fm_radio/fm_radio_comp_decim_lpf.grc +++ b/sdr/fm_radio/fm_radio_comp_decim_lpf.grc @@ -46,7 +46,7 @@ id - fm_radio_comp + fm_radio_comp_decim_lpf max_nouts @@ -129,7 +129,7 @@ step - 1e6 + 1e5 stop @@ -285,7 +285,7 @@ _enabled - 0 + 1 _coordinate @@ -332,7 +332,7 @@ cutoff_freq - 500e3 + 100e3 decim @@ -380,7 +380,7 @@ width - 10e3 + 1e3 win @@ -407,7 +407,7 @@ cutoff_freq - samp_rate*2 + 96e3 decim @@ -455,7 +455,7 @@ width - 1e4 + 1e3 win @@ -789,7 +789,7 @@ _enabled - 1 + 0 fftsize diff --git a/sdr/fm_radio/fm_radio_comp.py b/sdr/fm_radio/fm_radio_comp_decim_lpf.py similarity index 85% rename from sdr/fm_radio/fm_radio_comp.py rename to sdr/fm_radio/fm_radio_comp_decim_lpf.py index 76a01b5..270a37a 100755 --- a/sdr/fm_radio/fm_radio_comp.py +++ b/sdr/fm_radio/fm_radio_comp_decim_lpf.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph -# Title: Fm Radio Comp -# Generated: Thu Mar 16 21:47:10 2017 +# Title: Fm Radio Comp Decim Lpf +# Generated: Sat Mar 18 09:58:42 2017 ################################################## if __name__ == '__main__': @@ -18,6 +18,7 @@ if __name__ == '__main__': from PyQt4 import Qt from gnuradio import analog +from gnuradio import audio from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr @@ -32,12 +33,12 @@ import sys import time -class fm_radio_comp(gr.top_block, Qt.QWidget): +class fm_radio_comp_decim_lpf(gr.top_block, Qt.QWidget): def __init__(self): - gr.top_block.__init__(self, "Fm Radio Comp") + gr.top_block.__init__(self, "Fm Radio Comp Decim Lpf") Qt.QWidget.__init__(self) - self.setWindowTitle("Fm Radio Comp") + self.setWindowTitle("Fm Radio Comp Decim Lpf") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: @@ -54,7 +55,7 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) - self.settings = Qt.QSettings("GNU Radio", "fm_radio_comp") + self.settings = Qt.QSettings("GNU Radio", "fm_radio_comp_decim_lpf") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## @@ -66,7 +67,7 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): ################################################## # Blocks ################################################## - self._freq_range = Range(1e6, 2e9, 1e6, 91e6, 200) + self._freq_range = Range(1e6, 2e9, 1e5, 91e6, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win, 0,0) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) @@ -94,25 +95,6 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): taps=None, fractional_bw=None, ) - self.qtgui_sink_x_0 = qtgui.sink_c( - 1024, #fftsize - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate*10*4, #bw - "", #name - True, #plotfreq - True, #plotwaterfall - True, #plottime - True, #plotconst - ) - self.qtgui_sink_x_0.set_update_time(1.0/10) - self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win, 9,0) - - self.qtgui_sink_x_0.enable_rf_freq(False) - - - self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -157,9 +139,10 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 12,0) self.low_pass_filter_0_0 = filter.fir_filter_fff(10, firdes.low_pass( - 1, samp_rate*10, samp_rate*2, 1e4, firdes.WIN_HAMMING, 6.76)) + 1, samp_rate*10, 96e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(4, firdes.low_pass( - 1, samp_rate*10*4, 500e3, 10e3, firdes.WIN_HAMMING, 6.76)) + 1, samp_rate*10*4, 100e3, 1e3, firdes.WIN_HAMMING, 6.76)) + self.audio_sink_0 = audio.sink(int(samp_rate), '', True) self.analog_wfm_rcv_0_0 = analog.wfm_rcv( quad_rate=samp_rate*10, audio_decimation=1, @@ -176,14 +159,14 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): self.connect((self.analog_wfm_rcv_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) + self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0)) - self.connect((self.rtlsdr_source_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.rational_resampler_xxx_0_0, 0)) def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "fm_radio_comp") + self.settings = Qt.QSettings("GNU Radio", "fm_radio_comp_decim_lpf") self.settings.setValue("geometry", self.saveGeometry()) event.accept() @@ -193,10 +176,9 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.rtlsdr_source_0.set_sample_rate(self.samp_rate*10*4) - self.qtgui_sink_x_0.set_frequency_range(0, self.samp_rate*10*4) self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate) - self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate*10, self.samp_rate*2, 1e4, firdes.WIN_HAMMING, 6.76)) - self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate*10*4, 500e3, 10e3, firdes.WIN_HAMMING, 6.76)) + self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate*10, 96e3, 1e3, firdes.WIN_HAMMING, 6.76)) + self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate*10*4, 100e3, 1e3, firdes.WIN_HAMMING, 6.76)) def get_freq(self): return self.freq @@ -206,7 +188,7 @@ class fm_radio_comp(gr.top_block, Qt.QWidget): self.rtlsdr_source_0.set_center_freq(self.freq, 0) -def main(top_block_cls=fm_radio_comp, options=None): +def main(top_block_cls=fm_radio_comp_decim_lpf, options=None): from distutils.version import StrictVersion if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): -- 2.16.4