Fix FM audio noise floor, TX gain, and sample wrapping

The 300-2700 Hz bandpass rounded to integer counts after each stage.
Stage 1 is -14 dB and stage 2 is +13.6 dB, which left a broadband floor
of about 7 counts RMS and a signal-dependent DC offset. It is now one
CFMBandpass class that carries 12 fractional bits between stages, uses
an int64 accumulate, and rounds once at the output. RF and ext-audio
paths both use it.

The ext-audio upsampler now multiplies by 3 to restore the 1/3 lost to
zero stuffing.

The RF/ext audio boost multiplies now saturate instead of wrapping,
and the DAC write clamps to 0..4095 rather than only counting overflow.

Deploy with ExtAudioBoost=1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cort Buffington
2026-10-30 10:23:49 -05:00
co-authored by Claude Opus 5.5
parent e8061763bf
commit 7c736e17ef
5 changed files with 64 additions and 34 deletions
+2 -2
View File
@@ -76,11 +76,11 @@ bool CFMUpSampler::getSample(q15_t& sample)
m_packPointer[1U] = pairPack.byte1;
m_packPointer[2U] = pairPack.byte2;
sample = q15_t(m_pack >> 12) - 2048;
sample = (q15_t(m_pack >> 12) - 2048) * 3;//restore the 1/3 lost to zero stuffing
break;
}
case 3:
sample = q15_t(m_pack & FM_UPSAMPLE_MASK) - 2048;
sample = (q15_t(m_pack & FM_UPSAMPLE_MASK) - 2048) * 3;
break;
default:
sample = 0;