VaelisDocs
v1.0.0
Components · v1.0.0

AudioSource

Vaelis 1.0.0 AudioSource component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the AudioSource component in Vaelis 1.0.0. Runtime fields are serialized scene data; the Script API section lists only members intentionally exposed to game scripts.
Where to find it in the editorInspector → Add Component → Audio Source; audio assets are under bottom Project → Audio and can be assigned to Audio Source.

#What it does

Play a local audio asset, optionally with distance-based 3D attenuation.

Component setup & editor toolsAudioSource plays an imported audio asset from an entity.

#How to add and use AudioSource

Editor path: Select the target entity in the Hierarchy (left side) → look at the Inspector (right side) → click Add Component at the bottom of the Inspector → search for AudioSource → click the component row. The Add Component picker is a centered modal with a search box; it only lists components not already attached.

For components with a dedicated editor tool, the tool is opened or activated from the location described below. Do not assume that adding the component alone activates its editor; some systems require a separate window, panel, or viewport tool.

#Component setup & editor tools

  • Select entity → Inspector → Add Component → Audio Source. Assign an imported audio asset in the AudioSource section and use the script API for playback/state control.

#What you should see after adding it

The component appears as its own section in the Inspector. Its serialized settings are listed in the Component data table below. If a field is conditional, it appears only when the relevant mode/type is selected. If a field is a runtime state field (for example grounded or resolved velocity), treat it as read-only diagnostic state unless the API reference explicitly documents it as writable.

#How to read the settings

For every setting below, the documentation distinguishes type, default, meaning, and tuning direction where behavior is known. When a value represents a direction, use the engine's coordinate convention documented in Coordinate system; do not substitute Unity/Godot conventions.

#Component data

FieldTypePurposeDefault
audioKeystring|nullAudio asset key.null
is3DbooleanEnable distance attenuation.false
volumenumberVolume 0-1.1
pitchnumberPitch multiplier; runtime API clamps to 0.25-4.1
loopbooleanLoop playback.true
autoplaybooleanPlay automatically.true
minDistancenumberFull-volume distance for 3D audio.100
maxDistancenumberSilent distance for 3D audio.600

#Tuning behavior

These are the practical direction-of-change rules for the most important controls on this component.

SettingWhat changing it does
volume0 silent; 1 the base configured level.
pitch1 normal playback speed; >1 faster/higher; <1 slower/lower.
minDistance3D only: inside this radius the source remains at full base volume.
maxDistance3D only: beyond this radius the source is silent.

#Script API

MemberKindDescription
play()MethodStart/restart playback.
playOnce()MethodPlay without persistent looping.
stop()MethodStop playback.
volumePropertyVolume 0-1.
pitchPropertyPitch multiplier.
playingPropertyRead-only playback state.

#Examples

js
this.audio.playOnce();
js
this.audio.volume = 0.5;
Need the full workflow?Components: complete workflow covers adding, configuring, testing, combining, and removing components.