Sound Scripts
Sound scripts contain "sound entries" that are used to wrap Equilibrium-specific playback instructions around WAV or OGG files.
A sound entry can define its pitch and volume, how far away it can be heard from (attenuation distance), and can be used to randomize which precise sound file is played. Nodes can be used to define even more complex behaviours defined by the inputs.
Sound scripts by default are loaded from:
scripts/EmitterSounds.txt
- Lua scripts via
EmitterSoundRegistry
All WAV and OGG file paths within a soundscript are relative to the <game data or addon folder>/sounds/
folder.
Example entry
entry.name
{
wave "cars/skid.wav";
distance 5.0;
volume 1.0;
is2d 1;
channel CHAN_VOICE;
};
Fields
wave / rndwave
Filename of the sound to play.
wave common/blah1.wav
You can also have the engine pick from a list of random files.
rndwave { wave common/blah1.wav wave common/blah2.wav wave common/blah3.wav }
Note: The sound file MUST be in a folder within the sounds
folder. So (sound/)folder/sound.wav will work, while (sound/)sound.wav will not.
Loop
Enables the sound looping when value is set to 1.
In case of WAV files, specifying loop region will make sound looping in that region (car horn sounds as example)
Is2D
Specifies that the sound is not located in 3D world when value set to 1.
Distance
Specifies sound reference distance (distance before volume starts decreasing)
MaxDistance
Specifies maximum distance of playback before sound playback gets interrupted
Volume
A number between 0 and 2.0, where 1.0 is the sound's default volume.
Pitch
Any number between 0 and 10.0, where 1.0 is the sound's default pitch and 10.0 is very high.
HFP
High-Pass filter. Any number between 0 and 1.0
LFP
Low-Pass filter. Any number between 0 and 1.0
Channel
Channels are used to categorize sounds in a way that game logic in general, can understand.
Also every channel is using different mixer state and as result, various volume controls like snd_musicvolume
, snd_voicevolume
and snd_enginevolume
will affect only their channels
CHAN_STATIC | Default, generic channel. A constant/background sound that doesn't require any reaction. |
CHAN_BODY | Used for vehicle hit sounds. |
CHAN_SKID | Used for vehicle skidding sounds. |
CHAN_ITEM | Generic item sounds |
CHAN_SIGNAL | Car horn and siren sounds |
CHAN_ENGINE | Car engine sounds |
CHAN_VOICE | Voiceover dialogue. Depending on usage it will make volume ducking effect when this type of sound is played |
CHAN_STREAM | Music playback |
CHAN_MENU | Sounds that are only played in menus and aren't affected by the game pause |
Sound Script Editor
There are number of fields that are not described here and they are in fact auto-generated by the in-game Sound script editor.
You can use Sound Script Editor to tune up your custom-created script to make sound fit in right in the game.
It allows you:
- Edit game sounding on the fly - every time you edit the sound it's hot-reloaded and you hear results instantly
- Switch audio files
- Isolate current sound script
- Apply automation to the custom sounds (for example skid sounds of vehicles or car engines)