BPM Detector

Detect beats-per-minute of an audio file using Web Audio API analysis

Decode an MP3 or WAV with the Web Audio API and estimate its tempo using an energy-onset envelope plus autocorrelation over the 60–200 BPM range, with octave correction. Runs entirely in-browser; the audio file stays local. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How does BPM detection work here?

The audio is split into short frames; the loudness (RMS energy) of each frame forms an envelope. The positive change in that envelope marks beat onsets, and autocorrelating those onsets reveals the repeating period that corresponds to the tempo.

Find the tempo of any track in your browser

A BPM detector estimates how many beats occur per minute in a piece of music. Producers use it to match tempos, DJs to beat-match, and editors to cut video to the beat. This tool does it locally with the Web Audio API — no plugin and no upload.

How it works

After decoding to PCM, the signal is downmixed to mono and chopped into ~10 ms frames. The RMS energy of each frame forms an energy envelope. Taking the positive first difference of that envelope (onset[f] = max(0, env[f] − env[f−1])) produces an onset-strength signal that spikes whenever the audio suddenly gets louder — typically at a beat.

The onset signal is then autocorrelated: for each candidate lag in the 60–200 BPM range, the tool measures how well the signal lines up with a copy of itself shifted by that lag. The lag with the highest correlation is the dominant beat period, and tempo = 60 / (lag × hopSeconds). Finally, octave correction folds obvious half-time or double-time picks into a musical range.

Tips and notes

  • Tracks with a clear, steady kick drum give the most reliable result; ambient or freely-timed music may not yield a single tempo.
  • If the headline value looks wrong, check the candidate list — the correct tempo is often the half or double of the top pick.
  • Trim to a representative section (a verse or chorus) for songs whose tempo changes between sections.
  • Everything runs in-browser, so large files use memory; analysing a 30–60 second excerpt is usually enough.

When BPM detection is most useful

Music production and remixing. Before chopping a sample or layering a new element over an existing track, confirming the BPM means your grid snaps correctly from the start and eliminates drift across a long arrangement.

DJ preparation. Beat-matching by ear is a skill, but knowing the exact BPM of every track in your library before a set removes the guesswork during a live mix. Even if you have a hardware BPM readout, confirming it offline here is faster than loading the track on a deck.

Sync licensing and video editing. Cutting video to music relies on knowing when each beat falls. Having the BPM lets you calculate the exact frame position of every beat using the formula beat position (frames) = (beat number / BPM) × 60 × frame rate.

Exercise playlist curation. Running and cycling apps often recommend songs in specific BPM ranges matched to target cadences. Checking a track’s BPM before adding it to a workout playlist is faster than listening all the way through.

Understanding the octave-correction problem

The most common source of BPM detector errors is octave confusion — the algorithm finding a strong periodicity at double or half the true tempo. This happens because a song at 120 BPM also has a strong structure at 60 BPM (every other beat) and a moderate one at 240 BPM. The autocorrelation function picks up all three, and the highest peak is not always the perceptually correct one.

The correction applied here folds results outside the 70–180 BPM target window by halving or doubling until they land in range. This works well for most popular music but can mislead on genres with unusual feels — a 170 BPM drum-and-bass track may be reported as 85 BPM if the half-time groove is dominant. When in doubt, check the candidate list and pick the value that matches what you hear.