Audio¶
Spatial sound sources and the listener.
audio¶
Plays a sound clip from this entity: music, ambience, sound effects. Spatial by default (louder when near, panned left/right). Plays only while the game runs. Generate clips with the audio_generate tool, then set clip. One-shots are easier from Wander: play_sound("audio/hit.wav").
| Field | Type | Description | Values |
|---|---|---|---|
clip |
string | Audio file in the project (wav, mp3 or flac), e.g. audio/wind_loop.wav | |
volume |
number | Linear gain (1 = unchanged) | 0 .. 4 |
pitch |
number | Playback speed multiplier; also shifts pitch | 0.1 .. 4 |
loop |
boolean | Repeat the clip forever (ambience, music, engines) | |
playOnStart |
boolean | Start automatically when the game starts | |
spatial |
boolean | 3D sound: distance attenuation and panning; false = plain stereo (music, UI) | |
minDistance |
number | Full volume within this distance (m) | 0.01 .. 10000 |
maxDistance |
number | Distance where attenuation stops (inverse/exponential) or reaches silence (linear) | 0.1 .. 100000 |
rolloff |
string | Distance falloff curve (inverse is physically natural; linear fades to silence at maxDistance) | inverse linear exponential none |
rolloffFactor |
number | Falloff steepness (1 = natural) | 0 .. 20 |
bus |
string | Mixer bus whose volume/mute applies (see the audio_mix tool) | master music sfx ambience voice ui |
doppler |
number | Doppler effect strength for moving emitters (0 = off, 1 = realistic) | 0 .. 5 |
listener¶
The ears of the game. Optional: by default sound is heard from the active scene camera. Put this on another entity (the player character) to hear from there.
| Field | Type | Description | Values |
|---|---|---|---|
enabled |
boolean | Use this entity as the listener | |
volume |
number | Overall gain heard by this listener | 0 .. 4 |