Skip to content
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

Resampling music produces garbage #144

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Resampling music produces garbage #144

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: unspecified
Reported for operating system, platform: All, x86_64

Comments on the original bug report:

On 2013-09-07 17:15:07 +0000, Lauri Kenttä wrote:

Created attachment 1325
Test program, plays first Mix_Chunk and then Mix_Music.

If the audio device is opened at 48000 Hz and a music file is at 44100 Hz, the resampler produces garbage (unrecognizable noise). This only happens with Mix_Music. If the same file is opened as Mix_Chunk, it works fine. Apparently this is not bug # 58 anymore but something new instead.

I'm using SDL2 and SDL2_mixer from 64-bit Arch Linux repository, both versions reported as 2.0.0.

Steps to reproduce:
Mix_OpenAudio(48000, ...);
Mix_PlayMusic(Mix_LoadMUS("music_at_44100.wav"), 0);

Expected result: music
Actual result: garbage

On 2014-08-25 02:33:42 +0000, Francisco de la Peña wrote:

Created attachment 1849
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 16000 Hz

Tests with attached file:
playmus -r 22050 0000_226.wav # plays garbage
playwave -r 22050 0000_226.wav # plays OK
playmus -r 44100 0000_226.wav # plays garbage
playwave -r 44100 0000_226.wav # plays garbage

On 2014-08-25 02:33:45 +0000, Francisco de la Peña wrote:

Created attachment 1850
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 16000 Hz

Tests with attached file:
playmus -r 22050 0000_227.wav # plays garbage
playwave -r 22050 0000_227.wav # plays garbage
playmus -r 44100 0000_227.wav # plays garbage
playwave -r 44100 0000_227.wav # plays OK

On 2014-08-25 02:44:46 +0000, Francisco de la Peña wrote:

(In reply to Lauri Kenttä from comment # 0)

If the audio device is opened at 48000 Hz and a music file is at 44100 Hz,
the resampler produces garbage (unrecognizable noise). This only happens
with Mix_Music. If the same file is opened as Mix_Chunk, it works fine.
Apparently this is not bug # 58 anymore but something new instead.

According with tests it fails with Mix_PlayWAV too under different wave files. I guess is related with # 58 and might be about buffer size issues.

On 2014-09-21 21:28:56 +0000, Francisco de la Peña wrote:

Looks like this issue got resolved at # 2389. Works for me in SDL Hg.

On 2014-09-22 01:32:56 +0000, Francisco de la Peña wrote:

Created attachment 1876
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 43000 Hz

Though the bug # 2389 fixes all playwave (Mix_Channel) tests it still plays alternated garbage between buffer chunks with playmus (Mix_PlayMusic), most noticeable when mixer playback frequency is lower:

playmus -r 11025 0000_227-43000Hz.wav # plays garbage between buffer chunks
playmus -r 22050 0000_227-43000Hz.wav # plays garbage between buffer chunks
playmus -r 44100 0000_227-43000Hz.wav # plays garbage between buffer chunks
playmus -r 48000 0000_227-43000Hz.wav # plays garbage between buffer chunks
playmus -r 96000 0000_227-43000Hz.wav # plays garbage between buffer chunks

On 2015-04-11 20:30:31 +0000, wrote:

This seems to be a bit more complicated than the comments here indicate.

I'm trying to play a 48 kHz ogg file (Mix_LoadMUS) and a wav effect file (Mix_LoadWAV). This seems to be broken in several different ways. Tested on Ubuntu 64 bit, OSX Yosemite and Windows XP (under VirtualBox).

If the selected output rate of Mix_OpenAudio is not exactly 48k (for example 44.1) then the music plays back as noise on every platform.

If the wav effect file is 44.1, then both Linux and OSX play it just fine. However on Windows, it produces just static noise. Using a 48k wav file works on all platforms.

On 2017-10-21 20:11:04 +0000, Sam Lantinga wrote:

This is fixed in the latest code in SDL and SDL_mixer Mercurial:
http://hg.libsdl.org/

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant