Class: Sound
Defined in: attributes/audio/sound.ts:43
A playable audio clip. Deliberately not a Node — audio lives on a parallel timeline, not in the visual scene graph.
Wire it up by calling tick from your node or scene's tick(), then call prepare from prepare() to register requests with the asset tracker. Use start/stop imperatively or play in a generator.
Constructors
Constructor
new Sound(
props):Sound
Defined in: attributes/audio/sound.ts:54
Parameters
props
Returns
Sound
Properties
loop
loop:
boolean
Defined in: attributes/audio/sound.ts:46
src
readonlysrc:string
Defined in: attributes/audio/sound.ts:44
trimEnd
trimEnd:
number
Defined in: attributes/audio/sound.ts:48
trimStart
trimStart:
number
Defined in: attributes/audio/sound.ts:47
volume
volume:
number
Defined in: attributes/audio/sound.ts:45
Accessors
playRanges
Get Signature
get playRanges():
object[]
Defined in: attributes/audio/sound.ts:73
The scene-time ranges this sound has been scheduled to play, derived from
its accumulated requests. endAt is null while a clip is still open
(started but not yet stopped, or an unbounded loop).
Returns
object[]
Methods
dispose()
dispose():
void
Defined in: attributes/audio/sound.ts:141
Returns
void
play()
play(
duration?):FrameGenerator
Defined in: attributes/audio/sound.ts:113
Generator form: start, yield for the clip's duration, then stop.
Pass duration to override — required for looping clips unless trimEnd
is set (the catalog-resolved full length counts as set).
Parameters
duration?
number
Returns
prepare()
prepare(
tracker):void
Defined in: attributes/audio/sound.ts:126
Register this sound's requests with the asset tracker. Call from your node's prepare(tracker). Handles file-load registration and pushes new playback requests — safe to call every frame (deduplicated internally).
Parameters
tracker
Returns
void
start()
start():
void
Defined in: attributes/audio/sound.ts:81
Start playback. No-op if already playing.
Returns
void
stop()
stop():
void
Defined in: attributes/audio/sound.ts:101
Stop playback. No-op if not playing.
Returns
void
tick()
tick(
time):void
Defined in: attributes/audio/sound.ts:64
Update the sound's current time. Call from your node's tick(time).
Parameters
time
number
Returns
void