electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
836 stars 131 forks source link

Wrong code in biquad.cpp #195

Closed tobybear closed 6 months ago

tobybear commented 7 months ago

There is a bug/typo in the biquad init function in biquad.cpp.

Line 12 currently is this: float beta = 1.0f + cosf(con); While it should be this: float beta = res * res sinf(2 con) - 2 _res cosf(con) * sinf(con);

This seems to be a copy and paste error, since the original source where the code came from (the Soundpipe library) does have the correct line in place, and besides, the expression assigned to variable beta is actually the same as the one assigned to variable gamma in the next line. Compare lines 45ff from here for verification: https://github.com/PaulBatchelor/Soundpipe/blob/master/modules/biquad.c

takumi-ogata commented 7 months ago

Hi tobybear,

Thank you so much for bring this up! If you would like to, you're more than welcome to make that change and submit a PR. We would greatly appreciate it. Otherwise, we will address this when we get a chance.

beserge commented 6 months ago

Thanks so much for the fix! This will be addressed in the upcoming LGPL split