diff --git a/firmware/baseband/proc_am_audio.cpp b/firmware/baseband/proc_am_audio.cpp index 6444a9fe..017ec4f6 100644 --- a/firmware/baseband/proc_am_audio.cpp +++ b/firmware/baseband/proc_am_audio.cpp @@ -34,12 +34,14 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) { const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer); + + channel_spectrum.feed(decim_1_out, channel_filter_pass_f, channel_filter_stop_f); + const auto decim_2_out = decim_2.execute(decim_1_out, dst_buffer); const auto channel_out = channel_filter.execute(decim_2_out, dst_buffer); // TODO: Feed channel_stats post-decimation data? feed_channel_stats(channel_out); - channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f); auto audio = demodulate(channel_out); audio_compressor.execute_in_place(audio); @@ -93,7 +95,7 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) { channel_filter.configure(message.channel_filter.taps, channel_filter_decimation_factor); channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs; channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs; - channel_spectrum.set_decimation_factor(std::floor(channel_filter_output_fs / (channel_filter_pass_f + channel_filter_stop_f))); + channel_spectrum.set_decimation_factor(1.0f); modulation_ssb = (message.modulation == AMConfigureMessage::Modulation::SSB); audio_output.configure(message.audio_hpf_config); diff --git a/firmware/baseband/proc_nfm_audio.cpp b/firmware/baseband/proc_nfm_audio.cpp index 48bc274f..5e1ae1ac 100644 --- a/firmware/baseband/proc_nfm_audio.cpp +++ b/firmware/baseband/proc_nfm_audio.cpp @@ -38,10 +38,12 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) { const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer); + + channel_spectrum.feed(decim_1_out, channel_filter_pass_f, channel_filter_stop_f); + const auto channel_out = channel_filter.execute(decim_1_out, dst_buffer); feed_channel_stats(channel_out); - channel_spectrum.feed(channel_out, channel_filter_pass_f, channel_filter_stop_f); if (!pitch_rssi_enabled) { // Normal mode, output demodulated audio @@ -145,7 +147,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) { demod.configure(demod_input_fs, message.deviation); channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs; channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs; - channel_spectrum.set_decimation_factor(std::floor(channel_filter_output_fs / (channel_filter_pass_f + channel_filter_stop_f))); + channel_spectrum.set_decimation_factor(1.0f); audio_output.configure(message.audio_hpf_config, message.audio_deemph_config, (float)message.squelch_level / 100.0); hpf.configure(audio_24k_hpf_30hz_config);