NeL Sound

Features

  • 2D and 3D audio engine
  • Management of localized environment sounds (migration between 3d and 2d effects)
  • Management of audio environment (effect of environment on sound, etc)
  • Scripted composite sounds for environments including cross fades between randomly selected loops with an additional layer of randomly triggered spot sounds
  • Open AL, Microsoft Direct Sound, XAudio2 and FMOD implementations

Overview

The purpose of the NeL Sound Engine is to provide a high-level library to play sounds and apply environmental effects.

Here are the types of sounds that can be played:

  • Stereo sounds
  • 3D sounds, associated with 3D objects that can move
  • Environment sounds, made up of a 3D sound that the listener hears when he or she is far from the source (for example the sound of a bar coming from a building when you are outside) and a surrounding stereo sound heard when the listener is within the environment. This surrounding sound itself is made up of three channels that provide a smooth mix of ambient sounds (for example the background noise you hear in a bar) and of sparse random sounds (for example a short shout in the bar).

The environmental effects are combined to 3D areas. The sound engine chooses and applies automatically the good effect depending on the listener's position. For example, if the players enters a cathedral, an effect with a lot of reverberations will be set.

Both the environment sounds and the environmental effects can be dynamically changed, using a tag to select them in a bank. For example, you could have a "day" and a "night" configuration for a single environmental effect.

Architecture

Low level and driver

The low-level sound classes - CSoundDriver, IListener, ISource and IBuffer - encapsulate the functionalities of common 3D audio APIs like as OpenAL, DirectSound3D with EAX or FMOD. It is our experience that FMOD provides better results.

As in NeL3D, the low-level driver uses a dynamic library to provide a device-independent layer. At present time a library for OpenAL has been made. OpenAL is a cross-platform, free software API for 3D audio.

High level library

The high-level library is intended for the game developers that write the game client. It is made available through a small set of user include files, as in NeL 3D.

Although a great number of sources can be created by the user, sound cards and audio APIs limit the number of simultaneous sound sources to a small number (usually 32). The library is able to balance the sources to choose which ones have to be heard, depending on their priority and their distance from the listener.

An environment sound object (envsound) is a node of an envsound tree, the root of which is returned by UAudioMixer::loadEnvSounds(). The root is the world envsound: it has no bounds. The areas of children envsounds have bounds and they must be totally included in the area of their parent envsound, so that the listener is located in one and only one envsound area.

Here is an example of an envsound tree, showing a geographical view and the tree view:

                        Root (world envsound)
                       /                   \
                Transition               Transition
                    |                        |
                  Cave1                    City
                                           /  \
                                 Transition    Transition
                                     |             |
                                  Building1     Building2

The library performs automatically the mix of environment sources channels contained in most of the envsounds (playing random sounds and crossfading them).

The library applies automatically the environmental effects as well.

Finally, it handles object allocation, config file and buffer loading, etc.

As a conclusion, all the game developer has to do at the very least is to:

  • Init the system (class UAudioMixer)
  • Move the listener (class UListener)
  • Move the sources (other players, bots, objects...) (class USource)
  • Possibly move the envsounds (class UEnvSound)