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 3507 - audio glitch after internal resampling
Summary: audio glitch after internal resampling
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: don't know
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-05 12:34 UTC by Sylvain
Modified: 2016-12-17 21:16 UTC (History)
0 users

See Also:


Attachments
sound (34.74 KB, audio/x-wav)
2016-12-05 12:34 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2016-12-05 12:34:29 UTC
Created attachment 2647 [details]
sound

Since audio converter code https://hg.libsdl.org/SDL/rev/bb99dede0675
There is a glitch after playing attached wav sound file.

Some log:
Build format 8010->8010, channels 1->2, rate 48000->22050
Comment 1 Sylvain 2016-12-14 13:38:44 UTC
Ryan, 

I think there may be an issue when downsampling (and also upsampling), 
I would apply this patch (and the same for upsampling):

--- a/src/audio/SDL_audiotypecvt.c	Tue Dec 13 00:22:42 2016 -0500
+++ b/src/audio/SDL_audiotypecvt.c	Wed Dec 14 14:37:06 2016 +0100
@@ -283,11 +283,11 @@
     SDL_memcpy(last_sample, src, cpy);
 
     while (dst < target) {
-        src += 8;
+        src += channels;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
             SDL_memcpy(dst, sample, cpy);
-            dst += 8;
+            dst += channels;
             for (i = 0; i < channels; i++) {
                 sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
             }
Comment 2 Ryan C. Gordon 2016-12-17 21:16:20 UTC

Whoops, sorry! This is fixed now in https://hg.libsdl.org/SDL/rev/f6cd81aab88e !

--ryan.