How tap tempo is calculated

The arithmetic is one division

BPM means beats per minute. At 120 BPM a beat arrives every half second, so if you know the gap you know the tempo: sixty divided by half a second is 120.

Which means two taps are technically enough. The question is whether you should believe the answer. Two human taps differ from the real beat spacing by tens of milliseconds, and at 120 BPM a 30 millisecond error puts the reading at 113 or 128.

Why a moving average

So instead of trusting one interval, the tool collects several and averages them. BeatDig keeps the most recent eight gaps and computes the tempo from their mean, which is why the number settles as you keep tapping.

The limit of eight is deliberate. Averaging everything means the awkward first few taps keep dragging the result for as long as you tap. Keeping only recent ones reflects your hand after it settled, and it lets the reading follow a track whose tempo genuinely changes.

That sliding window is what makes it a moving average: the window advances with every tap, and old taps fall out of it on their own.

One outlier ruins a mean

Averages have a well-known weakness. One slipped tap produces one wildly wrong interval, and the mean follows it. Seven gaps of 500 milliseconds plus one of 1200 average to 588, which reports 102 BPM instead of 120.

So a filter runs first. The tool takes the median of the recent intervals and discards anything more than 40 percent away from it before averaging what remains. The median is used as the reference precisely because extreme values do not move it. With only two or three samples there is nothing meaningful to filter, so the step is skipped.

The three-second reset works on the same principle. A long pause means you stopped or the track changed, and folding that gap into the average would destroy the reading entirely.

Why the choice of clock matters

Tap times are recorded with a monotonic high-resolution clock rather than the wall clock. System time can be adjusted by network time synchronisation and can occasionally move backwards, which would produce a negative interval — a nonsense result from a real cause.

The browser's high-resolution timer counts forward from page load with sub-millisecond resolution and never jumps. For measuring intervals it is the only sensible choice.

Read next

  • How to practise with a metronome

    Turning practice from chasing the click into finding where you and the click disagree.

    Read the guide
  • Click tracks for recording

    A click makes editing possible, and used carelessly it drains the life out of a take.

    Read the guide
  • Is rhythm innate?

    Hearing a beat is not passive reception; it is continuous prediction.

    Read the guide

← Back to all guides