Skip to content

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

Merged
yara-blue merged 1 commit into
RustAudio:masterfrom
will3942:fix/channel-volume-algorithm
Jan 18, 2025
Merged

yara-blue merged 1 commit into
RustAudio:masterfrom
will3942:fix/channel-volume-algorithm

Conversation

@will3942

@will3942 will3942 commented Jan 17, 2025

Copy link
Copy Markdown

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.

@yara-blue
yara-blue merged commit bc5c4eb into RustAudio:master Jan 18, 2025
@yara-blue

Copy link
Copy Markdown
Member

thank you very much, elegant solution using amplify there 👍

yara-blue pushed 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