API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classSound

@codexo/exojs / audio / stable

Pre-decoded short audio clip backed by an `AudioBuffer`. Sound is a **data descriptor** — it holds the decoded audio buffer, sprite definitions, default playback parameters, and spatial configuration but does NOT start playback itself. Playback is driven by `AudioManager.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.

15
props
9
methods
0
events
Import
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, default playback parameters, and spatial configuration but does NOT start playback itself. Playback is driven by `AudioManager.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.

Constructors 1
new(audioBuffer: AudioBuffer, options: SoundOptions): Sound
Methods 9
_createVoice(manager: AudioManager, options: PlayOptions): Voice
_stopAllVoices(): void
clip(offset: number, duration: number): Sound
defineSprite(name: string, clip: AudioSpriteClip): this
destroy(): void
hasSprite(name: string): boolean
removeSprite(name: string): this
setPoolSize(poolSize: number): this
setSprites(sprites: Readonly<Record<string, AudioSpriteClip>>): this
Properties 15
loop: boolean
muted: boolean
playbackRate: number
volume: number
audioBuffer: AudioBuffer
distanceModel: DistanceModel
duration: number
maxDistance: number
poolSize: number
poolStrategy: SoundPoolStrategy
position: Vector | null
priority: number
refDistance: number
rolloffFactor: number
velocity: Vector | null
Source