SDL_Mixer and music pops

I’m using SDL_Mixer to play music. The music pops when I first start a new .mp3. I’m going to try .ogg to see if this format change stops the popping, but was wondering, even if it does, if there might be some other solution.

When initializing the mixer,

Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);

If I use a higher value, such as 4096 for the sample size (instead of 1024) it makes no difference, presumably because this value is used only for sound channels, not music. In the documentation is says that larger values here can stop pops in the sounds. Any similar setting for music somewhere?

I’m using SDL_Mixer to play music. The music pops when I first start a new
.mp3. I’m going to try .ogg to see if this format change stops the
popping, but was wondering, even if it does, if there might be some other
solution.

You might try fading in the music (Mix_FadeInMusic(), I believe) as a band-aid
to mute the pop - but this sounds like a bug in the CODEC or in SDL_mixer…

When initializing the mixer,

Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);

If I use a higher value, such as 4096 for the sample size (instead of 1024)
it makes no difference, presumably because this value is used only for
sound channels, not music. In the documentation is says that larger values
here can stop pops in the sounds. Any similar setting for music somewhere?

AFAIK, SDL_mixer doesn’t support multiple simultaneous devices, and without
that, there can only be one buffer setting. (*)

Anyway, too small buffers result in occasional or constant clicking, popping,
stuttering and similar problems. That seems like a different problem from what
you’re describing.

(*) To be correct, you can actually run multiple "buffer settings"
in paralell on one device when using a shared DMA buffer, but
although SDL uses that internally in many cases, it doesn’t make
that interface available to applications and add-on libraries.
These kind of tricks with the DMA buffer were commonly used in
the past for low latency sound effects; you’d get the occasional
attack of a sound effect cut off (“pre-mix” went in too late),
instead of constant stuttering and popping.On Monday 25 October 2010, at 23.34.22, “VernJensen” wrote:


//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://olofsonarcade.com http://kobodeluxe.com |
’---------------------------------------------------------------------’

Yes, I already tried fading it in to mask the popping at the start, and yet, this doesn’t completely cover it – only makes it “less bad” – and I have to make the fade-in so long to even have this partial improvement that it’s really not a good solution.

Sounds like the only solution is switch .ogg which hopefully works. :-p

Yup, OGG files play with no problems. I guess I’ll just switch to that, which’ll increase my game’s download size by a few megabytes, but oh well.