iDevGames Forums
Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Sound: SDL_Mixer and SMPEG (mp3's and ogg's) (/thread-6933.html)

Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - aaronsullivan - Jul 9, 2003 10:45 PM

I'm working on an SDL/OpenGL engine for my own future games, and I've got SDL_Mixer working for sound and even music.

But... I was hoping to use MP3 files.

I went through a lot of stupid wrestling with SMPEG, I finally have it compiled into a framework and it's in the same folder as SDL and SDL_Mixer.

So, I use the example program from the SDL_Mixer page, included the necessary Frameworks and even the search paths, but I can't seem to get any mp3's to play.

It plays .wav's and it plays .ogg's but no mp3's.

The error comes when calling Mix_LoadMus()
"Module format not recognized" Shock

I get Wacko making all these libraries work together, but I thought this would be simple as it's all worked on by the same people, mostly. The documentation clearly states that SDL_Mixer can play .mp3's "through" SMPEG.

SMPEG seems to be the center of the problem.

Anyone have any idea why this isn't working?

If I can't get it to work, I can go with ogg vorbis. Only... does anyone know any good utilities for encoding/editing .ogg's? I can write a program to PLAY them, now. Wink

Is Ogg Vorbis a good format for sound effects as well as music? I only have vague recollections about both.

Really, though, I'd like to get mp3's working if I could. It'll streamline music development AND give players the ability to swap in their favorite tunes (unless they go with AAC! DoH!) Rolleyes

( Strangely, the .ogg's play WITHOUT the ogg library they say you need. Shock Wacko )

Thanks! I'm going to bed. ZZZ

Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - OneSadCookie - Jul 10, 2003 03:41 AM

Be aware that there are licensing issues with MP3s, and that if you use SMPEG to play MP3s you probably need to pay whoever owns the rights to MP3s.

QuickTime avoids this problem, since Apple pays the fees.

Ogg/Vorbis avoids those issues (that's what the format was designed to do -- replace MP3 without the licensing issues). I'd imagine that the standard Ogg/Vorbis tools for Linux would work without a hitch on Mac OS X, whatever those tools provide... you might have to go via WAV.

Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - aaronsullivan - Jul 10, 2003 08:07 AM

I was under the impression that only encoding mp3's required payment of licensing fees. I'll have to look at that ASAP. Mad

Ogg seems to sound good and I found a couple of things to make life easier. (They are NOT command line, which is good for me, because I'm just not efficient that way yet. Blush)

Most importantly:

This is an encoder. It takes aiff files and CD audio. (It even downloads song names from a free music lister, but that's less important to me) It even allows you some control over compression vs. performance. Cool

And, also this quicktime extension:

This allows you to play Ogg Vorbis files in Quicktime and iTunes. Handy. Cool

So, as far as editing I'll stick to AIFF and then encode to vorbis and play with compression/performance till I get what I want.

Looks like I'll probably go with Ogg Vorbis, and provide links to these little software gems for users ambitious enough to change the music in the game... Grin

Going to check out MP3 licensing now...

Be right back.

Thanks, BTW!


Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - aaronsullivan - Jul 10, 2003 08:27 AM

Well, I'm done with MP3

75 cents a sale and having to deal with a license. No thanks. Rolleyes

I understand a lot of work goes into making these standards, but more thought needs to paid to licensing.

Anyway, that settles it for me. Grin

I'm going with ogg vorbis for sound and music.

Using SDL_Mixer it's a breeze. I heartily reccomend it.

If you are thinking about multiplatform (of course, supporting mac first and foremost!), a combination of SDL/OpenGL/SDL_Mixer is actually very easy to get working, with tons of documentation.

The only drawback might be distribution with the LGPL'd SDL and SDL_Mixer. I don't have a lot of experience with that yet so I'll just have to see.

Thanks again OneSadCookie for the heads up on mp3. Smile


Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - OneSadCookie - Jul 10, 2003 02:16 PM

LGPL is not an issue, particularly on the Mac.

All you have to do to satisfy the terms of the LGPL is dynamically link to the LGPLed library. This is a bit nasty on Linux, since the library probably has to be installed in /usr/lib or /usr/local/lib, but on Mac OS X you can use a framework inside the application bundle, and on Windows you can use a dll in the app's directory.

Sound: SDL_Mixer and SMPEG (mp3's and ogg's) - aaronsullivan - Jul 10, 2003 03:47 PM

Quote:on Mac OS X you can use a framework inside the application bundle, and on Windows you can use a dll in the app's directory. [/b]

I always thought that was the case, but didn't have the experience to back it up. I have to say that it's sweet that it's so simple to do. Cool

Where would we all be without OneSadCookie?

A drawback I can see to packing it in the app bundle, however, is that you'd basically have to offer an update installer (or detailed instructions) in order for users to get the benefits of the latest SDL updates...

Of course, few users would be savy enough to update all their dynamic libraries anyway... (besides Software Update ones.)

The best solution is a universal Software Update in the OS for third parties. It would be great to be able to register a newly installed library with it (maybe during installation of a program that uses the library) so the Software Update could automagically update, say, SDL whenever it needed it... Yeah, we're going off-topic here.

Another drawback to installing it in every app bundle, of course, is that EVERY application that uses SDL will have a copy of the library included in it's bundle. So if you have 50 apps that use it... you also have 50 redundant libraries. Sad

It won't stop me from giving my customers the best user experience, which is:
One Game App icon: click and play.

Thanks again