Skip to content
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

Improve ChannelVolume's Mono conversion algorithm to use the average of samples #681

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

will3942
Copy link
Contributor

@will3942 will3942 commented Jan 17, 2025

Fixes #680

This avoids any potential clipping/overflow.

As ChannelVolume deals with Samples in the same format they come in as (e.g. i16), previously just using .saturating_add() to sum all the samples would mean that the sum would be clipped/overflow if the signals were large enough. By averaging the Samples we avoid this overflow.

@dvdsk dvdsk merged commit bc5c4eb into RustAudio:master Jan 18, 2025
11 checks passed
@dvdsk
Copy link
Collaborator

dvdsk commented Jan 18, 2025

thank you very much, elegant solution using amplify there 👍

dvdsk added a commit that referenced this pull request Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChannelVolume usage causes crackling/distortion
2 participants