pub struct DownbeatTracker { /* private fields */ }Expand description
Folds per-beat accents over the four 4/4 alignments and publishes a bar position when the winner is convincing enough.
Implementations§
Source§impl DownbeatTracker
impl DownbeatTracker
Sourcepub fn new() -> Self
pub fn new() -> Self
A tracker with no evidence: unlocked, aligned to 0, so it reproduces the plain counters until it has reason not to.
Sourcepub fn process(
&mut self,
beat: bool,
beat_count: u32,
bass: f32,
onset: f32,
beat_phase: f32,
) -> BarClock
pub fn process( &mut self, beat: bool, beat_count: u32, bass: f32, onset: f32, beat_phase: f32, ) -> BarClock
Advance one hop.
beat flags a transient this hop; bass and onset are the
normalized levels; beat_phase is the 0..1 position through the
current beat, which becomes the sub-beat part of bar_phase.
beat_count is the counter this folds over, and it is not
beat_index. It is the grid’s beat count, which is
driven by the tempo estimate; beat_index counts transients, at 1.35x to
2.10x per musical beat, so folding over it spanned well under a bar and a
bar-locked accent precessed across all four alignments instead of
accumulating in one (ADR-0109). The analyzer still passes beat_index
while the grid warms up, which is the fallback ADR-0050 specifies and the
behaviour this module had throughout.
Sourcepub fn terms(&self) -> DownbeatTerms
pub fn terms(&self) -> DownbeatTerms
Read the terms behind the current estimate — Plan 0068’s instrument.
Changes nothing. It takes &self, recomputes the fold and the effect
size from state process already keeps, and returns them by value in
fixed-size arrays: no heap allocation, no clock, no field written, and no
branch inside process that differs depending on whether anyone calls
this. The recomputation is a pure function of the same state that
produced the last published BarClock::confidence, so between hops the
two agree bit for bit — which is what makes this a reading of the gate
rather than a second opinion about it.