v153 · web audio · performance
WebAudio: Configurable render quantum
Chrome 153 adds a renderSizeHint option to AudioContext and OfflineAudioContext, allowing developers to request a specific number of audio frames per render cycle — enabling trade-offs between latency and CPU overhead for their workload.
at a glance
| Shipped in | Chrome 153 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Spec | Web Audio API §renderQuantumSize |
| Standards position (Firefox) | No signal |
| Standards position (Safari) | No signal |
| ChromeStatus | 5078190552907776 — WebAudio: Configurable render quantum |
why it exists
The Web Audio API has always rendered audio in fixed 128-frame chunks (the render quantum). This gives a latency of about 2.9 ms at 44.1 kHz. While 128 frames is fine for most applications, it creates tensions at both ends of the spectrum:
- Low-latency instruments (synthesisers, live effects) would benefit from a smaller quantum (e.g. 32 frames) to cut round-trip latency, even at the cost of more CPU interrupts.
- Batch or background processing (audio fingerprinting, format conversion) runs more efficiently with a larger quantum (e.g. 1024 frames) to amortise callback overhead.
The renderSizeHint option lets the developer express a preference; the browser uses it as a hint, rounding to a supported size if necessary.
shape of the API
| Option | Context | Type | Values |
|---|---|---|---|
renderSizeHint | AudioContextOptions, OfflineAudioContextOptions | number | "default" | "hardware" |
integer → request that many frames per quantum"default" → use 128 (same as before)"hardware" → let the UA pick the optimal size
|
| Read-only property | Context | Description |
|---|---|---|
BaseAudioContext.renderQuantumSize | AudioContext, OfflineAudioContext | The actual quantum size the browser selected |
example
// Low-latency synth: request small quantum (lower latency, more CPU)
const ctx = new AudioContext({ renderSizeHint: 32 });
console.log(ctx.renderQuantumSize); // e.g. 32 or the next supported size
// Batch processor: request large quantum (less CPU, higher latency)
const offCtx = new OfflineAudioContext({
numberOfChannels: 2,
length: 44100 * 10, // 10 seconds
sampleRate: 44100,
renderSizeHint: 1024,
});
console.log(offCtx.renderQuantumSize); // e.g. 1024
// Let the UA decide the optimal size
const hwCtx = new AudioContext({ renderSizeHint: 'hardware' });
// AudioWorklet: renderQuantumSize is exposed in the worklet processor
class MyProcessor extends AudioWorkletProcessor {
process(inputs, outputs) {
// this.context.renderQuantumSize tells you how many frames you get
return true;
}
}
Source: Web Audio API spec
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 153+ | Enabled by default | All platforms |
| Firefox | No signal | — |
| Safari | No signal | — |