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 2845 - Poor resampling 32000 -> 44100 Hz, 48000 -> 44100 Hz and random crash with MAD 11025 -> 44100 Hz
Summary: Poor resampling 32000 -> 44100 Hz, 48000 -> 44100 Hz and random crash with MA...
Status: RESOLVED DUPLICATE of bug 58
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.1
Hardware: x86 Windows 7
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-16 01:21 UTC by Vitaly Novichkov
Modified: 2016-01-03 21:33 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Novichkov 2015-01-16 01:21:17 UTC
While I developing game engine, I have bunch of issues with resampling
- SDL wrongly resampling 32000 hz audio and wrongly resampling 48000 hz into 44100 hz.
- While I using MAD (alone MP3 player which works for me), I have random crash after switching music after playing of 11025 Hz track.

Resampling of WAV 48000 Hz to 44100 causing noice, OGG too, FLAC have less noices but anyway playback is poor.

I tested two builds of SDL: latest stable 2.0 and dev-build of latest Mercurial sources.

I made attempt to solve re-sampling problem:
--------------------
I can correctly re-sample a higher frequencies than stream. I was implemented a mod into SDL2_mixer which adding linear resampler which I got from MADPLAY sources. BUT with frequencies less than 44100 I still use default SDL_ConvertAudio() because (mayby I forgot something) when I do upsampling, I getting crash after SDL_ConvertAudio() call (in the music_mad.c file in the getAudio(), I put resampling into decode_frame() and after modify lenght to resampled result. Works with >44100 but crash on <44100Hz).

Here is a modded decode_frame function:
https://github.com/Wohlhabend-Networks/PlatGEnWohl/blob/master/_Libs/SDL2_mixer_modified/music_mad.c#L198
Comment 1 Ryan C. Gordon 2016-01-03 21:03:41 UTC
We (finally) intend to fix in 2.0.5.

--ryan.

*** This bug has been marked as a duplicate of bug 58 ***
Comment 2 Vitaly Novichkov 2016-01-03 21:33:18 UTC
Glad to hear this :)
I will wait that commit to try that at myself (also, now I'm working at linux and inside my project I made a pre-building of SDL and stuff [also sed-based patching with avoid versioing] from sources rather using of pre-built from repo)