[Fons Adriaensen]
On Tue, Mar 19, 2013 at 03:02:19PM +0100, Tim Goetze
wrote:
Surely you realise this version executes exactly
as many additions and
multiplications per sample as a biquad?
Yes. In this case it's possible to remove one multiplication:
a = 0.07f;
b = 1 + a;
// ...
gm = b * gt;
for (i = 0; i < nframes; i++)
{
g1 += w * (gm - g1 - a * g2);
g2 += w * (g1 - g2);
out [i] = g2 * in [i];
}
Very nice work, it's lighter on state and setup, and now also on
execution.
Since this is not a highpass, let's just skip any claims of increased
stability.
However, I still take issue with the rather exaggerated claim that
using a biquad to smoothen gain changes would be "giant overkill". It
may be slightly less efficient than your now optimised version, but
certainly not enough to substantiate this claim.
In fact, I think this is a rather grandiloquent choice of words that
is entirely uncalled for.
BTW, at the cost of that one extra multiplication, the biquad is more
versatile if you run the gain filter permanently: you can simply feed
it the current knob value and it will automatically produce a nice,
smooth curve, without needing to be set up again for every gain
change.