Implementing Audio into my game engine, what should I use?

Started by
8 comments, last by EddieV223 10 years, 6 months ago

Hello! I am creating a game engine and I am now ready to implement audio into my engine. The problem is, I don't know which API would be the best to use. My engine currently uses DirectX 11 and I might implement an OpenGL backend soon. I've looked at FMOD, is that good? Would going with DirectSound be better? Is there another audio API that I should check out? Thanks :)

Advertisement

It depends on your needs, budget, and coding capacity. If you are only going to be using windows, and can code pretty well, and have the time, you may be fine using the latest sound API that comes with DirectX. But, if you go this route, you will have to code more things on your own.

FMOD is a great API, but if you are interested in commercial usage, you are going to have to pay to use this one. It does many things for you though.

I've used IrrKlang in the past, and it is great, but you also have to pay for it, though it is less than FMOD by far.

I know that there are some open source engines, and some of them use OpenAL. You could also use OpenAL yourself directly, but it has some of the same problems that DX's sound API has, in that there aren't that many things done for you. This may be a good thing for you though.



You don't provide enough info to really be able to make a recommendation.

Do you ever have any intent to make your engine work outside of Windows (iOS, Android, Mac, etc...)?

presuming 'no', what is your target game developer? if's indy or small developers without a lot of budget, then sticking with the free stuff (XAudio2 if you're on Windows) may be the best way to go.

If you're looking at selling this to sophisticated game developrs, then you'd want to make sure you engine easily integrates with the advanced, high-level audio tools/API's from FMod and/or Wwise.

A simple API like XAudio2 or DirectSound is ok if all the game needs to do is play wave files in response to game events. But that is considered extremely basic these days and note really sufficient for all but the simplest of titles

Brian Schmidt

Executive Director, GameSoundCon:

GameSoundCon 2016:September 27-28, Los Angeles, CA

Founder, Brian Schmidt Studios, LLC

Music Composition & Sound Design

Audio Technology Consultant

Personally I use libbass - it's so easy it's almost embarrassing - which means i respect its creator

http://www.un4seen.com/

however, it's not very multiplat, and suffers from the yet-another-dll symptom

It's very unfortunate on linux where just loading a shared dll without having to "install" it is a nightmare

Other than that, it's probably the easiest one to use, and it's also for pretty much every system and language you could imagine

Including: C, C#, Java, Android, iOS, ARM linux

At least for C/C++ it's available in 32 and 64-bit

And, on top of that it has alot of plugins you can use to extend its functionality

The reason I'm a big proponent of this thing is because its less than 100 lines of code to create a multi-stream crossfading system so you can have multiple ambient __streams__ running at the same time. Not sure if you can as easily do that with the other libs out there.

Finally, having multiple sound sources of the same sound is as simple as increasing sample count from 1 to N, such as 4. that gives you 4 sample channels of the same sound you could run.

I haven't tried fmod, but I know many people use it, so if you are unsure you could just go with that


A simple API like XAudio2 or DirectSound is ok if all the game needs to do is play wave files in response to game events. But that is considered extremely basic these days and note really sufficient for all but the simplest of titles
I considered XAudio2 fairly flexible in design (albeit not necessarily efficient in terms of price/benefit). Would you elaborate please?

Previously "Krohm"

I use OpenAL and Ogg Vorbis (http://www.vorbis.com/) for all my 2D and 3D audio needs.

You don't provide enough info to really be able to make a recommendation.
Do you ever have any intent to make your engine work outside of Windows (iOS, Android, Mac, etc...)?
presuming 'no', what is your target game developer? if's indy or small developers without a lot of budget, then sticking with the free stuff (XAudio2 if you're on Windows) may be the best way to go.
If you're looking at selling this to sophisticated game developrs, then you'd want to make sure you engine easily integrates with the advanced, high-level audio tools/API's from FMod and/or Wwise.

A simple API like XAudio2 or DirectSound is ok if all the game needs to do is play wave files in response to game events. But that is considered extremely basic these days and note really sufficient for all but the simplest of titles

Hello! Sorry it took so long to reply. My engine is for Windows but I also would like to be ready for if I ever port to a next generation console.

Since cross platform seem to be one of your concern, If FMOD doesn't suit you, I recommend you to look at portaudio and libsndfile. Portaudio is essentially a wrapper around existing sound library like direct sound on windows and ALSA on linux.

libsndfile allow you to load fairly easily audio file, and read their content without thinking too much about the underlying file format, and it's obviously quite easy to use along portaudio. These libraries are open source and free to use, so you can easily modify it for your need.

I added sound to my engine recently. After looking into Wwise and FMOD Ex, I chose to go with FMOD Ex.

It was easy to get up and running, and it has many convenient features. However, I was really wanting something open source and free.

After a while of using FMOD, I switched to OpenAL-soft (http://repo.or.cz/w/openal-soft.git) and a free ogg-vorbis decoder (http://nothings.org/stb_vorbis/).

I had to write a streaming layer on top of OpenAL (something that is built-in with FMOD), and integrate the ogg-vorbis decoding. And I lost the voice virtualization feature that FMOD has.

OpenAL is definitely not as full-featured as something like FMOD, but its a very good low-level sound API for games.

I'm much happier having the source so I can debug things (and fix them myself, if need be). Also there are no per-platform per-game licensing fees to manage.

Very pleased with OpenAL-soft so far. Hopefully there aren't too many audio hardware compatibility issues with it. OpenAL-soft handles all of the mixing in software using SSE-optimized code, so it isn't asking all that much from the hardware.

I found that because openGL and openAL have very similar API, if you are already implementing openGL picking up openAL will be very easy. However there is another solution.

SFML2 has an Audio module, this module is a beautifully written and easy to use, object oriented wrapper around openAL api. So to make things much easier you could just use that module. Also it supports many formats thanks in part to using libsndfile internally as well.

Your situation is why SFML2 exists, and it's module design.

BTW, the SFML2 audio module does support 3D positional audio. To many people think SFML2 is just a 2D library.

If this post or signature was helpful and/or constructive please give rep.

// C++ Video tutorials

http://www.youtube.com/watch?v=Wo60USYV9Ik

// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

// Excellent 2d physics library Box2D

http://box2d.org/about/

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20

This topic is closed to new replies.

Advertisement