First off, I want to express my condolences to those who’ve suffered as a result of the Paris attacks that just happened on the 13th. As an American of French descent, my heart and spirit go out to you during this trying time.
Today we will be covering a very important aspect of 3D game development… Audio! If you’ve ever wanted to create a game so immersive that you feel like you’re actually there, you know that you’re going to need sounds to come from every possible direction of the aural spectrum.
Thankfully, most 3D Audio APIs already provide this functionality, and one of them (OpenAL) just happens to be cross platform! Joy! 😀
To begin with, it’s important that you understand the difference between stereophonic and monaural sound. Stereophonic sound utilizes two channels to create the illusion of depth, whereas Monaural sound only contains one channel (as indicated by the title of this article) and is only played from one position.
How does this factor into a 3D game?
OpenAL can handle both three-dimensional and two-dimensional audio tasks with relative ease. For your own purposes, though, you’ll most likely use stereophonic audio for background music and sound effects that are localized to the player’s user experience (going through menus, or anything not directly-related to the action on screen). You’ll use monaural audio, instead, for all in-game sound effects, and/or positional dialogue exchanged between the Player-Character (PC) and Non-Player Characters (NPCs), thereby creating a natural feeling of depth.
So, now that we understand which types of sound assets are best fit for 3D manipulation, why do they need to be Monaural in the first place?
OpenAL needs assets meant to be manipulated in 3D space to be monaural because only monaural tracks have the ability to be processed that way (i.e. have their “center” adjusted) by the API. A monaural track is, by design, intended to be broadcast from one point specifically. OpenAL, by utilizing its three-dimensional audio-processing capabilities, allows you to manually define what that point can be. In the case of stereophonic audio, on the other hand, the file in question has already been processed to create faux three-dimensional depth prior to being consumed by the API. Thus, wherever OpenAL tries to play stereophonic sound in 3D space, the result will sound the same, regardless.
My audio content pipeline is currently the following:
-Make music/audio in Linux MultiMedia Studio
-IF it’s music, compress it to .OGG when exporting
-IF it’s a sound-effect, don’t compress it (use .WAV)
-IF I have sound effects, open Audacity
–Open the .WAV sound effect files within Audacity (one at a time)
–Manually remove the second track of each .WAV sound effect file using (“Tracks” -> “Stereo Track to Mono”)
–Export each audio track with (“File” -> “Export Audio…”) and save it again as a .WAV file
At that point, your audio should be ready for 3D manipulation by any three-dimensional audio API! Time to celebrate! 🙂
As always, questions and comments are welcome.
Vive la France! 🙂