Skip to main content

Pump

Struct Pump 

Source
pub struct Pump {
    pub depth: Decibels,
    pub back: Option<Seconds>,
    pub tau: Option<Seconds>,
    pub lock: PumpLock,
    pub beats: usize,
    pub curve: Vec<f64>,
    /* private fields */
}
Expand description

The pump read of a stem.

Fields§

§depth: Decibels

How far the median beat curve dips below its reference.

§back: Option<Seconds>

The time from the dip until the curve comes back within PUMP_BACK; None when it does not within the beat.

§tau: Option<Seconds>

back / ln(depth / 1.5), the time constant of an exponential recovery; None without back and for any lock but the beat: a dip that follows no beat has no recovery to model.

§lock: PumpLock

What the dip follows.

§beats: usize

The beats a sustained note covers.

§curve: Vec<f64>

The median curve over those beats, in dB from the reference, one value per phase bin.

Implementations§

Source§

impl Pump

Source

pub fn find( track: &LevelTrack, grid: BeatGrid, notes: &NoteList, held: &[(f64, f64)], ) -> Option<Self>

Reads the pump of a stem from its full-band level track.

Only beats that the held part of one note covers from start to end count, so a pluck that decays inside its beat reads no pump and a release at the end of a beat reads no dip. held holds the start and end of each held part, in seconds; notes gives the onsets for the note lock. Each counted beat is binned into PUMP_BINS phase bins and taken relative to its PUMP_REFERENCE quantile; the median over the beats is the curve. None with fewer than PUMP_BEATS_MIN counted beats.

The beats are read on the grid and again at the period, within about PERIOD_RANGE of it, whose beats fold onto the deepest mean curve. A second read that locks to the beat replaces the first when the first:

  • locks to the beat, and, when both strip or neither does, the second’s fold error is under FOLD_ERROR_SHARE of the first’s and FOLD_ERROR_GAIN lower. When only one of them strips, as the periods count different beats, the second must strip and have the lower fold error;
  • runs free on a line within FREE_REACH, and the second has a duck’s shape: over a short span, a duck near the search’s end reads free. A gate near a division folds onto one curve as well, but comes back at once;
  • reads nothing, and the second has a duck’s shape without the level window’s share of the tail: a gate off the tempo often reads no lock on the grid;
  • follows the notes.
Source

pub fn carries(&self, from: f64, to: f64) -> bool

Returns whether the beats over from to to carry the duck: their median fall into the dip is at least PHASE_DEPTH of its depth. A stem can duck in one section only, and stripping a note outside it would write the curve’s ripple into its envelope. True when no beat over the span has frames.

Source

pub fn strips(&self) -> bool

Returns whether the layer strips the pump: it locks to the beat, and so dips at least PUMP_MIN, over PUMP_STRIP_BEATS or more counted beats.

Source

pub fn bpm(&self) -> Bpm

Returns the tempo the pump was read at: the given tempo, or the fitted one when that read replaced the read on the grid.

Source

pub fn at(&self, t: f64) -> f64

Returns the curve at time t, linear between bin centres and wrapping over the beat.

Source

pub fn strip(&self, track: &mut LevelTrack)

Adds the dip back to a level track, so the track shows the note’s own envelope.

Trait Implementations§

Source§

impl Clone for Pump

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pump

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Pump

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Pump

Auto Trait Implementations§

§

impl Freeze for Pump

§

impl RefUnwindSafe for Pump

§

impl Send for Pump

§

impl Sync for Pump

§

impl Unpin for Pump

§

impl UnsafeUnpin for Pump

§

impl UnwindSafe for Pump

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
§

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> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.