Skip to main content

DownbeatTracker

Struct DownbeatTracker 

Source
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

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for DownbeatTracker

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,