Rule of thumb · Music and AcousticsNº 174 / 176

A beat is a time, not an event

Never fire a click when a timer goes off. Work out WHEN each beat should sound, hand that time to the audio hardware in advance, and let a late loop be late.

Why it works

A browser timer promises “at least this long” and never “exactly this long” — a repaint, a garbage collection or another tab can delay the callback, and a click fired from inside it inherits the delay. Scheduling instead means the beat time is computed by exact addition from the previous one, so the error cannot accumulate: nothing is ever measured to produce it. Two milliseconds of drift a beat is a third of a beat after two minutes at 100 BPM.

When it fails

It does not help with output latency. The operating system’s buffer, Bluetooth headphones and the speaker itself all delay the sound, and no amount of careful scheduling removes that — it only guarantees the delay is the same for every beat. Recording against a browser click and expecting sample-accurate alignment is still a mistake.

Do it exactly

Estimate with the rule, then check it against the calculator that models it properly.

Open Metronome →

More in Music and Acoustics

← PreviousLearn five landmarks, not one sentence Next →A seven-note scale uses each letter exactly once

Why does my metronome app drift?

Never fire a click when a timer goes off. Work out WHEN each beat should sound, hand that time to the audio hardware in advance, and let a late loop be late. A browser timer promises “at least this long” and never “exactly this long” — a repaint, a garbage collection or another tab can delay the callback, and a click fired from inside it inherits the delay.

Browse all 176 rules of thumb →