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 3851

Summary: [patch] New resampler: use real rpadding in SDL_ResampleAudioStream to fix ticking noise
Product: SDL Reporter: Eric Wasylishen <ewasylishen>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: nagydavid91, sezeroz
Version: HG 2.1   
Hardware: x86   
OS: Windows 10   
Attachments: Patch to use real rpadding in SDL_ResampleAudioStream

Description Eric Wasylishen 2017-09-27 04:01:02 UTC
Created attachment 2961 [details]
Patch to use real rpadding in SDL_ResampleAudioStream

SDL_ResampleAudioStream is currently passing an rpadding buffer of 0 to SDL_ResampleAudio.. you can hear this as a ticking sound every buffer interval.
(my test case is on Windows 10, system set to 48000Hz, and run "loopwave" playing a 44100Hz wav file.)

I don't know if this is how you'll want to resolve this, but here's one possible way. It delays the stream by "paddingsamples" so there's always that much available at the end of the input to use as "rpadding".

Haven't done any testing yet beyond listening by ear, but I *think* this fixes all of the artifacts for 44100->48000 resampling.
Comment 1 Ryan C. Gordon 2017-10-10 20:14:10 UTC
I went with a different approach, somewhat along the same lines in https://hg.libsdl.org/SDL/rev/c48ab2c208a2

--ryan.
Comment 2 Ryan C. Gordon 2017-10-11 06:40:08 UTC
*** Bug 3846 has been marked as a duplicate of this bug. ***