grahamwhaley / DSPham

A Teensy based DSP audio processor
GNU General Public License v3.0
24 stars 7 forks source link

filters: normalise filter coeffs to 'unity' gain #3

Closed grahamwhaley closed 3 years ago

grahamwhaley commented 3 years ago

I've noticed that the dynamic FIR filter coefficients end up with a lot of attenuation at the center frequency. I think it's just a consequence of using fast dynamic filter coeff generation, rather than the long winded and processor intense 'optimal' calculations (if we do an online coeff calculation and inject those coeffs into a static table then we do see good non-attenuating performance).

This impact the processing chain - as the filters come very early in the chain they basically reduce our 'data width' a lot, which must hurt some of the later algorithms.

Try to 'normalise' the filters, by assessing their performance at their chosen center frequency, and then normalising the coefficients up to that (the nice thing about FIR coeffs is you can adjust gain just by multiplying the coeffs, within reason of course).

And then it was found that if we take the raw gain and apply it to the coeffs, we end up with constant low level 'white noise', probably as the filter coeffs are pretty 'maxed out' - so, limit our gain application to 2.0, and apply it at 90% (so, 1.8x max). This does help out with our final output 'volume' somewhat at least.

Fixes: #1

Signed-off-by: Graham Whaley graham.whaley@gmail.com