Taos API Reference
    Preparing search index...

    Module audio

    The audio subsystem: the standalone AudioEngine (mixing buses, one-shot and spatial SFX, looping music with crossfade, an effects rack, microphone capture, FFT/level analysis) plus the AudioSource / AudioListener scene components.

    Classes

    AudioAnalyser

    Wraps an AnalyserNode for visualization and level metering. Acts as a pass-through node — connect a source to input and (optionally) output onward — so it can tap any point of the graph without changing the signal. Reuse the out typed arrays across frames to avoid per-frame allocation.

    AudioBus

    A named mixing group. Sources connect to input; the signal passes through a volume GainNode, then an ordered effect chain, then on to a parent node (another bus or the context destination). Volume and effects cascade: routing sfx → master → destination means the effective gain is the product of every bus gain along the way.

    AudioClip

    A decoded sound, ready for playback. Thin wrapper over a Web Audio AudioBuffer that carries the source URL/name and some convenience accessors. Produced by AudioLoader / AudioEngine.load.

    AudioEngine

    The central audio API: a thin, game-oriented layer over the Web Audio API. Owns one AudioContext, a tree of AudioBuses (master plus sfx / music / ui / voice), an AudioLoader, and the pool of live SoundHandle voices.

    AudioLoader

    Loads and decodes audio files into AudioClips, caching results so the same URL is fetched and decoded only once. In-flight loads are deduped: two concurrent load(url) calls share a single fetch+decode.

    Microphone

    Live microphone input. Wraps getUserMedia + a MediaStreamAudioSourceNode and exposes an output node plus a built-in analyser for level metering / visualization. The raw input is not routed to the speakers by default (to avoid feedback); call connect to route it somewhere — a bus input, an effect, or another analyser.

    SoundHandle

    A single playing voice: BufferSource → Gain → [Panner] → destination. Returned by AudioEngine.play / AudioEngine.playAt so callers can control or stop the sound. Disposes itself when playback ends; the owning engine prunes finished handles and advances any follow target.

    Interfaces

    AudioAnalyserOptions

    Options for AudioAnalyser.

    AudioEffect

    An insertable audio effect: a self-contained sub-graph with a single input and output. Connect a source into input and route output onward. AudioBus chains these between its gain and its parent.

    ReverbOptions
    FilterOptions
    DelayOptions
    DistortionOptions
    CompressorOptions
    MusicOptions

    Options for AudioEngine.playMusic.

    MicrophoneOptions
    Vec3Like

    Minimal structural 3D point — Vec3 satisfies this.

    PositionProvider

    Anything with a world position — a GameObject satisfies this.

    SpatialOptions

    Per-source spatialization parameters (maps onto PannerNode).

    VoiceOptions

    Options for a single played voice (AudioEngine.play / playAt).

    Type Aliases

    BusName

    Built-in bus names always present on a fresh AudioEngine.

    Functions

    generateImpulseResponse

    Generates a synthetic impulse response: exponentially-decaying white noise. Pure (aside from the ctx.createBuffer allocation) so it can be unit-tested with a minimal mock context. random defaults to Math.random and can be injected for deterministic tests.

    createReverb

    Convolution reverb with a generated impulse response and a wet/dry mix. input fans out to a dry path and a convolver (wet) path that sum at output.

    createFilter

    A BiquadFilterNode (lowpass, highpass, bandpass, …) as an effect.

    createDelay

    A feedback delay line (echo) with a wet/dry mix.

    makeDistortionCurve

    Builds a waveshaper transfer curve. amount 0 → near-linear, higher → harder clipping. Pure and allocation-only — unit-testable. The curve is an odd function (f(-x) = -f(x)) and monotonically increasing.

    createDistortion

    A WaveShaperNode distortion/overdrive.

    createCompressor

    A DynamicsCompressorNode. Defaults give gentle glue compression; a high ratio with a low threshold acts as a master limiter to tame peaks.