MCUdude / SigmaDSP

A versatile Arduino library for interfacing with the ADAU1401, ADAU1701 and ADAU1702 audio DSPs
GNU Lesser General Public License v3.0
165 stars 33 forks source link

Fix gain calculation for EQ 2nd order low pass filters. #20

Closed bw3 closed 3 years ago

bw3 commented 3 years ago

Without this fix, a gain other than 0db will cause significant distortion.

MCUdude commented 3 years ago

Thanks for the PR! This algorithm was borrowed from the AidaDSP library, which this library is based on. May I ask how you figured this out, or where you found the algorithm that confirms your conclusion?

bw3 commented 3 years ago

I tried to set up a low pass filter with a gain of -20db, and the volume was not reduced as expected, when I added the parenthesis, the volume was reduced, and the audio sounded low-passed as expected.

I used this page to figure out the correct formula: http://shepazu.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html

MCUdude commented 3 years ago

Awesome, thanks for the explaination!