demo · v131

Detect audio glitches in real time

The motivating case: a DAW or live-streaming web app needs to know if the audio thread is missing deadlines. renderCapacity + renderCapacityEvent let you alarm on glitches as they happen. Drag the "synthetic load" slider to stress the audio thread and watch the stats spike.

renderCapacity (avg)
%
peak load
%
glitches
0

the api

const ctx = new AudioContext();
ctx.renderCapacity.addEventListener("update", (e) => {
  console.log(e.averageLoad, e.peakLoad, e.underrunRatio);
});
ctx.renderCapacity.start({ updateInterval: 0.5 });
// e.underrunRatio > 0 means glitches

see also