-
Notifications
You must be signed in to change notification settings - Fork 45
Added signal clamping in the DSP processor #181
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
base: develop
Are you sure you want to change the base?
Added signal clamping in the DSP processor #181
Conversation
|
Are there any alternatives? Scale input if overflow is detected? Not such an easy task I guess especially if volume is adjusted this would mean scale factor needs to be reset too. Some form of AGC? Probably overkill. Maybe we could print a warning when clipping happens? We shouldn't spam the log with warnings though. If this happens frequently. Any ideas? |
Exactly, AGL is an alternative. The simpler one is soft-slipping, perhaps. When volume/gain conditions are met, it happens constantly, almost, really annoying. I'd start with simple clipping and go from there. To be honest, I'd be careful on required CPU budget here. DSP-enabled DACs have deicated micro-cores for this job, ESP32 can only do this on the main cores, obviously :) |
|
I see. So I think we should make the user at least aware this is happening by printing a warning at least once per synced playback. Maybe reset this on hard resyncs? Not sure how much effort this would take implementation wise though. Just printing a warning every time would spam log I guess? Maybe just print every 100th? |
|
I think you should adjust the hard clip values to 2/3 instead of 1. |
|
But this can never reach max volume then? |
I think it is fairly easy to normalize to [-1, 1] range. |
|
In comparison to hard clipping? |
correct. Although both options are far better than cracking :) |
|
I like it, but I'll try this myself before accepting. |



Fixes #136
Issue description:
When DSP settings are enabled with high gain values together with a large volume level, audio starts to fill up with cracking sounds.
This seems to be related to integer overflow when applying gain.
Proposed solution:
Simple integer clamping (to prevent overflow) will replace cracks with clipping, which is always a better choice in terms of resulting sound