Skip to content

Sound Effect

Audio emitter for one-shot and recurring sound effects (.wav, .ogg) with volume and pitch control.

Type: SoundNode · Category: Audio & Sound · Also found as: sound

Property Type Default Description
volume number 1 Volume (0-1), before the bus and master volumes. Range 0 to 1.
pitch number 1 Playback speed / pitch (1 = normal). Range 0.1 to 3.
bus string "" The mixer bus it plays into (the Mixer tab; empty = SFX): its fader, effects and output apply.
caption string "" Shown on the subtitle track when it plays, for players with sound captions on (e.g. “[door creaks]”).
autoplay boolean false Play once when the node becomes ready.
voices integer 1 Plays over itself up to this many times (1: a new play restarts it). Range 1 to 8.
positional boolean false Volume and pan follow the node’s distance and side from the listener (the current camera).
minDistance number 100 Positional: full volume within this distance (px). Range 0 to 4000.
maxDistance number 900 Positional: silent beyond this distance (px). Range 1 to 8000.

Plus the common properties every node has.

Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.

Connects a handler to one of this node’s events: finished (Playback (or the dialogue) ended); the tree events; custom ones.

self.node:connect("finished", function(value, source) Log.info("finished") end)
  • event SoundNodeEvent|string
  • handler fun(value: any, source: SoundNode)

Returns integer id Connection id for disconnect

Reads an Inspector property by its path (vectors and colours as tables); “script.” reads a field of the node’s script.

local value = self.node:get_property("volume")
  • path SoundNodeProperty|string

Returns any

Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.” a field of the node’s script.

self.node:set_property("volume", 1.5)
  • path SoundNodeProperty|string
  • value any
  • y? number

Plays the sound effect associated with this SoundNode.

self.node:get_node("JumpSound"):sound_play()

Stops playing the sound effect.

self.node:get_node("EngineSound"):sound_stop()

Pauses the sound effect.

self.node:get_node("EngineSound"):sound_pause()

Resumes the paused sound effect.

self.node:get_node("EngineSound"):sound_resume()
{
"type": "SoundNode",
"name": "SoundEffect",
"position": [
0,
0
],
"properties": {
"volume": 1,
"pitch": 1,
"bus": ""
}
}