Commit 0a632561 authored by Mark Jessop's avatar Mark Jessop

Updated fm_demod to calculate filter width using Carson's rule.

parent cb610f17
......@@ -178,7 +178,7 @@ SDR received samples</value>
</param>
<param>
<key>_coordinate</key>
<value>(781, 865)</value>
<value>(928, 1028)</value>
</param>
<param>
<key>_rotation</key>
......@@ -220,6 +220,33 @@ SDR received samples</value>
<value>250000</value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(1040, 1028)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>max_modulation_freq</value>
</param>
<param>
<key>value</key>
<value>3000</value>
</param>
</block>
<block>
<key>variable</key>
<param>
......@@ -537,108 +564,6 @@ TX sampling rate</value>
<value>ccc</value>
</param>
</block>
<block>
<key>blocks_float_to_short</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(696, 532)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>blocks_float_to_short_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>scale</key>
<value>32767</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>blocks_udp_sink</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>ipaddr</key>
<value>127.0.0.1</value>
</param>
<param>
<key>port</key>
<value>7355</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(384, 512)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>blocks_udp_sink_0</value>
</param>
<param>
<key>type</key>
<value>short</value>
</param>
<param>
<key>psize</key>
<value>1472</value>
</param>
<param>
<key>eof</key>
<value>False</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
......@@ -1055,8 +980,10 @@ we shift the LO a little further</value>
</param>
<param>
<key>comment</key>
<value>16 kHz filter width, about right
for a standard 5 kHz Dev FM signal.</value>
<value>Using the Carson bandwidth rule for filter width:
width = 2*(deviation + max_modulation_freq).
For the majority of FM transmissions we can expect
max_modulation_freq = 3000</value>
</param>
<param>
<key>affinity</key>
......@@ -1064,7 +991,7 @@ for a standard 5 kHz Dev FM signal.</value>
</param>
<param>
<key>cutoff_freq</key>
<value>8000</value>
<value>deviation+max_modulation_freq</value>
</param>
<param>
<key>decim</key>
......@@ -3035,12 +2962,6 @@ for a standard 5 kHz Dev FM signal.</value>
<value>/tmp/waterfall.dat</value>
</param>
</block>
<connection>
<source_block_id>analog_quadrature_demod_cf_0</source_block_id>
<sink_block_id>blocks_float_to_short_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_quadrature_demod_cf_0</source_block_id>
<sink_block_id>satnogs_ogg_encoder_0</sink_block_id>
......@@ -3065,12 +2986,6 @@ for a standard 5 kHz Dev FM signal.</value>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_float_to_short_0</source_block_id>
<sink_block_id>blocks_udp_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>freq_xlating_fir_filter_xxx_0</source_block_id>
<sink_block_id>blks2_rational_resampler_xxx_1</sink_block_id>
......
......@@ -5,11 +5,10 @@
# Title: FM Generic Demodulation
# Author: Manolis Surligas (surligas@gmail.com)
# Description: A generic FM demodulation block
# Generated: Sun Sep 17 05:13:50 2017
# Generated: Thu Sep 21 10:50:12 2017
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
......@@ -55,6 +54,7 @@ class satnogs_fm_demod(gr.top_block):
self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76)
self.max_modulation_freq = max_modulation_freq = 3000
self.filter_rate = filter_rate = 250000
self.deviation = deviation = 5000
self.audio_samp_rate = audio_samp_rate = 48000
......@@ -82,10 +82,8 @@ class satnogs_fm_demod(gr.top_block):
self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)
self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
1, audio_samp_rate, 8000, 3000, firdes.WIN_HAMMING, 6.76))
1, audio_samp_rate, deviation+max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76))
self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx)
self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short*1, '127.0.0.1', 7355, 1472, False)
self.blocks_float_to_short_0 = blocks.float_to_short(1, 32767)
self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
interpolation=24,
decimation=125,
......@@ -98,12 +96,10 @@ class satnogs_fm_demod(gr.top_block):
# Connections
##################################################
self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_float_to_short_0, 0))
self.connect((self.analog_quadrature_demod_cf_0, 0), (self.satnogs_ogg_encoder_0, 0))
self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.low_pass_filter_0, 0))
self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_iq_sink_0, 0))
self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_waterfall_sink_0, 0))
self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0))
self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
......@@ -242,6 +238,13 @@ class satnogs_fm_demod(gr.top_block):
def set_taps(self, taps):
self.taps = taps
def get_max_modulation_freq(self):
return self.max_modulation_freq
def set_max_modulation_freq(self, max_modulation_freq):
self.max_modulation_freq = max_modulation_freq
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.audio_samp_rate, self.deviation+self.max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76))
def get_filter_rate(self):
return self.filter_rate
......@@ -253,6 +256,7 @@ class satnogs_fm_demod(gr.top_block):
def set_deviation(self, deviation):
self.deviation = deviation
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.audio_samp_rate, self.deviation+self.max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76))
self.analog_quadrature_demod_cf_0.set_gain((2*math.pi*self.deviation)/self.audio_samp_rate)
def get_audio_samp_rate(self):
......@@ -260,7 +264,7 @@ class satnogs_fm_demod(gr.top_block):
def set_audio_samp_rate(self, audio_samp_rate):
self.audio_samp_rate = audio_samp_rate
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.audio_samp_rate, 8000, 3000, firdes.WIN_HAMMING, 6.76))
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.audio_samp_rate, self.deviation+self.max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76))
self.analog_quadrature_demod_cf_0.set_gain((2*math.pi*self.deviation)/self.audio_samp_rate)
def get_audio_gain(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment