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

  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. AudioWorklet Quantum Size

    Creates an AudioWorkletProcessor and measures how many frames arrive per process() call for each renderSizeHint. Visualises how larger quanta mean fewer, heavier process calls per second — directly observable from inside the worklet.

  4. 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 renderSizeHint on the fly and watch the missed-block counter drop as a bigger quantum buys more time.

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

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

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

  8. 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 live AudioContext probe that reports actual baseLatency and outputLatency from 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

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗