Three Steam Audio runs in modern browsers that support:
WebAssembly — required to load the Steam Audio DSP runtime.
AudioWorklet — required for low-latency audio processing.
crossOriginIsolated and SharedArrayBuffer — optional but recommended. When available, control updates are sent to the AudioWorklet using shared memory with atomics. Otherwise, the library falls back to postMessage.
This example creates a World, adds a simple source, and connects the resulting SteamAudioNode to the audio output. Before any audio is heard, you must resume the AudioContext from a user gesture to satisfy browser autoplay policy.
// Connect an existing AudioNode as the mono input.
const
constoscillator:OscillatorNode
oscillator=new
var OscillatorNode:new (context:BaseAudioContext, options?:OscillatorOptions) =>OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers.
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
The performance.now() method returns a high resolution timestamp in milliseconds. It represents the time elapsed since Performance.timeOrigin (the time when navigation has started in window contexts, or the time when the worker is run in Worker and ServiceWorker contexts).
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
var OscillatorNode:new (context:BaseAudioContext, options?:OscillatorOptions) =>OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
The stop() method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. If no time is specified, then the sound stops playing immediately.
<SteamAudio> owns the world and runs world.step(delta) automatically each frame inside a useFrame callback. You can also pass an existing world with <SteamAudio world={world}>.
SteamAudioNode initialization is asynchronous. Use await node.ready when playback must not begin until the AudioWorklet DSP runtime is ready. If initialization fails, ready rejects and node.state becomes "failed"; the node outputs silence instead of bypassing the unprocessed input.