We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5301 - [patch] audio: fix popping sounds caused by signed/unsigned conversion
Summary: [patch] audio: fix popping sounds caused by signed/unsigned conversion
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.14
Depends on:
Blocks:
 
Reported: 2020-09-26 11:13 UTC by Manuel Vögele
Modified: 2020-10-20 14:47 UTC (History)
2 users (show)

See Also:


Attachments
Patch that fixes the popping sounds caused by signed/unsigned conversion (1.53 KB, patch)
2020-09-26 11:13 UTC, Manuel Vögele
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Vögele 2020-09-26 11:13:44 UTC
Created attachment 4473 [details]
Patch that fixes the popping sounds caused by signed/unsigned conversion

Currently when SDL needs to convert audio for playback from an signed to an unsigned value (or vice versa) it outputs an either very high or very low silence value, leading to a popping sound and distortion in the audio playback of other applications (due to clipping) whenever a device requiring such a conversion plays back silence (because of being paused or having an empty audio queue). This happens because the silence value written into the stream (for later conversion to the audio devices format) isn't chosen based on the spec of that stream but based on the spec of the audio device. This leads to a wrong, extreme silence value which causes the described behavior.

This patch addresses that issue by taking the silence value that's put into the stream from the stream's spec.

This patch might be related to this bug: https://bugzilla.libsdl.org/show_bug.cgi?id=4805
Comment 1 Ryan C. Gordon 2020-10-20 14:47:06 UTC
Good catch! This patch is now https://hg.libsdl.org/SDL/rev/828db31f6a57, thanks!

--ryan.