concept · Web Audio API
Latency Benchmark
Compare baseLatency and outputLatency across three AudioContexts: one with the default 128-frame quantum, one with renderSizeHint: "hardware", and one with a custom 256-frame quantum. The reading that best aligns with your hardware buffer will show the lowest output latency.
renderSizeHint: "default"
renderQuantumSize
—
baseLatency
—
outputLatency
—
renderSizeHint: "hardware"
renderQuantumSize
—
baseLatency
—
outputLatency
—
renderSizeHint: 256
renderQuantumSize
—
baseLatency
—
outputLatency
—
baseLatency reflects the quantum itself — the time for one render block to process. outputLatency includes the hardware buffer delay on top of that. When the quantum aligns with the hardware buffer, no extra buffering occurs and outputLatency is minimised. The "hardware" hint is the easiest path to this alignment: just ask the browser to pick for you.
reading the metrics
const ctx = new AudioContext({ renderSizeHint: 'hardware' });
// Actual quantum chosen by the browser
console.log(ctx.renderQuantumSize); // e.g. 256
// Latency of one render quantum in seconds
console.log(ctx.baseLatency); // renderQuantumSize / sampleRate
// Total output pipeline latency (quantum + hardware buffer)
console.log(ctx.outputLatency); // ideally ≈ baseLatency when aligned
see also
- Render Size Explorer — inspect renderQuantumSize per hint value
- ChromeStatus entry
- MDN — AudioContext constructor
- Web Audio API spec — renderSizeHint
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗