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

  1. Render Size Explorer

    Create AudioContexts with different renderSizeHint values and inspect the actual renderQuantumSize the browser honours. See how "hardware" may differ from "default" on your device, and how a numeric hint constrains the quantum.

  2. Latency Benchmark

    Measure and compare the output latency of an AudioContext configured with renderSizeHint: "default" versus renderSizeHint: "hardware". A lower latency reading indicates the hardware hint is reducing the number of quantum-to-hardware boundary conversions.

  3. 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.

  4. Worklet Waveform

    An AudioWorkletProcessor sine generator with a live waveform display. Pick a renderSizeHint, start the context, and see the actual renderQuantumSize, 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

references