API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classSound
Pre-decoded short audio clip backed by an `AudioBuffer`. Sound is a **data descriptor** - it holds the decoded audio buffer, sprite definitions, and default playback parameters but does NOT start playback itself, and holds no per-playback spatial state (that lives on the Voice returned by playing it). Playback is driven by `AudioSystem.play(sound, options)` which returns a Voice handle. Multiple concurrent plays of the same Sound are supported up to `poolSize`. When the pool is full the configured SoundPoolStrategy decides which active voice to evict. Use AudioStream for long-form streaming audio (single source, decoded lazily) - `Sound` is best for short, frequently-triggered clips.
import { Sound } from '@codexo/exojs'Pre-decoded short audio clip backed by an `AudioBuffer`.
Sound is a **data descriptor** - it holds the decoded audio buffer, sprite definitions, and default playback parameters but does NOT start playback itself, and holds no per-playback spatial state (that lives on the Voice returned by playing it). Playback is driven by `AudioSystem.play(sound, options)` which returns a Voice handle.
Multiple concurrent plays of the same Sound are supported up to `poolSize`. When the pool is full the configured SoundPoolStrategy decides which active voice to evict.
Use AudioStream for long-form streaming audio (single source, decoded lazily) - `Sound` is best for short, frequently-triggered clips.
new(audioBuffer: AudioBuffer | null, options: SoundOptionsConstruction options for Sound.): Soundclip(offset: number, duration: number): SoundcreateVoice(system: AudioSystemPer-Application owner of the audio mix: three pre-configured AudioBus instances (`master` ← `music` + `sound`), a single AudioListener for spatial audio, and a…, options: SoundPlayOptionsPer-call overrides for AudioSystem.play.): VoiceA live playback instance in the audio graph with a control surface. A Voice is created by playing a Playable via AudioSystem.play (and, later, by opening an `A…destroy(): voidhasSprite(name: string): booleanremoveSprite(name: string): thissetPoolSize(poolSize: number): thissetSprites(sprites: Readonly<Record<string, AudioSpriteClipNamed sub-region of an AudioBuffer used as an audio sprite sheet. `start` / `end` are seconds into the buffer; `loop` makes the clip loop indefinitely when pla…>>): thissprite(name: string): Soundloop: booleanmuted: booleanplaybackRate: numbervolume: numberaudioBuffer: AudioBuffer | nullduration: numbererror: Error | nullloaded: Promise<this>poolSize: numberpriority: numberready: boolean