pub struct PitchTrack { /* private fields */ }Expand description
The f0 track of a stem.
Implementations§
Source§impl PitchTrack
impl PitchTrack
Sourcepub fn of(mono: &[f64], rate: SampleRate) -> Result<Self, TrackError>
pub fn of(mono: &[f64], rate: SampleRate) -> Result<Self, TrackError>
Runs the tracker over a mono stem at any rate. The stem is resampled to the model rate, and the copy the tracker reads is scaled to a peak of 1, because the tracker treats a frame below a fixed energy as silence. A silent or empty stem gives a track with no voiced frame.
§Errors
Returns a TrackError when resampling fails, a sample is not
finite or the tracker cannot run: it refuses the settings, a
transform fails or a candidate has no pitch bin. The settings are
constants, so the last three point to a bug.
Sourcepub fn from_frames(frames: Vec<TrackFrame>) -> Self
pub fn from_frames(frames: Vec<TrackFrame>) -> Self
Builds a track from frames, such as a test’s.
Sourcepub fn frames(&self) -> &[TrackFrame]
pub fn frames(&self) -> &[TrackFrame]
Returns every frame in time order.
Sourcepub fn voiced_between(
&self,
onset: Seconds,
offset: Seconds,
) -> impl Iterator<Item = (Seconds, Hz)> + '_
pub fn voiced_between( &self, onset: Seconds, offset: Seconds, ) -> impl Iterator<Item = (Seconds, Hz)> + '_
Returns the voiced frames from onset (inclusive) to offset
(exclusive) as (time, f0).
Sourcepub fn voiced_pitches(&self) -> Vec<MidiPitch>
pub fn voiced_pitches(&self) -> Vec<MidiPitch>
Returns the pitches of every voiced frame, as fractional MIDI pitches.
Sourcepub fn contour(&self, onset: Seconds, offset: Seconds) -> Option<Contour>
pub fn contour(&self, onset: Seconds, offset: Seconds) -> Option<Contour>
Returns the f0 contour of a span: the voiced frames inside it, or
None when none is voiced.
Sourcepub fn with_contours(&self, notes: &NoteList) -> NoteList
pub fn with_contours(&self, notes: &NoteList) -> NoteList
Sets the f0 contour of every note that has a voiced frame inside it.
Trait Implementations§
Source§impl Clone for PitchTrack
impl Clone for PitchTrack
Source§impl Debug for PitchTrack
impl Debug for PitchTrack
Source§impl Default for PitchTrack
impl Default for PitchTrack
Source§impl PartialEq for PitchTrack
impl PartialEq for PitchTrack
impl StructuralPartialEq for PitchTrack
Auto Trait Implementations§
impl Freeze for PitchTrack
impl RefUnwindSafe for PitchTrack
impl Send for PitchTrack
impl Sync for PitchTrack
impl Unpin for PitchTrack
impl UnsafeUnpin for PitchTrack
impl UnwindSafe for PitchTrack
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