Skip to content

Commit

Permalink
slight tunes to the Analog recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Jun 13, 2024
1 parent e6d24da commit 1bfc702
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion trunk-recorder/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std
double digital_levels = element.value("digitalLevels", 1.0);
double analog_levels = element.value("analogLevels", 8.0);
double squelch_db = element.value("squelch", -160.0);
int max_dev = element.value("maxDev", 4000);
int max_dev = element.value("maxDev", 6000);
double filter_width = element.value("filterWidth", 1.0);
bool conversation_mode = element.value("conversationMode", true);
bool mod_exists = element.contains("modulation");
Expand Down
18 changes: 7 additions & 11 deletions trunk-recorder/gr_blocks/xlat_channelizer.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "xlat_channelizer.h"

xlat_channelizer::sptr xlat_channelizer::make(double input_rate, int samples_per_symbol, double symbol_rate, double bandwidth,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, bandwidth, center_freq, use_squelch));
}
Expand Down Expand Up @@ -64,22 +64,19 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do
int decimation = floor(input_rate / channel_rate);
// double resampled_rate = float(input_rate) / float(decimation);


// channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, pre_channel_rate, 5000, 2000, 60);
std::vector<float> channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, initial_rate, d_bandwidth / 2, d_bandwidth / 4, 60);

std::vector<gr_complex> if_coeffs;
if_coeffs = gr::filter::firdes::complex_band_pass_2(1, input_rate, -24000, 24000, 12000, 10 );

channel_lpf = gr::filter::fft_filter_ccf::make(decim, channel_lpf_taps);
if_coeffs = gr::filter::firdes::complex_band_pass_2(1, input_rate, -24000, 24000, 12000, 10);

freq_xlat = make_freq_xlating_fft_filter(initial_decim, if_coeffs, 0, input_rate); // inital_lpf_taps, 0, input_rate);

std::vector<float> channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, initial_rate, d_bandwidth / 2, d_bandwidth / 4, 60);
channel_lpf = gr::filter::fft_filter_ccf::make(decim, channel_lpf_taps);

// BOOST_LOG_TRIVIAL(info) << "\t Xlating Channelizer single-stage decimator - Decim: " << decimation << " Resampled Rate: " << resampled_rate << " Lowpass Taps: " << if_coeffs.size();
BOOST_LOG_TRIVIAL(info) << "\t Xlating Channelizer single-stage decimator - if_coeffs: " << if_coeffs.size() << " Decim: " << decim << " Resampled Rate: " << resampled_rate << " Lowpass Taps: " << channel_lpf_taps.size();
// ARB Resampler
double arb_rate = channel_rate / resampled_rate;

double arb_size = 32;
double arb_atten = 30; // was originally 100
// Create a filter that covers the full bandwidth of the output signal
Expand Down Expand Up @@ -112,7 +109,7 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do
BOOST_LOG_TRIVIAL(error) << "Something is probably wrong! Resampling rate too low";
exit(1);
}

double def_excess_bw = 0.2;
// Squelch DB
// on a trunked network where you know you will have good signal, a carrier
Expand Down Expand Up @@ -167,7 +164,6 @@ double xlat_channelizer::get_pwr() {
}
}


void xlat_channelizer::tune_offset(double f) {

float freq = static_cast<float>(f);
Expand Down
4 changes: 2 additions & 2 deletions trunk-recorder/recorders/analog_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type, float tone_fre
}

int samp_per_sym = 2;
double bandwidth = 12000;
double bandwidth = 8000;
system_channel_rate = 16000; // 4800 * samp_per_sym;
wav_sample_rate = 16000; // Must be an integer decimation of system_channel_rate

Expand Down Expand Up @@ -358,14 +358,14 @@ bool analog_recorder::start(Call *call) {


// BOOST_LOG_TRIVIAL(error) << "Setting squelch to: " << squelch_db << " block says: " << squelch->threshold();

levels->set_k(system->get_analog_levels());
int d_max_dev = system->get_max_dev();
/*
channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, initial_rate, d_max_dev, 1000, 100);
channel_lpf->set_taps(channel_lpf_taps);*/
quad_gain = system_channel_rate / (2.0 * M_PI * (d_max_dev + 1000));
demod->set_gain(quad_gain);

int offset_amount = (center_freq - chan_freq);
prefilter->tune_offset(offset_amount);

Expand Down

0 comments on commit 1bfc702

Please sign in to comment.