diff --git a/trunk-recorder/gr_blocks/xlat_channelizer.cc b/trunk-recorder/gr_blocks/xlat_channelizer.cc index 80f479022..3ccf5001a 100644 --- a/trunk-recorder/gr_blocks/xlat_channelizer.cc +++ b/trunk-recorder/gr_blocks/xlat_channelizer.cc @@ -1,8 +1,8 @@ #include "xlat_channelizer.h" -xlat_channelizer::sptr xlat_channelizer::make(double input_rate, int samples_per_symbol, double symbol_rate, double center_freq, bool use_squelch) { +xlat_channelizer::sptr xlat_channelizer::make(double input_rate, int samples_per_symbol, double symbol_rate, double bandwidth,double center_freq, bool use_squelch) { - return gnuradio::get_initial_sptr(new xlat_channelizer(input_rate, samples_per_symbol, symbol_rate, center_freq, use_squelch)); + return gnuradio::get_initial_sptr(new xlat_channelizer(input_rate, samples_per_symbol, symbol_rate, bandwidth, center_freq, use_squelch)); } const int xlat_channelizer::smartnet_samples_per_symbol; @@ -40,12 +40,13 @@ xlat_channelizer::DecimSettings xlat_channelizer::get_decim(long speed) { return decim_settings; } -xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, double symbol_rate, double center_freq, bool use_squelch) +xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, double symbol_rate, double bandwidth, double center_freq, bool use_squelch) : gr::hier_block2("xlat_channelizer_ccf", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex))), d_center_freq(center_freq), d_input_rate(input_rate), + d_bandwidth(bandwidth), d_samples_per_symbol(samples_per_symbol), d_symbol_rate(symbol_rate), d_use_squelch(use_squelch) { @@ -69,15 +70,15 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do */ std::vector if_coeffs; - if_coeffs = gr::filter::firdes::complex_band_pass(1, input_rate, -channel_rate / 2, channel_rate / 2, channel_rate / 2); + if_coeffs = gr::filter::firdes::complex_band_pass(1, input_rate, -d_bandwidth / 2, d_bandwidth / 2, d_bandwidth ); freq_xlat = make_freq_xlating_fft_filter(decimation, if_coeffs, 0, input_rate); // inital_lpf_taps, 0, input_rate); - BOOST_LOG_TRIVIAL(info) << "\t Xlating Channelizer single-stage decimator - Decim: " << decimation << " Resampled Rate: " << resampled_rate << " Lowpass Size: " << if_coeffs.size(); + BOOST_LOG_TRIVIAL(info) << "\t Xlating Channelizer single-stage decimator - Decim: " << decimation << " Resampled Rate: " << resampled_rate << " Lowpass Taps: " << if_coeffs.size(); // ARB Resampler double arb_rate = channel_rate / resampled_rate; - BOOST_LOG_TRIVIAL(info) << "\t Channelizer ARB - Symbol Rate: " << channel_rate << " Resampled Rate: " << resampled_rate << " ARB Rate: " << arb_rate; + double arb_size = 32; double arb_atten = 30; // was originally 100 // Create a filter that covers the full bandwidth of the output signal @@ -104,14 +105,13 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do #else arb_taps = gr::filter::firdes::low_pass_2(arb_size, arb_size, bw, tb, arb_atten, gr::fft::window::WIN_BLACKMAN_HARRIS); #endif + BOOST_LOG_TRIVIAL(info) << "\t Channelizer ARB - Symbol Rate: " << channel_rate << " Resampled Rate: " << resampled_rate << " ARB Rate: " << arb_rate << " ARB Taps: " << arb_taps.size() << " BW: " << bw << " TB: " << tb; arb_resampler = gr::filter::pfb_arb_resampler_ccf::make(arb_rate, arb_taps); } else if (arb_rate > 1) { BOOST_LOG_TRIVIAL(error) << "Something is probably wrong! Resampling rate too low"; exit(1); } - - double sps = d_samples_per_symbol; double def_excess_bw = 0.2; // Squelch DB // on a trunked network where you know you will have good signal, a carrier @@ -122,7 +122,7 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do squelch = gr::analog::pwr_squelch_cc::make(squelch_db, 0.0001, 0, true); rms_agc = gr::blocks::rms_agc::make(0.45, 0.85); - fll_band_edge = gr::digital::fll_band_edge_cc::make(sps, def_excess_bw, 2 * sps + 1, (2.0 * pi) / sps / 250); // OP25 has this set to 350 instead of 250 + fll_band_edge = gr::digital::fll_band_edge_cc::make(d_samples_per_symbol, def_excess_bw, 2 * d_samples_per_symbol + 1, (2.0 * pi) / d_samples_per_symbol / 250); // OP25 has this set to 350 instead of 250 connect(self(), 0, freq_xlat, 0); diff --git a/trunk-recorder/gr_blocks/xlat_channelizer.h b/trunk-recorder/gr_blocks/xlat_channelizer.h index d81f04288..77a457f3a 100644 --- a/trunk-recorder/gr_blocks/xlat_channelizer.h +++ b/trunk-recorder/gr_blocks/xlat_channelizer.h @@ -39,8 +39,8 @@ class xlat_channelizer : public gr::hier_block2 { typedef std::shared_ptr sptr; #endif - static sptr make(double input_rate, int samples_per_symbol, double symbol_rate, double center_freq, bool use_squelch); - xlat_channelizer(double input_rate, int samples_per_symbol, double symbol_rate, double center_freq, bool use_squelch); + static sptr make(double input_rate, int samples_per_symbol, double symbol_rate, double bandwidth, double center_freq, bool use_squelch); + xlat_channelizer(double input_rate, int samples_per_symbol, double symbol_rate, double bandwidth, double center_freq, bool use_squelch); struct DecimSettings { long decim; @@ -53,6 +53,7 @@ class xlat_channelizer : public gr::hier_block2 { static constexpr double phase1_symbol_rate = 4800; static constexpr double phase2_symbol_rate = 6000; static constexpr double smartnet_symbol_rate = 3600; + static constexpr double channel_bandwidth = 12500; int get_freq_error(); bool is_squelched(); @@ -68,6 +69,7 @@ class xlat_channelizer : public gr::hier_block2 { long if2; double d_center_freq; double d_input_rate; + double d_bandwidth; double d_system_channel_rate; int d_samples_per_symbol; double d_symbol_rate; diff --git a/trunk-recorder/recorders/analog_recorder.cc b/trunk-recorder/recorders/analog_recorder.cc index 0812ef673..375347e2b 100644 --- a/trunk-recorder/recorders/analog_recorder.cc +++ b/trunk-recorder/recorders/analog_recorder.cc @@ -113,12 +113,13 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type, float tone_fre conventional = false; } - // int samp_per_sym = 10; - system_channel_rate = 32000; // 4800 * samp_per_sym; + int samp_per_sym = 2; + double bandwidth = 16000; + system_channel_rate = 16000; // 4800 * samp_per_sym; wav_sample_rate = 16000; // Must be an integer decimation of system_channel_rate // The Prefilter provides the initial squelch for the channel - prefilter = xlat_channelizer::make(input_rate, 2, 16000, center_freq, true); + prefilter = xlat_channelizer::make(input_rate, samp_per_sym, system_channel_rate / samp_per_sym, bandwidth, center_freq, true); prefilter->set_analog_squelch(true); // based on squelch code form ham2mon @@ -147,6 +148,7 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type, float tone_fre audio_resampler_taps = design_filter(1, (system_channel_rate / wav_sample_rate)); // Calculated to make sample rate changable -- must be an integer + BOOST_LOG_TRIVIAL(info) << "Audio Resampler Taps: " << audio_resampler_taps.size() << " Decimation: " << (system_channel_rate / wav_sample_rate); // downsample from 48k to 8k decim_audio = gr::filter::fir_filter_fff::make((system_channel_rate / wav_sample_rate), audio_resampler_taps); // Calculated to make sample rate changable @@ -185,14 +187,12 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type, float tone_fre connect(prefilter, 0, demod, 0); connect(demod, 0, deemph, 0); if (use_tone_squelch) { - connect(deemph, 0, tone_squelch, 0); - connect(tone_squelch, 0, decim_audio, 0); + connect(deemph, 0, tone_squelch, 0); + connect(tone_squelch, 0, squelch_two, 0); } else { - connect(deemph, 0, decim_audio, 0); + connect(deemph, 0, squelch_two, 0); } - - connect(decim_audio, 0, squelch_two, 0); connect(squelch_two, 0, decoder_sink, 0); connect(squelch_two, 0, high_f, 0); connect(high_f, 0, low_f, 0); diff --git a/trunk-recorder/recorders/dmr_recorder_impl.cc b/trunk-recorder/recorders/dmr_recorder_impl.cc index 669412351..1d77195bf 100644 --- a/trunk-recorder/recorders/dmr_recorder_impl.cc +++ b/trunk-recorder/recorders/dmr_recorder_impl.cc @@ -47,7 +47,7 @@ void dmr_recorder_impl::initialize(Source *src) { timestamp = time(NULL); starttime = time(NULL); - prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, center_freq, conventional); + prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, xlat_channelizer::channel_bandwidth, center_freq, conventional); /* FSK4 Demod */ const double phase1_channel_rate = phase1_symbol_rate * phase1_samples_per_symbol; diff --git a/trunk-recorder/recorders/p25_recorder_impl.cc b/trunk-recorder/recorders/p25_recorder_impl.cc index bc67c9a31..a673ea925 100644 --- a/trunk-recorder/recorders/p25_recorder_impl.cc +++ b/trunk-recorder/recorders/p25_recorder_impl.cc @@ -50,7 +50,7 @@ void p25_recorder_impl::initialize(Source *src) { this->set_enable_audio_streaming(config->enable_audio_streaming); } - prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, center_freq, conventional); + prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, xlat_channelizer::channel_bandwidth, center_freq, conventional); // initialize_prefilter(); // initialize_p25(); diff --git a/trunk-recorder/recorders/sigmf_recorder_impl.cc b/trunk-recorder/recorders/sigmf_recorder_impl.cc index cd13c17e8..8df97d009 100644 --- a/trunk-recorder/recorders/sigmf_recorder_impl.cc +++ b/trunk-recorder/recorders/sigmf_recorder_impl.cc @@ -60,7 +60,7 @@ sigmf_recorder_impl::sigmf_recorder_impl(Source *src, Recorder_Type type) //initialize_prefilter(); //initialize_prefilter_xlat(); - prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, center, conventional); + prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, xlat_channelizer::channel_bandwidth, center, conventional); set_enabled(false); connect(squelch, 0, raw_sink, 0); } diff --git a/trunk-recorder/systems/p25_trunking.cc b/trunk-recorder/systems/p25_trunking.cc index 8c9d78d96..25146e48f 100644 --- a/trunk-recorder/systems/p25_trunking.cc +++ b/trunk-recorder/systems/p25_trunking.cc @@ -130,7 +130,7 @@ p25_trunking::p25_trunking(double f, double c, long s, gr::msg_queue::sptr queue rx_queue = queue; qpsk_mod = qpsk; - prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, center_freq, false); + prefilter = xlat_channelizer::make(input_rate, channelizer::phase1_samples_per_symbol, channelizer::phase1_symbol_rate, xlat_channelizer::channel_bandwidth, center_freq, false); initialize_p25(); diff --git a/trunk-recorder/systems/smartnet_trunking.cc b/trunk-recorder/systems/smartnet_trunking.cc index 9f59ab114..26e6d05b0 100644 --- a/trunk-recorder/systems/smartnet_trunking.cc +++ b/trunk-recorder/systems/smartnet_trunking.cc @@ -60,7 +60,7 @@ smartnet_trunking::smartnet_trunking(float f, smartnet_decode_sptr decode = smartnet_make_decode(queue, sys_num); - prefilter = xlat_channelizer::make(input_rate, channelizer::smartnet_samples_per_symbol, channelizer::smartnet_symbol_rate, center_freq, false); + prefilter = xlat_channelizer::make(input_rate, channelizer::smartnet_samples_per_symbol, channelizer::smartnet_symbol_rate, xlat_channelizer::channel_bandwidth, center_freq, false); connect(self(), 0, prefilter, 0); connect(prefilter, 0, pll_demod, 0);