Skip to content

Commit

Permalink
Merge pull request #458 from leee/leee-analog-audio-bandpass
Browse files Browse the repository at this point in the history
Add low pass filter to analog recorder audio flow
  • Loading branch information
robotastic committed May 15, 2021
2 parents 3338bb3 + 2e0412f commit 9da5508
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions trunk-recorder/recorders/analog_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ analog_recorder::analog_recorder(Source *src)
squelch_two = gr::analog::pwr_squelch_ff::make(-200, 0.01, 0, true);

// k = quad_rate/(2*math.pi*max_dev) = 48k / (6.283185*5000) = 1.527

int d_max_dev = 5000;
/* demodulator gain */
quad_gain = system_channel_rate / (2.0 * M_PI * d_max_dev);
Expand Down Expand Up @@ -164,9 +164,14 @@ analog_recorder::analog_recorder(Source *src)
decoder_sink = gr::blocks::decoder_wrapper_impl::make(wave_sample_rate, src->get_num(), std::bind(&analog_recorder::decoder_callback_handler, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
BOOST_LOG_TRIVIAL(info) << "Decoder sink created!" << std::endl;

// Try and get rid of the FSK wobble
// Analog audio band pass from 300 to 3000 Hz
// can't use gnuradio.filter.firdes.band_pass since we have different transition widths
// 300 Hz high pass (275-325 Hz): removes CTCSS/DCS and Type II 150 bps Low Speed Data (LSD), or "FSK wobble"
high_f_taps = gr::filter::firdes::high_pass(1, wave_sample_rate, 300, 50, gr::filter::firdes::WIN_HANN); // Configurable
high_f = gr::filter::fir_filter_fff::make(1, high_f_taps);
// 3000 Hz low pass (3000-3500 Hz)
low_f_taps = gr::filter::firdes::low_pass(1, wave_sample_rate, 3250, 500, gr::filter::firdes::WIN_HANN);
low_f = gr::filter::fir_filter_fff::make(1, low_f_taps);

// using squelch
connect(self(), 0, valve, 0);
Expand All @@ -183,7 +188,8 @@ analog_recorder::analog_recorder(Source *src)
connect(deemph, 0, decim_audio, 0);
connect(decim_audio, 0, high_f, 0);
connect(decim_audio, 0, decoder_sink, 0);
connect(high_f, 0, squelch_two, 0);
connect(high_f, 0, low_f, 0);
connect(low_f, 0, squelch_two, 0);
connect(squelch_two, 0, levels, 0);
connect(levels, 0, wav_sink, 0);
}
Expand Down
2 changes: 2 additions & 0 deletions trunk-recorder/recorders/analog_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class analog_recorder : public gr::hier_block2, public Recorder {
std::vector<float> audio_resampler_taps;
std::vector<float> sym_taps;
std::vector<float> high_f_taps;
std::vector<float> low_f_taps;
std::vector<float> arb_taps;
/* De-emph IIR filter taps */
std::vector<double> d_fftaps; /*! Feed forward taps. */
Expand All @@ -128,6 +129,7 @@ class analog_recorder : public gr::hier_block2, public Recorder {
gr::filter::pfb_arb_resampler_ccf::sptr arb_resampler;
gr::filter::fir_filter_fff::sptr decim_audio;
gr::filter::fir_filter_fff::sptr high_f;
gr::filter::fir_filter_fff::sptr low_f;
gr::analog::pwr_squelch_cc::sptr squelch;
gr::analog::pwr_squelch_ff::sptr squelch_two;
gr::analog::quadrature_demod_cf::sptr demod;
Expand Down

0 comments on commit 9da5508

Please sign in to comment.