Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a game that, up until now, uses SDL_mixer for playing MP3 sound effects. Works on Linux, Windows, OSX. At the moment doesn't work on 64 bit Linux, so I was thinking of switching to FMOD.

Anyway, it would be nice if the game also worked on the PI, for when I get one. Is there a C library for mp3 playing that works on the PI? Does SDL_mixer work? I took a look at mpg123, but on Windows its just an exe and I need a cross platform lib. FMOD is not available for the PI.

share|improve this question
Where did you read 'SDL_mixer does not work'? SDL_mixer seems to the easiest cross platform lib. However the MP3 audio format is dependent on additional libraries; which, may not be as portable. Have you tried switch the audio files to .wav? – emcconville Oct 9 '12 at 14:57
I thought I read it "somewhere" on a forum today, but I can't find it. Have reworded my post. Also, I haven't got a PI so I can't try your suggestion yet. – ScrollerBlaster Oct 9 '12 at 15:18
you could use something like libsox for reading the mp3 and portaudio for audio playback. maybe not optimal, but it works. – Bjorn Roche Oct 10 '12 at 1:41
I'll look into it. Thanks. – ScrollerBlaster Oct 10 '12 at 7:48
up vote 4 down vote accepted

I can confirm that SDL_mixer works on the pi. I am working on a platform game and use SDL for graphics and sound. My sounds are in the ogg format, but SDL_mixer promises mp3 support as well. I have raspbian, every SDL package I needed I could install from the repositories. Btw, the same game runs well and with sound on 64 bit linux too (at least Ubuntu and Debian).

Incidentally, to get SDL graphics working in the console, have a look here for initializing it. Main point: first determine the screen dimensions with SDL_GetVideoInfo(), then initialize with those values.

share|improve this answer
This is encouraging. However I have a bigger problem with SDL graphics which prevents my game from starting, see: raspberrypi.stackexchange.com/questions/3285/…. I will accept this answer to the audio problem for now. – ScrollerBlaster Nov 9 '12 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.