diff --git a/fm_radio/fm_radio.grc b/fm_radio/fm_radio.grc
index 3aa68e5..7408b17 100644
--- a/fm_radio/fm_radio.grc
+++ b/fm_radio/fm_radio.grc
@@ -81,6 +81,33 @@
+
+ variable
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (176, 160)
+
+
+ _rotation
+ 0
+
+
+ id
+ decim
+
+
+ value
+ 4
+
+
variable_qtgui_range
@@ -89,7 +116,7 @@
value
- 100e6
+ 98.7e6
_enabled
@@ -168,7 +195,7 @@
value
- 2e6
+ 48e3
@@ -195,7 +222,7 @@
_coordinate
- (624, 448)
+ (608, 448)
_rotation
@@ -215,7 +242,7 @@
quad_rate
- 500e3
+ samp_rate*10
@@ -242,7 +269,7 @@
_coordinate
- (1032, 456)
+ (1104, 456)
_rotation
@@ -262,89 +289,14 @@
samp_rate
- 48000
-
-
-
- low_pass_filter
-
- beta
- 6.76
-
-
- alias
-
-
-
- comment
-
-
-
- affinity
-
-
-
- cutoff_freq
- 500e3
-
-
- decim
- 4
-
-
- _enabled
- True
-
-
- type
- fir_filter_ccf
-
-
- _coordinate
- (408, 408)
-
-
- _rotation
- 0
-
-
- gain
- 1
-
-
- id
- low_pass_filter_0
-
-
- interp
- 1
-
-
- maxoutbuf
- 0
-
-
- minoutbuf
- 0
-
-
- samp_rate
- samp_rate
-
-
- width
- 1e6
-
-
- win
- firdes.WIN_HAMMING
+ int(samp_rate)
qtgui_sink_x
bw
- samp_rate
+ samp_rate*10*4
alias
@@ -368,7 +320,7 @@
_enabled
- True
+ 0
fftsize
@@ -376,7 +328,7 @@
_coordinate
- (392, 584)
+ (392, 184)
gui_hint
@@ -443,7 +395,7 @@
qtgui_sink_x
bw
- samp_rate/4
+ samp_rate/decim
alias
@@ -475,7 +427,7 @@
_coordinate
- (632, 584)
+ (840, 176)
gui_hint
@@ -487,7 +439,7 @@
id
- qtgui_sink_x_0_0
+ qtgui_sink_x_1
maxoutbuf
@@ -527,7 +479,7 @@
type
- complex
+ float
rate
@@ -554,11 +506,11 @@
decim
- 500
+ 10
_enabled
- True
+ 1
fbw
@@ -566,7 +518,7 @@
_coordinate
- (824, 432)
+ (848, 432)
_rotation
@@ -578,7 +530,7 @@
interp
- 48
+ 1
maxoutbuf
@@ -597,6 +549,65 @@
fff
+
+ rational_resampler_xxx
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ decim
+ 4
+
+
+ _enabled
+ 1
+
+
+ fbw
+ 0
+
+
+ _coordinate
+ (400, 432)
+
+
+ _rotation
+ 0
+
+
+ id
+ rational_resampler_xxx_0_0
+
+
+ interp
+ 1
+
+
+ maxoutbuf
+ 0
+
+
+ minoutbuf
+ 0
+
+
+ taps
+
+
+
+ type
+ ccc
+
+
rtlsdr_source
@@ -1897,7 +1908,7 @@
_enabled
- True
+ 1
_coordinate
@@ -1997,7 +2008,7 @@
sample_rate
- samp_rate
+ samp_rate*10*4
sync
@@ -2006,37 +2017,37 @@
analog_wfm_rcv_0
- rational_resampler_xxx_0
+ qtgui_sink_x_1
0
0
- low_pass_filter_0
- analog_wfm_rcv_0
+ analog_wfm_rcv_0
+ rational_resampler_xxx_0
0
0
- low_pass_filter_0
- qtgui_sink_x_0_0
+ rational_resampler_xxx_0
+ audio_sink_0
0
0
- rational_resampler_xxx_0
- audio_sink_0
+ rational_resampler_xxx_0_0
+ analog_wfm_rcv_0
0
0
rtlsdr_source_0
- low_pass_filter_0
+ qtgui_sink_x_0
0
0
rtlsdr_source_0
- qtgui_sink_x_0
+ rational_resampler_xxx_0_0
0
0
diff --git a/fm_radio/top_block.py b/fm_radio/top_block.py
new file mode 100755
index 0000000..7823372
--- /dev/null
+++ b/fm_radio/top_block.py
@@ -0,0 +1,181 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+##################################################
+# GNU Radio Python Flow Graph
+# Title: Top Block
+# Generated: Thu Mar 16 08:57:41 2017
+##################################################
+
+if __name__ == '__main__':
+ import ctypes
+ import sys
+ if sys.platform.startswith('linux'):
+ try:
+ x11 = ctypes.cdll.LoadLibrary('libX11.so')
+ x11.XInitThreads()
+ except:
+ print "Warning: failed to XInitThreads()"
+
+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
+from gnuradio import qtgui
+from gnuradio.eng_option import eng_option
+from gnuradio.filter import firdes
+from gnuradio.qtgui import Range, RangeWidget
+from optparse import OptionParser
+import osmosdr
+import sip
+import sys
+import time
+
+
+class top_block(gr.top_block, Qt.QWidget):
+
+ def __init__(self):
+ gr.top_block.__init__(self, "Top Block")
+ Qt.QWidget.__init__(self)
+ self.setWindowTitle("Top Block")
+ try:
+ self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+ except:
+ pass
+ self.top_scroll_layout = Qt.QVBoxLayout()
+ self.setLayout(self.top_scroll_layout)
+ self.top_scroll = Qt.QScrollArea()
+ self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
+ self.top_scroll_layout.addWidget(self.top_scroll)
+ self.top_scroll.setWidgetResizable(True)
+ self.top_widget = Qt.QWidget()
+ self.top_scroll.setWidget(self.top_widget)
+ self.top_layout = Qt.QVBoxLayout(self.top_widget)
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
+
+ self.settings = Qt.QSettings("GNU Radio", "top_block")
+ self.restoreGeometry(self.settings.value("geometry").toByteArray())
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.samp_rate = samp_rate = 48e3
+ self.freq = freq = 98.7e6
+ self.decim = decim = 4
+
+ ##################################################
+ # Blocks
+ ##################################################
+ self._freq_range = Range(55e6, 200e6, 0.1e6, 98.7e6, 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) + " " + '' )
+ self.rtlsdr_source_0.set_sample_rate(samp_rate*10*4)
+ self.rtlsdr_source_0.set_center_freq(freq, 0)
+ self.rtlsdr_source_0.set_freq_corr(0, 0)
+ self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
+ self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
+ self.rtlsdr_source_0.set_gain_mode(False, 0)
+ self.rtlsdr_source_0.set_gain(20, 0)
+ self.rtlsdr_source_0.set_if_gain(20, 0)
+ self.rtlsdr_source_0.set_bb_gain(20, 0)
+ self.rtlsdr_source_0.set_antenna('', 0)
+ self.rtlsdr_source_0.set_bandwidth(0, 0)
+
+ self.rational_resampler_xxx_0_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
+ 0, #fc
+ samp_rate/decim, #bw
+ "", #name
+ True, #plotfreq
+ True, #plotwaterfall
+ True, #plottime
+ True, #plotconst
+ )
+ self.qtgui_sink_x_1.set_update_time(1.0/10)
+ self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
+ self.top_grid_layout.addWidget(self._qtgui_sink_x_1_win, 10,0)
+
+ self.qtgui_sink_x_1.enable_rf_freq(False)
+
+
+
+ self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
+ self.analog_wfm_rcv_0 = analog.wfm_rcv(
+ quad_rate=samp_rate*10,
+ audio_decimation=1,
+ )
+
+ ##################################################
+ # Connections
+ ##################################################
+ 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))
+
+ def closeEvent(self, event):
+ self.settings = Qt.QSettings("GNU Radio", "top_block")
+ self.settings.setValue("geometry", self.saveGeometry())
+ event.accept()
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ 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_1.set_frequency_range(0, self.samp_rate/self.decim)
+
+ def get_freq(self):
+ return self.freq
+
+ def set_freq(self, freq):
+ self.freq = freq
+ self.rtlsdr_source_0.set_center_freq(self.freq, 0)
+
+ def get_decim(self):
+ return self.decim
+
+ def set_decim(self, decim):
+ self.decim = decim
+ self.qtgui_sink_x_1.set_frequency_range(0, self.samp_rate/self.decim)
+
+
+def main(top_block_cls=top_block, options=None):
+
+ from distutils.version import StrictVersion
+ if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
+ style = gr.prefs().get_string('qtgui', 'style', 'raster')
+ Qt.QApplication.setGraphicsSystem(style)
+ qapp = Qt.QApplication(sys.argv)
+
+ tb = top_block_cls()
+ tb.start()
+ tb.show()
+
+ def quitting():
+ tb.stop()
+ tb.wait()
+ qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
+ qapp.exec_()
+
+
+if __name__ == '__main__':
+ main()