Sign in to follow this  

Audio library pros/cons

This topic is 1831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='Nairou' timestamp='1343455420' post='4963871']
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.
[/quote]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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[quote name='SuperVGA' timestamp='1354731107' post='5007464']
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: [url="http://www.sfml-dev.org/license.php"]http://www.sfml-dev.org/license.php[/url]
[/quote]
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='Cornstalks' timestamp='1354731855' post='5007468']
[quote name='SuperVGA' timestamp='1354731107' post='5007464']
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: [url="http://www.sfml-dev.org/license.php"]http://www.sfml-dev.org/license.php[/url]
[/quote]
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.
[/quote]

Oh... I didn't notice that. Thanks for the heads-up. I should go with Nairou's approach, then,
although it's tempting to be able to construct sounds on the fly with portaudio...

Share this post


Link to post
Share on other sites
There is a library called [url="http://www.ambiera.com/irrklang/irrklang_pro.html"]irrKlang[/url] that has been created by Niko who created the Irrlicht 3d engine(at least before it was left to the community). It is a commercial engine, but it is cross-platform, and isn't near the price of FMOD. It depends on how much you intend to sell the game for though. You can also use the free version until you are ready to sell, so that you can do the testing and even development of the game meanwhile.

I used it some, and it worked fine for me on windows. It loads the formats etc... for you, like FMOD does, so you don't have to worry about that, or thread loading the sound buffers, or anything low level like that. It also does 3d sound. Under the hood, it can use a few different options, depending on the OS. I'd say it is worth a try.

Share this post


Link to post
Share on other sites

This topic is 1831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this