Skip to content

Introduction to OpenBPM

OpenBPM is an open-source, high-accuracy BPM (tempo) detection engine written in pure Rust.

Most existing tempo estimation tools pick a single algorithmic method (such as simple peak detection or basic autocorrelation) and hope it works across different musical genres. OpenBPM takes an ensemble approach: it executes six independent signal processing estimators in parallel, clusters their hypotheses, and uses a learned judge router to resolve octave ambiguities.


The Two-Stage Architecture

Audio ──► Multi-band filter (low/mid/high)


         SuperFlux onset detection (per band)


         Weighted merge (kick=2x, snare=1.5x, hat=0.5x)

             ├──► IOI Histogram ──┐
             ├──► Comb Filter ────┤
             ├──► Autocorrelation ┤──► Metrical fusion ──► Octave resolution
             ├──► Low-Band AC ────┤         │
             ├──► Spectral Energy ┘         ▼
             └──► Hopf Oscillator     Judge Router (learned)


                                     Final BPM + Confidence

Stage 1: Pure Signal Processing

Stage 1 uses pure signal processing without learned parameters:

EstimatorWhat it measuresWhy it helps
IOI HistogramDirect inter-onset interval measurementSub-BPM resolution from timing pairs
Comb Filter BankResonance at beat periodsRobust when onsets are missing or noisy
AutocorrelationPeriodicity of onset envelopeStrong on steady, predictable rhythms
Low-Band ACKick-only autocorrelation (< 200 Hz)Immune to triplet hi-hat or syncopated snare confusion
Spectral EnergyFFT of RMS envelopeCompletely independent from onset detection
Hopf OscillatorNonlinear resonator bankRobust against syncopation and missing downbeats

Stage 2: Learned Judge Router

A multinomial logistic regression model (32 features, 4 classes) decides whether to keep, halve, double, or triple the Stage 1 BPM estimate:

  • Trained on GiantSteps (EDM), Ballroom (dance), and GTZAN (10 genres).
  • Only triggers octave adjustment when prediction probability exceeds confidence threshold ($P > 0.65$).
  • Weights are embedded directly as compile-time Rust constants: zero external files, zero runtime dependencies.

Pure Rust BPM detection · Released under the MIT License.