Sound: SDL_Mixer and SMPEG (mp3's and ogg's)

Member
Posts: 233
Joined: 2003.05
Post: #1
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

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #3
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:
http://www.nouturn.com/oggdrop/download.html

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:
http://www.illadvised.com/~jordy/
http://www.illadvised.com/~jordy/QTOggVorbis.dmg

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!

Aaron

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #4
Well, I'm done with MP3

http://www.mp3licensing.com/royalty/index.html

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

Aaron

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
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.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #6
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

Aaron

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDl_mixer and image bronxbomber92 3 3,571 Dec 15, 2006 12:27 PM
Last Post: bronxbomber92
  Installing SDL_image & SDL_mixer bronxbomber92 8 5,833 Oct 14, 2006 09:39 PM
Last Post: szymczyk
  Using SDL_mixer to play ogg sound (not music) effects kordova 3 6,537 Sep 1, 2006 12:29 PM
Last Post: kordova
  SDL_mixer exception at Mix_PlayMusic kordova 2 3,499 Sep 1, 2006 04:09 AM
Last Post: kordova
  SDL/SDL_mixer problems with Xcode poffy 1 3,649 Mar 7, 2006 02:45 AM
Last Post: OneSadCookie