⚙️ ENGINEER LEVEL: Sample Rate Conversion and Dithering
Sample Rate Conversion
When the DSP's internal sample rate differs from the input, sample rate conversion (SRC) is required.
Synchronous SRC: Input and output clocked from the same reference. No jitter introduced. Used when input is from a digital source (S/PDIF, USB audio).
Asynchronous SRC: Input and output have independent clocks. Rate conversion involves resampling with interpolation/decimation. Introduces subtle artifacts.
Polyphase FIR SRC filter:
Upsampling from 44.1 kHz to 96 kHz requires: 1. Upsample by 320 (insert 319 zeros between samples) 2. Apply anti-imaging FIR lowpass at 22.05 kHz (the original Nyquist) 3. Downsample by 147
Net ratio: 320/147 ≈ 2.177 (matches 96000/44100)
The FIR filter must have sufficient transition band performance to prevent aliasing. Typical automotive DSPs use 128–256 tap polyphase FIR for SRC — transparent quality.
Dithering:
When reducing bit depth (24-bit to 16-bit, or for output DAC precision), dithering adds shaped noise to minimize quantization distortion.
TPDF dithering:
output_n = round(input_n + uniform_noise₁ - uniform_noise₂)
Where the two independent uniform noise values create a triangular PDF (TPDF). This linearizes quantization error — converting harmonic distortion into random noise, which is less audible.