In this section, I briefly describe the basic audio concepts seen in today’s AAA games.
Ambient sound is a background noise present in your scene. Ambient sound is very important in video games. It performs a number of functions including:
- Providing audio continuity in your scene.
- Preventing an unnatural silence when no other sound is present.
- Establishing or reinforcing the mood.
Ambient sounds in Vanda Engine 1 have no position or direction.
First of all, I should explain how 3D sound system works in today’s games. There are 3 main things you need to be aware of: the listener, the sources, and attenuation by distance.
Each sound source has a 3D coordinate which describes where it should be coming from. You should also assign an audio data to each sound.
The use of a listener in 3D sound is important so that you have a reference point from which to hear sounds. The listener is the ears of the world, and as such, there’s only one listener. Listener has a position and orientation. The position indicates where the listener currently is. The closer a listener is to a sound source’s position, the louder the sound will get. The orientation is where the listener is facing. For example, if a listener is facing west and a sound is coming from the north, the sound will appear to come from the right. However if the user orientation changes and turns to face the north, the sound will now appear to come from straight ahead. Listener in Vanda Engine 1 is automatically attached to the current active camera and inherits its position and direction.
In Vanda Engine, a 3D head with 2 ears is attached to current active camera
Attenuation is essentially the ability of a sound to lower in volume as the listener moves away from it. The effective attenuation of a source depends on many factors, among which distance attenuation and source and listener gain are only some of the contributing factors.
Vanda Engine 1 uses Inverse Distance Rolloff Model to attenuation the source gain by its distance from the listener position.
Inverse Distance Rolloff Model – y: audio volume, x: distance between character and 3d sound source
Ogg Vorbis Audio Format
Most 3D games use .ogg file format. In general, Ogg Vorbis is much better than Mp3 format and gives you better quality for the same file size. Unlike MP3 format, Ogg format can be looped seamlessly. Ogg is free and open source, which makes it unrestricted by software patents.Many games use Ogg at 44.1 kHZ or 48 kHZ for game audio. There are several programs to convert, encode, and decode Ogg Vorbis. I personally use Audacity to save .ogg files. It’s free and open source with a variety of plugins and effects.
Ogg is the native audio format for Vanda Engine.
Mono vs. Stereo
When recording sounds, you can save it in stereo or mono format. The difference between these types is number of channels. Mono uses 1 channel. Stereo uses more than one channel to create the impression of sound heard from various directions. Mono files are smaller in size, easy to record, and suitable for sound sources of your game. If you use stereo files for sound sources located in your 3D level, Vanda Engine (and other game engines) won’t be able to calculate 3D sound based on the parameters of source and listener. Stereo sounds are more expensive for recording, require technical knowledge to record, and suitable for ambient sounds of your game. In Vanda Engine, ambient sounds have no position and direction, and listener parameters (position and direction) have no effect on their volume and channels.
This tutorial has just scratched the surface of audio in today’s games. Sounds have an important role in games. They can create interactive stories using voice over and sound effects positioned in a 3D environment. In the next tutorial, we position a sound source in our 3D level and play/pause/stop it with triggers and basic scripting.