Skip to main content
Every audx sound is a SoundDefinition: a JSON-serializable description that the engine turns into Web Audio nodes each time it plays. You can write one by hand with defineSound, edit one in a generated file, or put many in a custom theme.

A first sound

defineSound returns a function. Each call creates a new voice and returns a handle with stop(). The original definition stays available as pop.definition.

The parts of a layer

A single-layer sound has these fields:
Source
required
What makes the signal: an oscillator (sine, triangle, square, sawtooth), noise, a wavetable, a sample URL or buffer, a stream, or a constant.
Envelope
How volume changes over time. Only decay is required. Without attack, the sound starts at full volume. Without sustain, it fades to silence after the decay.
Filter | Filter[]
Biquad filters (lowpass, highpass, bandpass and others) applied before the envelope. A filter can have its own envelope that sweeps the cutoff.
Effect[]
A chain after the envelope: reverb, delay, distortion, chorus, flanger, phaser, tremolo, vibrato, bitcrusher, compressor, EQ, gain and pan.
LFO | LFO[]
Low-frequency oscillators that modulate a parameter such as frequency, gain, pan or filter.frequency.
number
default:"0.5"
Output level from 0 to 1.
number
Stereo position from -1 (left) to 1 (right). Use panner instead for 3D positioning.
number
Start delay in seconds.
See the sound definition reference for every field and default.

Layers

Most good UI sounds combine a short transient with a tonal body. Use layers to play several layers together, with optional effects on the mix:

Shorthands

For quick one-off tones, use the oscillator and noise helpers:
Each takes a frequency (or noise color), a decay in seconds and an optional gain (default 0.4).

Play-time options

Any sound accepts overrides when you play it:
jitter adds a random offset of up to ±value each time, so repeated sounds don’t feel identical.

Render to a file

renderToWav renders offline, without speakers, and returns a WAV Blob:

Tips for UI sounds

  • Keep most sounds under 150 ms. Feedback sounds like success and complete can run longer.
  • Start with a low gain. A UI sound should sit under the content, not over it.
  • Use jitter on anything that repeats quickly.
  • Reserve hover and type for places where they help; they get tiring fast.
Tweak sounds visually in the editor on audx.site, then install your version with the command it gives you.