13
0

NO-OP: clarify maths

This commit is contained in:
Robin Gareus 2024-06-12 18:30:01 +02:00
parent 827be736ae
commit b142fc4410
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -168,10 +168,14 @@ Amp::apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes,
return target;
}
/* Apply Audio Gain first, calculate target LFP'ed gain coefficient
/* Apply Audio Gain first, calculate 1 pole IIR time constant
*
* Low pass filter coefficient: 1.0 - e^(-2.0 * π * f / 48000) f in Hz.
* for f << SR, approx a ~= 6.2 * f / SR;
* H(z) = a / (1 - (1 - a) z^-1)
* a = -y + sqrt (y^2 + 2y); y = 1 - cos (w) ; w = 2 * π f/SR
* a ~= 1.0 - e^(-2.0 * π * f / SR)
*
* and for very small w (f << SR)
* a ~= 6.2 * f / SR;
*/
const gain_t a = 156.825f / (gain_t)sample_rate; // 25 Hz LPF