Online Metronome

If you know the tempo, type it. If you only have the recording, tap the button in time with it four or five times and read the number off — either way the click starts when you press play.

40 to 240
Online Metronome — 40 to 240 BPM With Tap Tempo and Accented DownbeatsBuildFigure

Why the beat does not drift

The naive way to build a metronome is setInterval with a callback that plays a sound. That drifts, badly. Timer callbacks in a browser are best-effort: they fire late when the main thread is busy, they are clamped to once a second in background tabs, and the error accumulates because each late callback shifts the next one. At 120 BPM a few tens of milliseconds of jitter per beat is audible within a bar.

This one uses the standard Web Audio look-ahead pattern instead. A setInterval still runs, every 25 milliseconds, but it does not play anything — it looks 120 milliseconds into the future and schedules every click that falls in that window at an exact time on the AudioContext clock. That clock runs on the audio thread, independent of JavaScript. Once a click is scheduled it will sound at its appointed sample whether or not the main thread is stalled. The timer only has to wake up often enough not to miss the window, and missing a 25 millisecond wake-up out of a 120 millisecond horizon takes a serious stall.

So the honest description is: the scheduling loop uses a timer, the sound does not. The visual dots do run off setTimeout and will lag under load — trust your ears, not the dots. And a backgrounded tab may have its audio suspended entirely by the browser, which is a policy decision no scheduling technique can work around.

Tap tempo

Tap the button in time with whatever you are listening to. From the second tap onward the tool averages the intervals between taps and converts to BPM; four or five taps gets you within a beat or two of the true tempo, and more taps keep improving it because the average smooths out your timing error. Stop for three seconds and the buffer clears, so you can start a fresh measurement without reloading.

Two common traps. If you tap on every other beat you will read half the real tempo, and if you tap on eighth notes you will read double — 140 BPM and 70 BPM are the same music counted differently, and only you know which one the chart says. And a track with rubato or a live drummer does not have one tempo, so the reading will wander; that is the recording, not the tool.

Choosing a tempo to practice at

The tempo markings table is a convention, not a specification. Sources disagree about the boundaries by ten BPM or more, and a Baroque Allegro is not a Romantic Allegro. Treat the ranges as orientation for reading a score, not as a rule.

For practice the useful number is not the target tempo, it is the fastest tempo at which you play the passage cleanly every time. Start below that, and move in increments of five BPM only after several consecutive clean repetitions. Compound meters are the other place people get stuck: 6/8 at speed is felt in two, not six, so set the meter to 2 and put the BPM on the dotted quarter rather than trying to follow six clicks.

Latency and monitoring

If you are playing along through Bluetooth headphones, the click you hear is 100 to 300 milliseconds behind the click that was scheduled. That is the wireless transport, and no software can remove it. It does not matter for practicing alone against the beat — everything you hear is shifted equally — but it makes recording to this metronome, or playing along with anyone else in the room, impossible to keep together. Use wired headphones or speakers for anything where alignment matters.

Questions people ask

There is no sound.

Browsers refuse to start audio until the user interacts with the page, so the first click comes after you press Play, not before. If Play is not producing anything, check the tab is not muted (Chrome and Firefox both let you mute a single tab), check the system output device is the one you are listening to, and check that Bluetooth headphones have actually connected rather than dropping back to the laptop speaker.

Does it keep playing if I switch tabs?

Usually yes, because audio playback keeps a tab alive in most browsers, but it is not guaranteed. Mobile browsers in particular suspend audio contexts when a page is backgrounded or the screen locks, and battery saver modes are more aggressive still. If timing matters, keep the tab in front.

Can I get subdivisions, like eighth notes against a quarter-note pulse?

Not directly. The click marks beats and the meter setting controls where the accent falls. To practice eighths, double the BPM and set the meter to twice the beats — 8 is not offered, but 4 at double tempo gives you an accent every four eighths, which for 4/4 means an accent on beats one and three rather than only on one.

How exact is the tempo?

Each interval is 60/BPM seconds computed in double precision and scheduled against the audio clock, so the accumulated error over minutes is on the order of the audio hardware clock drift, which is parts per million. The practical limit is the click sound itself: a 60 millisecond envelope has a perceived attack that is not a mathematical point, and different listeners place the beat slightly differently within it.

Related