Skip to contentSkip to conversation

ALSA SDL VORBIS playback problem

DISCUSSION Christian Wolf 3 participants 4 messages Mar 2, 2010 – Mar 9, 2010

lore
Share & tools
lore
#0 lore raw

I'm using SDL on an ARM based board running Linux (Olimex-AT91SAM9261) . I successfully cross-compiled, installed and tested the libraries (SDL, SDL_mixer) on the system. The sound output is done thru ALSA (SDL_AUDIODRIVER=alsa). And the ogg file decoding thru libvorbis/libvorbisfile libraries.

Now I'm trying to play ogg files. First I used the Mix_LoadWAV macro from the SDL_Mixer library for playback. This worked, but the macro decompresses first the complete audio file into memory and then starts the playback. Thus leading to a long delay before playing the music. Therefore I tried a different approach with the Mix_LoadMUS macro (SDL_mixer) to play the ogg file. This function streams the files directly from the hard-disk and avoids the long decoding time. Unfortunately ALSA shows several buffer under-runs leading to a disrupted playback. To fix this I tried different buffer sizes, but the problem is still existent.

The code works fine on my host system, but not on the ARM target. And i'm not sure if these problems are caused by the ALSA lib?

Any sort of help would be great!

Thanks in advance
Christian
___________________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

Experiment. On the arm board:

$ oggdec myfile.ogg -o - | aplay -

Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation and it can't keep up. I can't imagine that's really the case though with that CPU.

Quoted 31 lines · Christian Wolf

I'm using SDL on an ARM based board running Linux (Olimex-AT91SAM9261) . I successfully cross-compiled, installed and tested the libraries (SDL, SDL_mixer) on the system. The sound output is done thru ALSA (SDL_AUDIODRIVER=alsa). And the ogg file decoding thru libvorbis/libvorbisfile libraries.

Now I'm trying to play ogg files. First I used the Mix_LoadWAV macro from the SDL_Mixer library for playback. This worked, but the macro decompresses first the complete audio file into memory and then starts the playback. Thus leading to a long delay before playing the music. Therefore I tried a different approach with the Mix_LoadMUS macro (SDL_mixer) to play the ogg file. This function streams the files directly from the hard-disk and avoids the long decoding time. Unfortunately ALSA shows several buffer under-runs leading to a disrupted playback. To fix this I tried different buffer sizes, but the problem is still existent.

The code works fine on my host system, but not on the ARM target. And i'm not sure if these problems are caused by the ALSA lib?

Any sort of help would be great!

Thanks in advance
Christian
___________________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 4 lines · Alex Austin

Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation and it can't keep up. I can't imagine that's really the case though with that CPU.

Libvorbis uses floating point operations while on your AT91SAM9261 you have a soft-float library (or even worse FPU emulation).

Try the integer only Tremor library linked here:
http://www.xiph.org/vorbis/

The API is slightly different (easier), as it can only generate S16_LE samples.

Daniel

Signature · 6 lines
Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführer: Dr. Uwe Kracke, Ust-IdNr.: DE 205 198 055

emlix - your embedded linux partner
#3 lore raw
In reply to Christian Wolf

libtremor fixed the problem. it seems the arm cpu was to busy with decoding ogg files thru the vorbis/ogg floating point libraries.

therefore i did the following:

1. i downloaded the sources for libtremor from the svn: [http://svn.xiph.org/trunk/Tremor/]
2. cross compiled them for my arm board
3. i also had to cross compile the SDL_mixer library again by adding the parameter "--enable-music-ogg-tremor" to the configure command

These steps finally fixed the buffer underrun problem completely.

Thanks for the help!!!

Christian

<[email protected]>,
<[email protected]>
In-Reply-To: <[email protected]>
Subject: Re: [alsa-devel] ALSA SDL VORBIS playback problem
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-UI-Message-Type: mail
X-UI-ATTACHMENT-ID-POSTFIX: 13a75ccc-b8f8-47b0-a4d0-35dc155c214c

-----Urspr=FCngliche Nachricht-----
Von: "Daniel Glöckner" <[email protected]>
Gesendet: 02-Mar-2010 21:03:14
An: Christian Wolf <[email protected]>
Betreff: Re: [alsa-devel] ALSA SDL VORBIS playback problem

Quoted 2 lines · Alex Austin

Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation an=

d

Quoted 2 lines

it can't keep up. I can't imagine that's really the case though with that CPU.

Libvorbis uses floating point operations while on your AT91SAM9261 you have a soft-float library (or even worse FPU emulation).

Try the integer only Tremor library linked here:
http://www.xiph.org/vorbis/

The API is slightly different (easier), as it can only generate S16_LE samples.

Daniel

-- =3D

Dipl.-Math. Daniel Gl=3DF6ckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 G=3DF6ttingen, German= y
Sitz der Gesellschaft: G=3DF6ttingen, Amtsgericht G=3DF6ttingen HR B 3160 Gesch=3DE4ftsf=3DFChrer: Dr. Uwe Kracke, Ust-IdNr.: DE 205 198 055

emlix - your embedded linux partner
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
___________________________________________________________
WEB.DE DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://produkte.web.de/go/02/
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel