Beginning Game Audio Programming

Posted By: tlfpub

Game audio is frequently overlooked when it comes to designing and programming a good game. Often, developers spend so much time concentrating on the other facets of the game—for example, graphics and AI—that they neglect the music and audio side until it's nearly too late. That's a shame, because good game audio and game music have at least as much, if not more, power to instantly pull the player into the game world and play with his emotional state. Even the best graphics in the world will seem flat if they're not augmented with great sound.

Historically, books on game audio have been few and far between, because programming game audio wasn't that complex. Making a speaker beep or playing a simple sound in mono through a 1990s-era soundcard was fairly self-explanatory. Today, however, things like 3D sound, environmental audio, MP3 playback, and CD audio present difficult technical hurdles for even the simplest game.

This book is an introduction to some of the challenges programmers will face in implementing audio for their games. It is written to teach beginning game audio principles. The first half teaches you how to overcome the technical hurdles present in doing basic audio tasks—playing sound effects, loading and examining WAV files, and playing music in various formats (MIDI, MP3, and tracked music).

The second part of this book teaches some more advanced audio techniques. You'll learn how to compose dynamic music, and how to implement it in your game. You'll also learn about the basics of 3D sound programming, environmental audio, audio scripting, effects processing, and visualization. There's also one chapter devoted to using DirectPlay Voice for real-time voice chat in your game!

Most of this book uses DirectX and DirectX Audio, though there are a few chapters that use OpenAL Audio or generic Win32 audio APIs. Everything is in C++ and uses the Standard Template Library's low-level data structures (vectors, maps, and so on).

To get the most out of this book, you'll need to be comfortable with C++, though not necessarily an expert. However, you will need to understand innately how a Windows program works. You should be comfortable with event-driven programming and the everyday uses of the Win32 API, including writing GUI code for buttons, edit boxes, list boxes, and so on.

A passing knowledge of DirectX is also required. You should be familiar with how to obtain and release interfaces to various DirectX components, and should understand what DirectX does, why it's useful, and where you can go for help if you need it.