# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

The NeL Sound Engine

Author:
Olivier Cado
Date:
Updated July 31, 2001

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 ambiant 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

Somes classes encapsulate the functionalities of common 3D audio API, such as OpenAL (http://www.openal.org) and DirectSound3D (http://www.microsoft.com/directx) with EAX (http://eax.creative.com): CSoundDriver, IListener, ISource, IBuffer.

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

High level library

The high-level library is intended for the game developers that write the game client. Is 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:

envsound_tree.png
                       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)

Files

The environment sounds parameters, such as their 3D area, and the environmental effects parameters are created using an editor. It is likely that it will be a 3DSMax plug-in.

The sounds used for sources have parameters as well, for example their cone angles. An editor is provided, at the convenience of a sound designer. It can be found in /code/nel/tools/sounds. This editor takes a names file (a text file with one name per line) in input. It allows the game developers to identify the sounds by the names they have chosen.

Compiling the NeL OpenAL Sound Driver

(The examples are given for my Windows configuration)

Include paths needed:

  • OpenAL base platform dir (C:\NETSHARE\OPENAL\WIN)
  • OpenAL include dir (C:\NETSHARE\OPENAL\WIN\AL)
  • EAX include dir (C:\NETSHARE\CREATIVE LABS\EAX 2.0 EXTENSIONS SDK\INCLUDE)
  • NeL src dir (R:\CODE\NEL\SRC)
Library paths needed:
  • OpenAL .lib location (C:\Netshare\openal\win\openal32\release)
  • OpenAL UT .lib location (C:\Netshare\openal\win\alut\release)
  • EAX .lib location (C:\NETSHARE\CREATIVE LABS\EAX 2.0 EXTENSIONS SDK\LIBS)
At runtime, the user needs openal32.dll and eax.dll (usually in the system directory).

Please report any problems to cado@nevrax.com or use the mailing list nel@nevrax.org.

Later enhancements

In the future, the sound will not be loaded staticly anymore. A streaming feature is technically feasable.

EAX provides functionalities for sound occlusion/obstruction between a source and the listener. These are not used at present.