v151 · Web Audio API
WebAudio: Configurable render quantum
Chrome 151 adds a renderSizeHint option to AudioContext and OfflineAudioContext. Rather than being locked to the default 128-frame render quantum, apps can request a specific block size, use "hardware" to let the browser pick the optimal quantum for the output device, or stay at "default" (128 frames). Matching the quantum to the software buffer size removes a source of latency and audio glitches.
concepts
-
Render Size Explorer
Create AudioContexts with different
renderSizeHintvalues and inspect the actualrenderQuantumSizethe browser honours. See how"hardware"may differ from"default"on your device, and how a numeric hint constrains the quantum. -
Latency Benchmark
Measure and compare the output latency of an AudioContext configured with
renderSizeHint: "default"versusrenderSizeHint: "hardware". A lower latency reading indicates the hardware hint is reducing the number of quantum-to-hardware boundary conversions. -
AudioWorklet Quantum Size
Creates an
AudioWorkletProcessorand measures how many frames arrive perprocess()call for eachrenderSizeHint. Visualises how larger quanta mean fewer, heavier process calls per second — directly observable from inside the worklet. -
Glitch Stress Test
A live AudioWorklet running synthetic DSP. Crank the load until the audio thread misses its deadline (you'll hear the glitch); switch
renderSizeHinton the fly and watch the missed-block counter drop as a bigger quantum buys more time. -
Use Case Picker
Six realistic scenarios — game, voice chat, DAW, player, podcast recorder, offline render. Pick the one closest to your app and read the recommended hint, the code snippet, and the latency / CPU / glitch-resistance trade-offs.
-
Session probe
Create real AudioContext sessions with different render-size hints, inspect the actual
renderQuantumSize, latency fields, and test-tone behavior, then copy the matching setup code. -
Realtime Quality Lab
Run a continuous 440 Hz sine oscillator with a configurable
renderSizeHint. Dial up a worklet stress simulation and compare glitch counts across 128 (default), 256, 512, and "hardware" quanta. Live waveform visualiser and per-session metrics: latency, sample rate, callbacks/second, glitch log. -
Production UX Pattern
Three tabs — Instrument/DAW, Music player, Voice/WebRTC — each with best/ok/avoid recommendations for
renderSizeHint, rationale, copyable production code, and a liveAudioContextprobe that reports actualbaseLatencyandoutputLatencyfrom your browser.
why it shipped
The Web Audio API's render quantum has always been a fixed 128 sample-frames. Hardware audio devices, however, operate at different buffer sizes — 256, 512, or 1024 frames depending on the OS, driver, and hardware. When the quantum (128) and the hardware buffer (e.g., 512) are not aligned, the audio thread must re-chunk and buffer, introducing latency and increasing the chance of an underrun. Giving developers the ability to request a larger or hardware-aligned quantum eliminates this mismatch — audio processing DAWs, voice-chat apps, and games all benefit. The feature was in Chrome origin trial from M145 to M150 before shipping to stable in M151.
renderSizeHint values
"default"— the standard 128 sample-frame quantum; backward-compatible behaviour (default when the option is omitted)"hardware"— asks the browser to pick a quantum that aligns well with the audio hardware buffer size; may be 128, 256, 512, or higher depending on the device- integer (e.g.,
256,512) — requests a specific quantum; the browser may round to the nearest supported power-of-two - The actual quantum chosen is readable back from
AudioContext.renderQuantumSize
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗