BPM Detector

Real-time beats per minute analysis using multiple algorithms

Live Waveform
Click "Start Listening" to begin analyzing audio from your microphone
Combined Estimate
--
BPM
Confidence
Peak Detection
--
BPM
Confidence
Autocorrelation
--
BPM
Confidence
Spectral Flux
--
BPM
Confidence
For best results, play music with a clear, steady beat. Detection accuracy improves after 5-10 seconds of listening.

How It Works

Combined Estimate (Primary)

The combined estimate uses a weighted average of all three detection methods, with weights dynamically adjusted based on each algorithm's confidence level. This ensemble approach provides more robust results than any single method alone.

When algorithms agree closely (within 5 BPM), confidence is high. When they disagree significantly, the system weights more reliable methods higher and reduces overall confidence.

Formula: BPM = (w₁ × BPM₁ + w₂ × BPM₂ + w₃ × BPM₃) / (w₁ + w₂ + w₃), where weights are derived from individual confidence scores.

Peak Detection

This method analyzes the audio signal's energy envelope to find "peaks" — moments where the sound intensity suddenly increases, typically corresponding to drum hits or strong musical accents.

  • Calculates the RMS (Root Mean Square) energy of sliding windows
  • Applies a low-pass filter to create a smooth energy envelope
  • Detects peaks that exceed a dynamic threshold based on recent audio levels
  • Measures time intervals between consecutive peaks
  • Converts the median interval to BPM: BPM = 60 / interval
Best for: Music with prominent drum patterns and clear transients. Works well with rock, pop, electronic, and hip-hop genres.

Autocorrelation

Autocorrelation finds repeating patterns in the audio by comparing the signal with time-shifted versions of itself. When the signal correlates strongly with a delayed copy, that delay corresponds to the beat period.

  • Computes the audio's energy envelope to reduce noise
  • Calculates R(τ) = Σ x(t) × x(t + τ) for various time lags τ
  • Searches for peaks in the correlation function within the 40-200 BPM range
  • The lag with the highest correlation indicates the beat period
  • Converts lag to BPM: BPM = 60 × sampleRate / lagSamples
Best for: Music with consistent, repetitive rhythmic patterns. Particularly effective for electronic music, dance tracks, and songs with steady tempos.

Spectral Flux

Spectral flux measures how the frequency content of the audio changes over time. Musical beats typically cause sudden changes in the spectrum, especially in the low-frequency (bass) range.

  • Performs FFT (Fast Fourier Transform) to get frequency spectrum
  • Calculates the difference between consecutive spectral frames
  • Uses half-wave rectification to emphasize increases in energy
  • Applies onset detection to find beat positions
  • Analyzes inter-onset intervals to determine tempo
Best for: Complex music with layered instrumentation. Handles tempo variations better than peak detection and works well with jazz, classical, and progressive genres.

Technical Considerations

BPM detection from live audio is challenging due to several factors:

  • Octave ambiguity: Algorithms may detect half or double the actual tempo (55 vs 110 vs 220 BPM)
  • Background noise: Environmental sounds can interfere with beat detection
  • Complex rhythms: Syncopation and off-beat patterns can confuse peak detection
  • Tempo changes: Songs that speed up or slow down require adaptive algorithms
  • Audio quality: Microphone frequency response and room acoustics affect accuracy

This tool attempts to mitigate these issues by using multiple algorithms and continuously refining estimates as more audio is analyzed. The confidence indicators help you understand how reliable each measurement is.