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
New resampler: audible aliasing when upsampling 11k or 22k audio #2663
Comments
Any updates on this? I think I just ran into this using release-2.0.20 |
I mean, it's been a few years, it's probably time to rewrite the resampling code from scratch again, right? :) |
This looks like it fizzled out without usable patches. I'd probably encourage you to use the libsamplerate support for now if you're getting bit by this badly, and we can look at this more after this milestone. |
I've managed to statically link libsamplerate into my project and I can see how it gets loaded when stepping through the code during initialization (LoadLibSampleRate). However the problem is still here. Still very audible noise and crackling. /edit |
Oh, I see what's happening now. SDL_sound is still using the SDL_AudioCVT API for resampling, and this API does not work to resample data in chunks (it was all we had at the time)...I haven't heard your results, but it's not uncommon for it to produce audio artifacts on the edges of the data that you feed it, because it doesn't know about samples before and after the chunk to interpolate them properly. Nowadays SDL has SDL_AudioStream, which can resample data as it passes through a queue. SDL_sound will be moving to this soon, but hasn't yet. My suspicion is this is the exact problem and it's clear what the fix needs to be. (SDL_AudioCVT doesn't use libsamplerate, just SDL_AudioStream, but your problem will likely go away with or without libsamplerate, once we start using a proper stream. Sorry for the confusion and extra work I caused you here.) --ryan. |
No worries, thank you for clarification. That also explains why the artifacts appear less often when increasing the buffer size. At first I've falsely interpreted that as a performance issue... Guess I'll wait for a SDL_sound update then. 😄 |
I just pushed this change to SDL_sound; it works the same way but uses SDL_AudioStream internally. See if it fixes your problem! |
Yes it does. Thank you! |
Hooray! I'm going to close this for now, because I think we're good here. Let me know if this needs to be reopened, though! |
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Reported in version: HG 2.0
Reported for operating system, platform: Other, x86
Comments on the original bug report:
On 2017-10-12 19:27:12 +0000, Eric Wasylishen wrote:
On 2017-11-11 18:20:55 +0000, Eric Wasylishen wrote:
On 2018-02-17 23:10:47 +0000, Ryan C. Gordon wrote:
On 2018-02-21 21:03:49 +0000, Eric Wasylishen wrote:
On 2018-02-21 21:12:25 +0000, Sam Lantinga wrote:
On 2018-02-22 11:08:10 +0000, Eric Wasylishen wrote:
On 2018-02-22 18:43:20 +0000, Sam Lantinga wrote:
The text was updated successfully, but these errors were encountered: