Advertisement

Audio library pros/cons

Started by July 27, 2012 09:29 PM
10 comments, last by kburkhart84 11 years, 11 months ago
I'm ready to start adding sound effects to my game, so I've been looking at audio libraries. My requirements are that the library be cross-platform, free for commercial use, and under a friendly license (not GPL/LGPL).

The three main options I see right now are Fmod, OpenAL, and PortAudio. However, each one has both pros and cons to them.

Everyone knows Fmod, its used in tons of game, has all sorts of tools to make it easy. There is a free version of it, but I eventually plan to sell my game, so I can't go with a free license. However, I also can't afford to spend $500 on an audio library.

OpenAL seemed to be the next logical choice. Not so simple, not as much documentation, but free to use. However, in looking into it again recently, it appears that development has gone proprietary, and only the old 1.1 version is still freely available. Choosing an old abandoned library to learn to use for the first time doesn't sound like all that great an idea.

And then there is PortAudio. Also free, and very much in active development. However, it is also extremely low level, more targeted towards professional audio applications than games. It seems to be little more than an abstraction of the audio hardware, so everything on top of that (file decoding, volume adjustment, effects, etc.) I would have to do myself (or find another library to sit on top of it). On one hand, it could be really useful when it comes to generating abstract sounds rather than just playing pre-recorded files (something I plan to do eventually to some degree), but for everything else it sounds like it will be a huge undertaking.

None of them seem to be ideal, but I haven't had much luck finding another audio library that fits my requirements. Are there other options that people know of? Something I'm overlooking?
Out of curiosity, why do you consider the LGPL to not be friendly?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Advertisement
Admittedly not for very strong reasons. Mostly because it prevents me from static linking the library. I don't know if there are other restrictions, the LGPL license is rather cryptic.
Why not SDL_mixer? If you want cross platform you would probably want to use the basic SDL anyway, so adding to it the mixer library seems like the most convenient choice.

I have heard some rumours that there are problems with OpenAL on Linux, but I can't confirm the credibility of this rumour.

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

I assume SDL_mixer can't be used independently from the rest of SDL? I'm using GLFW for display and input, I never cared much for SDL.

I assume SDL_mixer can't be used independently from the rest of SDL? I'm using GLFW for display and input, I never cared much for SDL.
Well, you could install SDL + SDL_mixer and then only initialize the AUDIO component and ignore the rest... But that would not make much practical sense I guess.

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

Advertisement
You should try MMAV (see http://chucklesoft.blogspot.com).
Sorry about the thread-gravedigging.

I don't really know much about sound libraries, but came across this as I'm looking for something similar.
I stumbled upon a thread on StackOverflow pointing me to SFML.
That seems to be popular, and the license is very open: http://www.sfml-dev.org/license.php

Sorry about the thread-gravedigging.

I don't really know much about sound libraries, but came across this as I'm looking for something similar.
I stumbled upon a thread on StackOverflow pointing me to SFML.
That seems to be popular, and the license is very open: http://www.sfml-dev.org/license.php

FYI, SFML itself doesn't handle the audio. It just uses sndfile and OpenAL to read/play audio, so you still have to abide by sndfile's and OpenAL's licenses. Look at the bottom of that page you linked to and notice the external libraries used by SFML and their associated licenses, all of which you have to abide by.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
As a follow up, I used PortAudio for a while, and got everything up and running with Ogg playback. It worked well, sounded good, but had non-constant latency that I could never fully get rid of.

In the end, I scrapped it and decided to just use each platform's native audio API (XAudio2 on Windows, PulseAudio on Linux) and decode Ogg myself using stb_vorbis, rather than try to find a single cross-platform library to do it all for me. Latency is gone, and I have the platform code abstracted behind a common interface, so it meets my requirements well enough for now.

This topic is closed to new replies.

Advertisement