Dashboard > NeL > ... > NeLDocumentation > NeLSound
NeLSound
Added by Matt Raykowski, last edited by Matt Raykowski on Sep 17, 2007  (view change)
Labels: 
(None)


General Overview of NLSOUND

Please note this documentation is obsolete. The OpenAL driver is currently not maintained.  The FMOD driver however works for both Windows (maintained by Nevrax) and Linux (maintained by the NeL community, especially sfb.)

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

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)

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

Site running on a free Atlassian Confluence Open Source Project License granted to Open NeL (Open Nevrax Library, community branch of NeL). Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators