pub struct Tempo { /* private fields */ }Expand description
The tempo of a stem: the given one, the refined one and the one used.
Implementations§
Source§impl Tempo
impl Tempo
Sourcepub fn exact(given: Bpm) -> Result<Self, ConfidenceError>
pub fn exact(given: Bpm) -> Result<Self, ConfidenceError>
Uses given as it is, as --bpm-exact asks.
§Errors
Never in practice: the reason list is fixed and finite.
Sourcepub fn refine(
mono: &[f64],
rate: SampleRate,
given: Bpm,
) -> Result<Self, ConfidenceError>
pub fn refine( mono: &[f64], rate: SampleRate, given: Bpm, ) -> Result<Self, ConfidenceError>
Refines given from the onsets of mono.
The refined tempo replaces the given one when its score is at least
PEAK_RATIO_MIN times the median of the search, and either at
least PERIODICITY_MIN of the score that onsets on every beat
give or at least SPARSE_PERIODICITY_MIN of it on every second
or fourth beat lag with at most SPARSE_ONSETS_MAX onsets per
beat. Either way the onset sharpness needs SHARPNESS_MIN.
Otherwise it is reported at low confidence and
the given tempo stays. A stem shorter than MIN_BEAT_LAGS plus
OVERLAP_BEATS beats, or one without onsets, keeps the given
tempo and reports no refined one.
§Errors
Never in practice: every signal value is finite.
Sourcepub fn refined(&self) -> &Estimate<Bpm, NoSpread>
pub fn refined(&self) -> &Estimate<Bpm, NoSpread>
Returns the refined tempo with its confidence; no value under
--bpm-exact, for a short stem or for one without onsets.
Trait Implementations§
impl StructuralPartialEq for Tempo
Auto Trait Implementations§
impl Freeze for Tempo
impl RefUnwindSafe for Tempo
impl Send for Tempo
impl Sync for Tempo
impl Unpin for Tempo
impl UnsafeUnpin for Tempo
impl UnwindSafe for Tempo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more