Skip to main content

Module rhythm

Module rhythm 

Source
Expand description

Rhythm — spectral-flux onset, autocorrelation tempogram, comb-filter beat tracking, and BPM histogram (AU-RHY). Real implementations replacing the energy-novelty / median-IOI placeholders in music.rs.

Each leaf module owns exactly one public function over caller-supplied buffers (zero-heap hot path). This module re-exports only.

Reuses (does not reimplement): features::spectral::spectral_flux, features::peaks::{autocorrelation, detect_peaks}.

Re-exports§

pub use beat_tracker::track_beats;
pub use bpm_histogram::bpm_histogram;
pub use spectral_flux_onset::onset_detection;
pub use tempogram::bpm_for_bin;
pub use tempogram::tempogram;

Modules§

beat_tracker
Global-tempo estimation and beat placement from an onset-strength envelope. Estimates BPM from the autocorrelation tempogram (peak-picked with detect_peaks) and places beats with a comb-filter phase search. One public function; the only working state is bounded fixed-size stack scratch.
bpm_histogram
Histogram of inter-beat-interval tempi → dominant and secondary BPM. One public function; caller supplies the histogram bins (zero-heap, no internal allocation).
spectral_flux_onset
Onset detection from consecutive magnitude frames via true spectral flux and a causal adaptive threshold. One public function; caller-buffered; zero-heap hot path (a bounded fixed-size stack ring is the only working state).
tempogram
Autocorrelation-based tempogram: a tempo-salience curve over a BPM range, computed from an onset-strength envelope. One public function; caller supplies both the salience output and an autocorrelation scratch buffer (zero-heap — no internal allocation).