|
@@ -1,12 +1,10 @@
|
|
|
#!/usr/bin/env python3
|
|
|
# -*- coding: utf-8 -*-
|
|
|
-
|
|
|
#
|
|
|
# SPDX-License-Identifier: GPL-3.0
|
|
|
#
|
|
|
# GNU Radio Python Flow Graph
|
|
|
# Title: FM Radio Receiver
|
|
|
-# GNU Radio version: 3.10.5.1
|
|
|
|
|
|
from gnuradio import analog
|
|
|
from gnuradio import audio
|
|
@@ -27,17 +25,12 @@ class fm_radio(gr.top_block):
|
|
|
def __init__(self):
|
|
|
gr.top_block.__init__(self, "FM Radio Receiver", catch_exceptions=True)
|
|
|
|
|
|
- ##################################################
|
|
|
# Variables
|
|
|
- ##################################################
|
|
|
self.samp_rate = samp_rate = 2560000
|
|
|
self.channel_width_hertz = channel_width_hertz = 250000
|
|
|
self.audio_sample_rate_hertz = audio_sample_rate_hertz = 48000
|
|
|
|
|
|
- ##################################################
|
|
|
# Blocks
|
|
|
- ##################################################
|
|
|
-
|
|
|
self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "")
|
|
|
self.rtlsdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
|
|
|
self.rtlsdr_source_0.set_sample_rate(samp_rate)
|
|
@@ -67,36 +60,12 @@ class fm_radio(gr.top_block):
|
|
|
audio_decimation=1,
|
|
|
)
|
|
|
|
|
|
- ##################################################
|
|
|
# Connections
|
|
|
- ##################################################
|
|
|
self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0))
|
|
|
self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
|
|
|
self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
|
|
|
self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
|
|
|
|
|
|
- def get_samp_rate(self):
|
|
|
- return self.samp_rate
|
|
|
-
|
|
|
- def set_samp_rate(self, samp_rate):
|
|
|
- self.samp_rate = samp_rate
|
|
|
- self.low_pass_filter_0.set_taps(
|
|
|
- firdes.low_pass(2, self.samp_rate, 100000, 10000, window.WIN_KAISER, 6.76)
|
|
|
- )
|
|
|
- self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
|
|
|
-
|
|
|
- def get_channel_width_hertz(self):
|
|
|
- return self.channel_width_hertz
|
|
|
-
|
|
|
- def set_channel_width_hertz(self, channel_width_hertz):
|
|
|
- self.channel_width_hertz = channel_width_hertz
|
|
|
-
|
|
|
- def get_audio_sample_rate_hertz(self):
|
|
|
- return self.audio_sample_rate_hertz
|
|
|
-
|
|
|
- def set_audio_sample_rate_hertz(self, audio_sample_rate_hertz):
|
|
|
- self.audio_sample_rate_hertz = audio_sample_rate_hertz
|
|
|
-
|
|
|
|
|
|
def main(top_block_cls=fm_radio, options=None):
|
|
|
tb = top_block_cls()
|