# Biquad Treble Shelf filter gain being weird

Trying to compute Biquad Coefficients for use in a codec chip TLV320AIC3100.

Bass Shelf(boost and attenuation) work as expected. Treble Shelf attenuation works as expected but Treble Shelf boost is being weird in the sense that the amplitude difference between non treble frequencies and treble frequencies is as expected (Say 10dB) but instead of the overall gain being +10dB at treble frequencies, it ends up being +3dB(ish) and non treble frequencies end up being -7dB (instead of 0dB).

Used the TI BiQuad Calculator tool and also the tool here

Don't know where things are going wrong. Any guidance is much appreciated. Thank you.

Used the formulas from p3 of this PDF

// Coefficients from the Calculator
N0  2.336268076
N1  -2.773236549
N2  1.01094234
D1  -0.680740702
D2  0.254714569

N0_Real 2.336268076
N1_Real -1.386618274
N2_Real 1.01094234

Scaling Factor  2.336268076 (Max of the above 3 values)
Range   32767 (Fixed for the Chip - 16 bits)

Digital Coefficients
N0  32767
N1  -19448
N2  14179
D1  11153
D2  -8346


Some information:

• Sampling Frequency: 44100
• Treble Shelf Center Frequency: 7kHz (to get required boost/attenuation at 10kHz)

It's your scaling. Don't divide the coefficients by 2.336268076 (which is exactly the gain that's missing.

Instead use proper fixed point implementation techniques (scaling, shifting, "Q" notation, etc.) to deal with numbers larger than 1. Or much easier: use floating point, if you can.