From b142fc4410c88231ece4e1d06475cb14e2d74a7b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 12 Jun 2024 18:30:01 +0200 Subject: [PATCH] NO-OP: clarify maths --- libs/ardour/amp.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 6d71c6c85a..c0259d814e 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -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