Sounds
defineSound
VoiceHandle.
defineSound.
PlayOptions
Every play function accepts these overrides.Random variation applied on each play, as a maximum
±value per field. For example { detune: 50, volume: 0.1 } varies pitch by up to ±50 cents and volume by up to ±10%.Shorthands
gain defaults to 0.4. noise defaults to "white" and a decay of 0.05.
defineSequence
sound (a play function or a raw definition), and either at (absolute time in seconds) or wait (seconds after the previous step). A step can set its own volume. With loop: true, the sequence repeats every duration seconds (default 1).
Global controls
ensureReady accepts { latencyHint?, sampleRate? }. Pass them on the first call to configure the context.
Browsers only allow audio after a user gesture. audx resumes the context automatically on the first play, so sounds triggered from click or key handlers work without setup.
Patches
A patch is a theme loaded at runtime: a named set of sound definitions you play by name.loadPatch fetches JSON from a URL and throws if the request fails.
AudioPatch also exposes ready, name, author, version, description and tags.
Offline rendering
OfflineAudioContext. OfflineRenderOptions takes duration in seconds (required), sampleRate (default 44100) and numberOfChannels (default 2). WAV output is 16-bit PCM.
Analysis
createMasterAnalyser is connected to the master bus, so it sees everything audx plays. createAnalyser is unconnected; connect a source to analyser.node yourself.
AnalyserOptions: fftSize (default 2048), smoothingTimeConstant (default 0.8), minDecibels, maxDecibels.
An AudioAnalyser reuses its arrays between reads, so it’s safe to call in an animation loop:
3D audio
positionX, positionY, positionZ) and orientation (forwardX/Y/Z, defaults 0, 0, -1; upX/Y/Z, defaults 0, 1, 0). Use with the panner field on a layer.
Types
All types used above are exported, includingSound, SoundDefinition, Layer, MultiLayerSound, Source, Envelope, Filter, Effect, LFO, PlayOptions, VoiceHandle, SequenceStep, SoundPatch, AudioPatch and AudioAnalyser.