Game Development Community

Help with learning game audio implementation/programming

by Shogun Sound · in General Discussion · 02/27/2006 (3:26 pm) · 2 replies

Greetings all,
I have been working with film audio for a number of years and have developed a very keen interest in game audio and its background.

I am currently trying to make the jump from creating original sound design and scoring to the actual implementation of audio into the game. In other words the actual programming.

My problem is this: there is sooo much to start from. I have read up on all of the different programs available and it seems there are many, many different audio apps out there(Scream, Xact, GameCoda, DirectX,3D sound etc)


You can see my problem. Where in the world do I start?

The other concern is that I have a background in audio engineering, not programming. Smart with audio, ignorant with programming : )

So what advice can you give me?
Is there a good place to start? I'm guessing I should start somewhere with basic programming and move into audio specifics?

I'm located in Seattle, so if anyone knows of any educational resources and/or classes to help me out that would be great. I do know that this involves more than just audio programming, and that I would be dead in the water if I jumped in without some programming background, but I have plenty of time and would really like to learn so . . . .

One more thing: As I am located in Seattle, I would be happy to trade services with anyone within the Seattle/Vancouver BC area.
I can do your game sound effects and music if you can let me peek into the the programming and answer my questions.

thanks

#1
03/04/2006 (9:33 am)
Well buy Torque game engine and learn it's audio system (OpenAL). To start with. We really don't mess with other engines too much round' these parts.
#2
03/04/2006 (10:14 am)
Shogun,

Audio/sound in games is really quite simple.
Speaking in the case of torque, which uses OpenAL, it goes like this:

Each sound you hear is played from a sound buffer. Sound buffers are created and filled in via AudioBuffer objects. AudioBuffer objects are resources, so for each individual sound file loaded, a new AudioBuffer is created. Multiple sounds can share the same sound buffer from an AudioBuffer.

Some sounds may have more than one sound buffer attached to them. These are streaming sounds, typically used for music. Their buffers are dynamically filled in, so they don't use an AudioBuffer object - rather, they are loaded straight from the sound file. Multiple buffers are used since you can keep adding in audio data whilst still playing the sound.

So now you have buffers, but how are they played?

Well, there are a set amount of sound sources, of which these sound buffers can be assigned to. The sources have many properties, including position, velocity, min/max attenuation distances, and so on.
Unfortunately, there are only a certain number of sound sources that can be used at one time, so a scoring system is used to play only the most important sounds (based on volume and distance from listener). When a new sound is played, and there is no available source, then the scores of all the current active sources are checked to see which is the best to free up (also known as culling).

Once a sound is culled, you obviously won't be able to hear it again, as it will have likely been replaced by another sound. So periodically the list of culled sounds is checked, to see if there are any which can be unculled. If there are any, they are moved back into the active sound list (in a sense, resurrected).

Finally of course you have the listener, which corresponds to the position of the object you are currently controlling, and is updated every frame. The listener also has a velocity, which is useful when simulating doppler shift.
To wrap the buffers, sources, and listener up, you have the context, which is created from a device. The context can control things such as environmental effects, and of course, most of everything else. In fact, you could probably think of the context as the world.

I hope this makes sense, and more importantly, gives you an insight into implementing an audio system :)