v145 · 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. -
Quantum Sweep
Spin up a tone generator at 32, 64, 128, 256, or 512 frames and surface CPU-budget-per-quantum, base latency, and underrun risk. Helps pick the right knob for live performance vs. battery.
-
Worklet Waveform
An
AudioWorkletProcessorsine generator with a live waveform display. Pick arenderSizeHint, start the context, and see the actualrenderQuantumSize, base latency, and AudioWorklet callback frequency update in real time.
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