v146 · Web APIs · Latency Stats
Latency Stats
The AudioContext exposes several latency measurements: baseLatency (rendering pipeline delay), outputLatency (hardware output delay), and getOutputTimestamp() (precise current playback time). Chrome 146 complements these with renderCapacity — together they give a complete picture of your audio pipeline's health.
Start audio to see live stats.
latency measurements
all stats at a glance
| Property / Method | Value | Added | What it measures |
|---|---|---|---|
| ctx.baseLatency | — | Chrome 58 | Audio render pipeline latency (hardware buffer size) |
| ctx.outputLatency | — | Chrome 83 | Hardware output buffer latency (driver/OS layer) |
| ctx.currentTime | — | All | AudioContext clock — monotonically increasing |
| ctx.getOutputTimestamp().contextTime | — | Chrome 57 | AudioContext time of the last audio frame output |
| ctx.getOutputTimestamp().performanceTime | — | Chrome 57 | wall-clock (performance.now) of the last audio frame |
| renderCapacity.averageLoad | — | Chrome 146 | Avg audio render thread CPU load (0–1) |
| renderCapacity.peakLoad | — | Chrome 146 | Peak audio render thread CPU load (0–1) |
| renderCapacity.underrunRatio | — | Chrome 146 | Fraction of dropped renders — non-zero = glitches (0–1) |
controls
code
const ctx = new AudioContext();
// Static latency values (available immediately after construction)
console.log('baseLatency:', ctx.baseLatency, 's'); // e.g. 0.011
console.log('outputLatency:', ctx.outputLatency, 's'); // e.g. 0.046
// Precise timestamp of last audio frame output
const ts = ctx.getOutputTimestamp();
console.log('contextTime:', ts.contextTime); // AudioContext seconds
console.log('performanceTime:', ts.performanceTime); // ms since page load
// Chrome 146+ render capacity
ctx.renderCapacity.start({ updateInterval: 1.0 });
ctx.renderCapacity.addEventListener('update', e => {
console.log('avg load:', e.averageLoad);
console.log('peak load:', e.peakLoad);
console.log('underruns:', e.underrunRatio);
});