Audio cracking with SDL_mixer

Hello,
I have some issues with SDL_mixer playing wav files on an
embedded linux devices (namely Nokia N810) with alsa underneath.

I use vanilla .wav files with Mix_LoadWAV and everything works
fine on application start, but after having left it running for
more than a day and the audio becomes cracky.

The only somewhat exotic thing about the application is that it
closes the mixer when it’s not being used and reopens
it when needed again (so that it releases the dsp and allows
the arm cpu to reduce frequency and thus save power).

The sounds become normal if I restart the application, which
indicates that it’s not a driver issue but rather
an SDL_mixer/SDL issue or somethings wrong with the way
I use the SDL_mixer.

I’ve pretty much ruled out memory corruption on my behalf, since
the cracking different on each play and there are no other
indications of it (valgrind is clean and the gfx work just fine).

I just finished checking with SDL 1.2.14 and SDL_mixer 1.2.9
but the same issue persists.

And with the newer SDLs I tried ogg playing with MIX_PlayMusic
and same thing.

The only “working” alternative I’ve tried was to kick aplay
with system().

Any help or ideas appreciated. I can provide more detailed
description, but some pointers as to what to try next would
be nice. (e.g. if you want a short recording of what the
cracking really sounds like)

cheers,
Tommi Kyntola

There may be some issue with drift between the ALSA driver and the
user callback. Have you tried ALSA OSS emulation? Or is there a
lower level sound layer that you can hook SDL up to?

What is the output when you set the SDL_AUDIO_ALSA_DEBUG environment
variable with SDL 1.2.14?

See ya,
–SamOn Thu, Oct 22, 2009 at 12:52 AM, Tommi Kyntola <tommi.kyntola at ray.fi> wrote:

Hello,
I have some issues with SDL_mixer playing wav files on an
embedded linux devices (namely Nokia N810) with alsa underneath.

I use vanilla .wav files with Mix_LoadWAV and everything works
fine on application start, but after having left it running for
more than a day and the audio becomes cracky.

The only somewhat exotic thing about the application is that it
closes the mixer when it’s not being used and reopens
it when needed again (so that it releases the dsp and allows
the arm cpu to reduce frequency and thus save power).

The sounds become normal if I restart the application, which
indicates that it’s not a driver issue but rather
an SDL_mixer/SDL issue or somethings wrong with the way
I use the SDL_mixer.

I’ve pretty much ruled out memory corruption on my behalf, since
the cracking different on each play and there are no other
indications of it (valgrind is clean and the gfx work just fine).

I just finished checking with SDL 1.2.14 and SDL_mixer 1.2.9
but the same issue persists.

And with the newer SDLs I tried ogg playing with MIX_PlayMusic
and same thing.

The only “working” alternative I’ve tried was to kick aplay
with system().

Any help or ideas appreciated. I can provide more detailed
description, but some pointers as to what to try next would
be nice. (e.g. if you want a short recording of what the
cracking really sounds like)

cheers,
Tommi Kyntola


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

I’ve now run quite a few more tests and it seems like my earlier tests
were infact using the default esd (putenv for SDL_AUDIO_DRIVER got misplaced
somewhere along the line). Sorry about the bogus report.

New SDL and SDL_mixer run fine using alsa directly after days of uptime,
which is all I need.

Obviously this leaves me wondering what cause was even with esd since I
assume the SDL_MixerClose does close the connection to esd, right?
(or atleast it causes the esd to close the dsp, since it did allow the
device to lower cpu frequency)
So wether the cause/bug is in esd on in sdl remained unanswered.

I can look into it if you like, but we’re all happy campers here with alsa.

cheers,
Tommi Kyntola

Sam Lantinga wrote:> There may be some issue with drift between the ALSA driver and the

user callback. Have you tried ALSA OSS emulation? Or is there a
lower level sound layer that you can hook SDL up to?

What is the output when you set the SDL_AUDIO_ALSA_DEBUG environment
variable with SDL 1.2.14?

See ya,
–Sam

On Thu, Oct 22, 2009 at 12:52 AM, Tommi Kyntola <@Tommi_Kyntola> wrote:

Hello,
I have some issues with SDL_mixer playing wav files on an
embedded linux devices (namely Nokia N810) with alsa underneath.

I use vanilla .wav files with Mix_LoadWAV and everything works
fine on application start, but after having left it running for
more than a day and the audio becomes cracky.

The only somewhat exotic thing about the application is that it
closes the mixer when it’s not being used and reopens
it when needed again (so that it releases the dsp and allows
the arm cpu to reduce frequency and thus save power).

The sounds become normal if I restart the application, which
indicates that it’s not a driver issue but rather
an SDL_mixer/SDL issue or somethings wrong with the way
I use the SDL_mixer.

I’ve pretty much ruled out memory corruption on my behalf, since
the cracking different on each play and there are no other
indications of it (valgrind is clean and the gfx work just fine).

I just finished checking with SDL 1.2.14 and SDL_mixer 1.2.9
but the same issue persists.

And with the newer SDLs I tried ogg playing with MIX_PlayMusic
and same thing.

The only “working” alternative I’ve tried was to kick aplay
with system().

Any help or ideas appreciated. I can provide more detailed
description, but some pointers as to what to try next would
be nice. (e.g. if you want a short recording of what the
cracking really sounds like)

cheers,
Tommi Kyntola


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Great, glad to hear it! :)On Mon, Oct 26, 2009 at 1:45 AM, Tommi Kyntola <tommi.kyntola at ray.fi> wrote:

I’ve now run quite a few more tests and it seems like my earlier tests
were infact using the default esd (putenv for SDL_AUDIO_DRIVER got misplaced
somewhere along the line). Sorry about the bogus report.

New SDL and SDL_mixer run fine using alsa directly after days of uptime,
which is all I need.

Obviously this leaves me wondering what cause was even with esd since I
assume the SDL_MixerClose does close the connection to esd, right?
(or atleast it causes the esd to close the dsp, since it did allow the
?device to lower cpu frequency)
So wether the cause/bug is in esd on in sdl remained unanswered.

I can look into it if you like, but we’re all happy campers here with alsa.

cheers,
Tommi Kyntola

Sam Lantinga wrote:

There may be some issue with drift between the ALSA driver and the
user callback. ?Have you tried ALSA OSS emulation? ?Or is there a
lower level sound layer that you can hook SDL up to?

What is the output when you set the SDL_AUDIO_ALSA_DEBUG environment
variable with SDL 1.2.14?

See ya,
–Sam

On Thu, Oct 22, 2009 at 12:52 AM, Tommi Kyntola <tommi.kyntola at ray.fi> wrote:

Hello,
I have some issues with SDL_mixer playing wav files on an
embedded linux devices (namely Nokia N810) with alsa underneath.

I use vanilla .wav files with Mix_LoadWAV and everything works
fine on application start, but after having left it running for
more than a day and the audio becomes cracky.

The only somewhat exotic thing about the application is that it
closes the mixer when it’s not being used and reopens
it when needed again (so that it releases the dsp and allows
the arm cpu to reduce frequency and thus save power).

The sounds become normal if I restart the application, which
indicates that it’s not a driver issue but rather
an SDL_mixer/SDL issue or somethings wrong with the way
I use the SDL_mixer.

I’ve pretty much ruled out memory corruption on my behalf, since
the cracking different on each play and there are no other
indications of it (valgrind is clean and the gfx work just fine).

I just finished checking with SDL 1.2.14 and SDL_mixer 1.2.9
but the same issue persists.

And with the newer SDLs I tried ogg playing with MIX_PlayMusic
and same thing.

The only “working” alternative I’ve tried was to kick aplay
with system().

Any help or ideas appreciated. I can provide more detailed
description, but some pointers as to what to try next would
be nice. (e.g. if you want a short recording of what the
cracking really sounds like)

cheers,
Tommi Kyntola


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC