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 2891

Summary: Regression: OGG playback distorted at samplerate mismatch
Product: SDL_mixer Reporter: Fabian Greffrath <fabian+debian>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.0   
Hardware: x86_64   
OS: Linux   
Attachments: Ogg data, Vorbis audio, stereo, 32000 Hz

Description Fabian Greffrath 2015-02-26 06:52:17 UTC
Created attachment 2051 [details]
Ogg data, Vorbis audio, stereo, 32000 Hz

Hi there,

I think I have found a regression in SDL_mixer regarding playback of OGG files: I try to playback the following file, which is also attached to this report:

$ file d_dm2ttl.lmp.ogg 
d_dm2ttl.lmp.ogg: Ogg data, Vorbis audio, stereo, 32000 Hz, ~64000 bps, created by: Xiph.Org libVorbis I

Please note that the sample rate of this file is 32kHz.

When using the playmus application linked against SDL_mixer 1.2, the sound is played back slower than expected, but it sounds clean and undistorted. When using the playmus application linked against SDL_mixer 2.0, the sound is distorted beyond recognition. It plays back perfectly fine in both cases if I manually pass a samplerate to the playmus application.

Summary:

playmus1.2 d_dm2ttl.lmp.ogg: too slow, but clean
playmus2.0 d_dm2ttl.lmp.ogg: distorted garbage

playmus1.2 -r 32000 d_dm2ttl.lmp.ogg: perfect
playmus2.0 -r 32000 d_dm2ttl.lmp.ogg: perfect


So, maybe there are actually two bugs in this: (1) Mix_PlayMusic (or Mix_FadeInMusic in this specific case) is not able to recognize to correct sample rate for the OGG file in both versions 1.2 and 2.0 and (2) once it fails to do so, it plays unrecognozable garbage in version 2.0.

Cheers,

Fabian
Comment 1 Fabian Greffrath 2015-02-26 06:54:12 UTC
Before writing the last paragraph I should have added that both playmus applications fail to recognoze the correct sample rate of the OGG file and assume it to be 22.05kHz instead:

$ ./playmus1.2 d_dm2ttl.lmp.ogg 
Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer
Playing d_dm2ttl.lmp.ogg

$ ./playmus2.0 d_dm2ttl.lmp.ogg 
Opened audio at 22050 Hz 16 bit stereo (LE), 4096 bytes audio buffer
Playing d_dm2ttl.lmp.ogg
Comment 2 Fabian Greffrath 2015-02-27 07:53:58 UTC
I am afraid this doesn't help too much, but "hg bisect" has now told me twice in a row that "Changeset 578: Switched from SDL_mixer to SDL2_mixer"  is the culprit.
Comment 3 Ryan C. Gordon 2015-03-04 06:14:20 UTC
This is a known bug in SDL's internal resampler (not SDL_mixer), and we're hoping to fix this soon (but not for 2.0.4).

--ryan.
Comment 4 Sam Lantinga 2017-10-13 06:17:53 UTC
This is fixed in SDL 2.0.7 with Ryan's resampling work.

Thanks!