Skip to content

Components

AudioSource

A sound on a node: autoplay it as an ambient loop, or fire it from an animation trigger with several takes to vary it. Positional quiets and pans it by distance. A looping autoplay on the Music bus is the room's one music track instead.

On this page

Add it

+ Add node → Audio Source creates a node with it already on. Already have a node for it? Add component → AudioSourceComponent.

From a script

A script on the same node writes these fields by name. AudioSourceComponent is the name to pass.

rgs
set_number("AudioSourceComponent", "volume", 1.0);
set_number("AudioSourceComponent", "pitch", 1.0);
set_flag("AudioSourceComponent", "looping", false);
set_flag("AudioSourceComponent", "autoplay", false);
set_flag("AudioSourceComponent", "positional", true);
set_number("AudioSourceComponent", "max_distance", 512.0);
set_number("AudioSourceComponent", "blend", 1.0);
set_number("AudioSourceComponent", "min_distance", 0.0);
set_number("AudioSourceComponent", "pan", 0.0);

Fields

FieldScript nameKindDefaultWhat it does
ClipclipassetnoneThe clip Autoplay plays. Each trigger plays the clips on its own row.
Busbusone of Master, Music, SfxSfxWhich bus it routes through.
Volumevolumenumber, 0 to 1, step 0.011The source's own volume, before bus and distance.
Pitchpitchnumber, 0.01 to 4, step 0.011Playback rate.
LoopingloopingcheckboxoffRepeat the Clip Autoplay starts until it is stopped. A trigger played by play_sound or an animation track plays once; one played by play_music loops.
AutoplayautoplaycheckboxoffStart playing as soon as the node exists.
Spatial
PositionalpositionalcheckboxonMake it quieter, and pan it, by its distance from the listener, or the camera when the scene has no Audio Listener. A looping autoplay on the Music bus is the music track, and is never positional.
Max Distancemax_distancenumber, at least 0512Distance at which it can no longer be heard.
Blendblendnumber, 0 to 1, step 0.0110 is 2D, 1 is positional. Shown when Positional is set
Rolloffrolloffone of Quadratic, Linear, Inverse, Logarithmic, CustomQuadraticThe shape of the falloff out to Max Distance. Shown when Positional is set
Min Distancemin_distancenumber, at least 00Distance out to which it stays at full volume. Shown when Positional is set
Panpannumber, -1 to 1, step 0.010Stereo placement, added to whatever the listener gives it.
Max Voicesmax_voicesnumber, 0 to 32, step 10Most voices this node holds at once. 0 is the global cap only.
TriggerstriggerslistemptyAnimation trigger names, and the clip each one fires.
FieldScript nameKindDefaultWhat it does
NamenametextnoneThe trigger's name, as the animation clip spells it.
ClipclipassetnoneClip this trigger fires.
Variation
ClipsclipslistnoneExtra recordings of the same sound, played instead of repeating one.
FieldScript nameKindDefaultWhat it does
ClipclipassetnoneOne take of the sound.
Weightweightnumber, 0 to 8, step 0.1noneHow often this take comes up, against the others. 0 mutes it.
Modemodeone of Random, Shuffle, Sequential, RandomNoRepeatnoneOrder the takes are drawn in.
PitchpitchsectionnonePlayback rate multiplier range.
FieldScript nameKindDefaultWhat it does
Minminnumber, 0 to 4, step 0.01noneThe low bound, inclusive.
Maxmaxnumber, 0 to 4, step 0.01noneThe high bound, exclusive.
VolumevolumesectionnoneVolume multiplier range.
FieldScript nameKindDefaultWhat it does
Minminnumber, 0 to 4, step 0.01noneThe low bound, inclusive.
Maxmaxnumber, 0 to 4, step 0.01noneThe high bound, exclusive.