Skip to main content

Module tempo

Module tempo 

Source
Expand description

Deterministic tempo (BPM) and beat-phase (bar) from the onset envelope.

The time base is the analyzer’s hop count, never the wall clock: BPM is the lag of the strongest mean-subtracted autocorrelation of the recent onset envelope (parabolically refined for sub-hop precision, and held against challengers so two near-tied peaks cannot trade it hop by hop — Plan 0095 Phase 2, see TempoTracker::hold), and bar is a 0..1 phase advanced each hop by the current BPM and snapped to 0 on every detected beat. Pure and allocation-free after construction — the envelope history is a fixed array and every pass is iterator-based, so the same (onset, beat) sequence always yields the same (bpm, bar) sequence (NFR 6, hot-path discipline §5).

Structs§

BeatClock
One hop’s beat-clock reading (ADR-0050 Layer 1 plus the pre-existing tempo pair), returned together because they all derive from the same beat stream.
TempoTracker
Rolling onset-envelope autocorrelator producing a BPM estimate and a beat phase.