mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
POCSAG Squelch and Filtering (#1424)
* Disable audio processing when not using squelch * Add 2k4 lowpass fitler for 24Khz audio for POCSAG
This commit is contained in:
parent
f46e20c977
commit
07be74701f
@ -33,8 +33,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
||||
// This is called at 1500Hz
|
||||
|
||||
if (!configured) return;
|
||||
|
||||
// Get 24kHz audio
|
||||
@ -43,12 +41,14 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
||||
const auto channel_out = channel_filter.execute(decim_1_out, dst_buffer);
|
||||
auto audio = demod.execute(channel_out, audio_buffer);
|
||||
|
||||
// Output audio pre-smoothing so squelch actually works.
|
||||
// NB: It's useful to output *after* when debugging the smoothing filter.
|
||||
// When use_squelch_ is true, AudioOutput applies filters
|
||||
// which should eliminate the need to do this smoothing.
|
||||
if (use_squelch_ == false)
|
||||
smooth.Process(audio.p, audio.count);
|
||||
|
||||
// NB: This applies audio filters in-place when use_squelch_ is true.
|
||||
audio_output.write(audio);
|
||||
|
||||
// Smooth the data to make decoding more accurate.
|
||||
smooth.Process(audio.p, audio.count);
|
||||
processDemodulatedSamples(audio.p, 16);
|
||||
extractFrames();
|
||||
}
|
||||
@ -83,10 +83,13 @@ void POCSAGProcessor::on_message(const Message* const message) {
|
||||
|
||||
case Message::ID::NBFMConfigure: {
|
||||
auto config = reinterpret_cast<const NBFMConfigureMessage*>(message);
|
||||
|
||||
use_squelch_ = config->squelch_level > 0;
|
||||
audio_output.configure(
|
||||
audio_24k_hpf_300hz_config,
|
||||
audio_8k_deemph_300_6_config,
|
||||
audio_24k_lpf_2400hz_config,
|
||||
config->squelch_level / 100.0);
|
||||
audio_output.configure(use_squelch_);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -215,6 +215,8 @@ class POCSAGProcessor : public BasebandProcessor {
|
||||
int m_numCode{0};
|
||||
bool m_inverted{false};
|
||||
|
||||
bool use_squelch_ = false;
|
||||
|
||||
/* NB: Threads should be the last members in the class definition. */
|
||||
BasebandThread baseband_thread{baseband_fs, this, baseband::Direction::Receive};
|
||||
RSSIThread rssi_thread{};
|
||||
|
@ -77,6 +77,12 @@ constexpr iir_biquad_config_t audio_24k_deemph_300_6_config{
|
||||
{0.03780475f, 0.03780475f, 0.00000000f},
|
||||
{1.00000000f, -0.92439049f, 0.00000000f}};
|
||||
|
||||
// scipy.signal.butter(1, 2400 / 12000.0, 'lowpass', analog=False)
|
||||
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
|
||||
constexpr iir_biquad_config_t audio_24k_lpf_2400hz_config{
|
||||
{0.03780475f, 0.03780475f, 0.00000000f},
|
||||
{1.00000000f, -0.92439049f, 0.00000000f}};
|
||||
|
||||
// scipy.signal.butter(1, 300 / 8000.0, 'lowpass', analog=False)
|
||||
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
|
||||
constexpr iir_biquad_config_t audio_16k_deemph_300_6_config{
|
||||
|
Loading…
Reference in New Issue
Block a user