BPM Detection and Tapping, Explained
After reading this you can measure tempo by tapping a key, understand how averaging tightens your estimate, and know why an automatic detector sometimes reports half or double the beat you feel.
What tempo is and why two methods exist
Tempo is the rate of the musical beat, measured in beats per minute (BPM). A track at 120 BPM has one beat every 0.5 seconds, because 60 / 120 = 0.5. Most pop, house and rock sits between 90 and 140 BPM. Drum and bass runs near 174. A slow ballad might sit at 60.
There are two honest ways to find that number. The first is to listen and tap along: you become the sensor, and the tool averages the gaps between your taps. The second is to hand a file to an algorithm that looks for energy spikes (onsets) and measures how regularly they repeat. The tapping method is robust and works on anything you can hear, including rubato and live drummers. The automatic method is fast and hands-free, but it can be fooled.
Both methods answer the same question with the same arithmetic underneath: given a repeating interval of T seconds between beats, the tempo is 60 / T.
When to tap and when to detect
Tap when the beat is clear to you but hard for software: a jazz trio that breathes, a live recording with crowd noise, an a cappella verse, or a rubato piano piece where the pulse drifts on purpose. Your ear tracks intent; an onset detector only sees energy.
Let the detector work when you have a clean file with a steady machine-like beat, when you need to process many tracks, or when you want a starting estimate to confirm by tapping. Electronic dance music, most modern pop and metronomic pop are ideal.
A good workflow is to run detection first, then tap for four or five beats to confirm. If the two numbers agree within about 1 BPM, trust them. If detection says 85 and your taps say 170, the detector locked onto the wrong metrical level.
The tapping formula and why averaging helps
Each time you tap, the tool records a timestamp. The gap between consecutive taps is an inter-tap interval. If you have n taps, you have n - 1 intervals. The estimated tempo uses the mean interval:
Here T_i is the i-th interval in seconds, \bar{T} is their average, and 60 converts seconds per beat into beats per minute. Averaging matters because your hand is noisy. Suppose your true interval is 0.5 s but each tap lands with a random error of standard deviation 0.03 s. A single interval carries two tap errors, so its standard deviation is about \sqrt{2} \cdot 0.03 \approx 0.042 s. The mean of k independent intervals shrinks that spread by \sqrt{k}.
With 1 interval the spread is 0.042 s, which at 120 BPM is roughly 120 \cdot 0.042 / 0.5 \approx 10 BPM of jitter. With 16 intervals the spread drops to 0.042 / \sqrt{16} \approx 0.0105 s, about 2.5 BPM. Tap longer and the estimate steadies.
How automatic detection works
The detector does not look for melody. It looks for sudden rises in energy. The signal chain is roughly this: compute short-time energy across the file, take the positive change from frame to frame to build an onset envelope, then measure how self-similar that envelope is at different time lags using autocorrelation.
Autocorrelation multiplies the onset signal by a delayed copy of itself and sums the result. Write the envelope as x[m] over frames:
Here \ell is the lag in frames and R[\ell] is the correlation at that lag. When the lag equals the beat period, the peaks line up with peaks and R[\ell] is large. Convert the winning lag to seconds, then to BPM with 60 / T. The detector searches only lags inside a plausible tempo band (commonly 60 to 180 BPM) so it does not lock onto very long or very short structures.
The autocorrelation has strong peaks at the true period and at its multiples: half, double, one-third and so on. Every one of them is mathematically valid. The detector picks the largest, which is usually but not always the beat you feel.
Worked example: reproducing the demo
The demo taps a steady 120 BPM pulse. At 120 BPM the true interval is 0.5 s. Suppose you record these five tap times in seconds: 0.000, 0.512, 0.988, 1.505, 2.010.
- Form the four intervals:
0.512,0.476,0.517,0.505. - Sum them: 0.512 + 0.476 + 0.517 + 0.505 = 2.010 s.
- Divide by 4 to get the mean interval: \bar{T} = 2.010 / 4 = 0.5025 s.
- Convert to BPM: 60 / 0.5025 \approx 119.4 BPM.
Your hand missed the exact 120 by about 0.6 BPM after only four intervals. Tapping eight more beats at similar accuracy would pull the estimate to within roughly 0.3 BPM of 120, following the \sqrt{k} rule from earlier.
Reading and interpreting the result
Two numbers deserve attention: the tempo and its stability. A single BPM figure with no sense of spread is half the story. If your last few intervals were 0.48, 0.52, 0.49, 0.51 s, they average to 0.50 s (120 BPM) with a spread of about 0.017 s, which is a solid lock. If they scatter from 0.40 to 0.62, the average is meaningless even if it reads a clean round number.
The most common ambiguity is the octave error. Detection may report a tempo that is exactly half or double what you count. These are the same groove described at different metrical levels. A 174 BPM drum and bass track is often reported as 87, and an 80 BPM hip-hop beat with busy hi-hats can read as 160. To resolve it, tap along for a bar and compare.
| Felt tempo (BPM) | Interval (s) | Half | Double | Common cause |
|---|---|---|---|---|
| 174 | 0.345 | 87 | 348 | fast breakbeat, snare on half |
| 128 | 0.469 | 64 | 256 | four-on-floor, kick every beat |
| 80 | 0.750 | 40 | 160 | busy hi-hats double the count |
| 90 | 0.667 | 45 | 180 | swung backbeat |
Common mistakes
Tapping too few times is the biggest one. Four taps give three intervals and roughly 6 BPM of jitter at 120 BPM. Tap at least twelve to sixteen beats.
Tapping subdivisions instead of the beat doubles your reading. If you tap every eighth note on a 120 BPM track, you tap at 240 BPM and the tool faithfully reports 240. Decide what counts as one beat before you start.
Trusting detection on the wrong material is another trap. Ambient pads, spoken word and heavily rubato performances have no sharp onsets, so the autocorrelation has no dominant peak and the reported number is close to a guess. On such files, tap instead.
Do not average across a tempo change. If a track speeds up from 100 to 120 BPM, the mean interval reports something near 110 that matches no part of the song. Tap or detect within one steady section at a time.
Related tools
If detection reports a number you distrust, it helps to see the audio. The Waveform & Spectrogram Viewer shows the onset spikes directly: evenly spaced transients confirm a steady beat, and you can measure the gap between two kicks by eye to sanity-check the BPM. Everything in both tools runs locally in your browser, so your files stay on your machine.
Frequently asked questions
Why does the detector say 85 when the song feels like 170?
That is the octave error. The autocorrelation peak at double the beat length was slightly taller than the peak at the true beat, so the detector chose it. Both describe the same groove. Tap along for a bar to confirm the level you want.
How many times should I tap for an accurate reading?
Aim for at least 12 to 16 taps. Jitter falls with the square root of the number of intervals, so going from 4 intervals to 16 cuts the spread by half, from about 5 BPM to about 2.5 BPM at 120 BPM.
Can it detect tempo in a live or rubato recording?
Automatic detection struggles there because the beat is not perfectly regular and the autocorrelation has no single dominant peak. Tapping works fine, since your ear follows the intended pulse.
What tempo range does automatic detection search?
Detection typically limits itself to a musical band, often 60 to 180 BPM, to avoid locking onto whole-phrase or subdivision periods. A true 200 BPM track may be reported at its half value of 100 for this reason.
Does the file get uploaded anywhere?
No. The analysis runs entirely in your browser and the audio never leaves your device.