-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AudioFilterSW] Fix audio cutting out due to numerical errors #102210
Conversation
Do you have a test project that can be used to reproduce the bug and validate the fix? I suspect such issues may also be system/OS specific so some testing to confirm the fix would be good. I checked the code a bit, as I was wondering whether other things should be updated from So that means in |
e6d7fa7
to
a35c351
Compare
The audio part of the engine still contains lots of dead and legacy code, e.g. I could provide a test project after asking the person for permission tomorrow. |
Here it is. Audio cuts out at around 15s in. Since it's too large for github, you can download it here: |
I confirm that this PR fixes the issue with the project. Currently investigating what could be done with this file. |
Thanks! |
This aims to fix a long-standing audio issue which someone at my local user group brought up.
When interpolating the cutoff frequency of the AudioEffectFilterHighPass towards 1.0, at a certain point the audio becomes unstable until it suddenly stops working and clips (+- 1.0 on both channels).
After investigation I found out that this problem (probably) occurs due to numerical cancelation/inprecision when calculation the coefficients of the biquad filter.
For some reason, the coefficients were of type float while the rest of the code used double.
After increasing the precision, the issue was gone for me. There might be a better solution, but for now this is probably the quickest and safest way to fix it.
Other filter effects which use AudioFilterSW under the hood might benefit from this too.