void NarrowbandFMAudio::execute(buffer_c8_t buffer) { /* Called every 2048/3072000 second -- 1500Hz. */ auto decimator_out = decimator.execute(buffer); const buffer_c16_t work_baseband_buffer { (complex16_t*)decimator_out.p, sizeof(*decimator_out.p) * decimator_out.count }; /* 96kHz complex<int16_t>[64] * -> FIR filter, <6kHz (0.063fs) pass, gain 1.0 * -> 48kHz int16_t[32] */ auto channel = channel_filter.execute(decimator_out, work_baseband_buffer); // TODO: Feed channel_stats post-decimation data? feed_channel_stats(channel); feed_channel_spectrum( channel, decimator_out.sampling_rate * channel_filter_taps.pass_frequency_normalized, decimator_out.sampling_rate * channel_filter_taps.stop_frequency_normalized ); const buffer_s16_t work_audio_buffer { (int16_t*)decimator_out.p, sizeof(*decimator_out.p) * decimator_out.count }; /* 48kHz complex<int16_t>[32] * -> FM demodulation * -> 48kHz int16_t[32] */ auto audio = demod.execute(channel, work_audio_buffer); static uint64_t audio_present_history = 0; const auto audio_present_now = squelch.execute(audio); audio_present_history = (audio_present_history << 1) | (audio_present_now ? 1 : 0); const bool audio_present = (audio_present_history != 0); if( !audio_present ) { // Zero audio buffer. for(size_t i=0; i<audio.count; i++) { audio.p[i] = 0; } } audio_hpf.execute_in_place(audio); fill_audio_buffer(audio); }
void AISProcessor::execute(const buffer_c8_t& buffer) { /* 2.4576MHz, 2048 samples */ const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer); const auto decimator_out = decim_1_out; /* 38.4kHz, 32 samples */ feed_channel_stats(decimator_out); for(size_t i=0; i<decimator_out.count; i++) { if( mf.execute_once(decimator_out.p[i]) ) { clock_recovery(mf.get_output()); } } }
void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) { if( !configured ) { return; } const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer); const auto channel_out = channel_filter.execute(decim_1_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 = demod.execute(channel_out, work_audio_buffer); audio_output.write(audio); }
void WidebandFMAudio::execute(const buffer_c8_t& buffer) { if( !configured ) { return; } const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto channel = decim_1.execute(decim_0_out, dst_buffer); // TODO: Feed channel_stats post-decimation data? feed_channel_stats(channel); spectrum_samples += channel.count; if( spectrum_samples >= spectrum_interval_samples ) { spectrum_samples -= spectrum_interval_samples; channel_spectrum.feed(channel, channel_filter_pass_f, channel_filter_stop_f); } /* 384kHz complex<int16_t>[256] * -> FM demodulation * -> 384kHz int16_t[256] */ /* TODO: To improve adjacent channel rejection, implement complex channel filter: * pass < +/- 100kHz, stop > +/- 200kHz */ auto audio_oversampled = demod.execute(channel, work_audio_buffer); /* 384kHz int16_t[256] * -> 4th order CIC decimation by 2, gain of 1 * -> 192kHz int16_t[128] */ auto audio_4fs = audio_dec_1.execute(audio_oversampled, work_audio_buffer); /* 192kHz int16_t[128] * -> 4th order CIC decimation by 2, gain of 1 * -> 96kHz int16_t[64] */ auto audio_2fs = audio_dec_2.execute(audio_4fs, work_audio_buffer); /* 96kHz int16_t[64] * -> FIR filter, <15kHz (0.156fs) pass, >19kHz (0.198fs) stop, gain of 1 * -> 48kHz int16_t[32] */ auto audio = audio_filter.execute(audio_2fs, work_audio_buffer); /* -> 48kHz int16_t[32] */ audio_output.write(audio); }
void CaptureProcessor::execute(const buffer_c8_t& buffer) { /* 2.4576MHz, 2048 samples */ const auto decim_0_out = decim_0.execute(buffer, dst_buffer); const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer); const auto& decimator_out = decim_1_out; const auto& channel = decimator_out; if( stream ) { const size_t bytes_to_write = sizeof(*decimator_out.p) * decimator_out.count; const auto result = stream->write(decimator_out.p, bytes_to_write); } feed_channel_stats(channel); spectrum_samples += channel.count; if( spectrum_samples >= spectrum_interval_samples ) { spectrum_samples -= spectrum_interval_samples; channel_spectrum.feed(channel, channel_filter_pass_f, channel_filter_stop_f); } }