pub struct Stem { /* private fields */ }Expand description
The stem: native-rate samples with mid and side, the beat grid, the band edge, the flat-top flag and the stereo screen.
Implementations§
Source§impl Stem
impl Stem
Sourcepub fn new(
audio: Audio,
grid: BeatGrid,
notes: Option<&NoteList>,
) -> Result<Self, ConfidenceError>
pub fn new( audio: Audio, grid: BeatGrid, notes: Option<&NoteList>, ) -> Result<Self, ConfidenceError>
Builds the stem. The median f0 of notes picks the frame length and
feeds the stereo phase; without notes the frame is 4096 samples and
every phase is None.
§Errors
Never in practice; the reasons are built from counts and flags.
Sourcepub fn sample_rate(&self) -> SampleRate
pub fn sample_rate(&self) -> SampleRate
Returns the sample rate.
Sourcepub fn mid(&self) -> &[f64]
pub fn mid(&self) -> &[f64]
Returns the mid, M = (L + R) / 2: the mono signal of every
non-stereo estimate. A one-channel file’s mid is its channel; a file
of three or more channels mixes only the first two, as the side and
the stereo screen read them.
Sourcepub fn side(&self) -> Option<Vec<f64>>
pub fn side(&self) -> Option<Vec<f64>>
Returns the side, S = (L - R) / 2, computed on demand to spare
memory, or None for a one-channel file.
Sourcepub fn median_f0(&self) -> Option<Hz>
pub fn median_f0(&self) -> Option<Hz>
Returns the median f0 of the note list, if one was given.
Sourcepub fn frame_len(&self) -> usize
pub fn frame_len(&self) -> usize
Returns the frame length of harmonic analysis: at 44.1 kHz 8192
below a median f0 of 100 Hz, else 4096, and 4096 without a note
list. At another rate the length is the power of two nearest, in log,
to that length times fs / 44100, so the frame keeps its duration
within a factor of the square root of 2: 32 and 48 kHz keep 4096 and
8192, 96 kHz takes 8192 and 16384.
Sourcepub fn band_edge(&self) -> &Estimate<Hz, Hz>
pub fn band_edge(&self) -> &Estimate<Hz, Hz>
Returns the band edge: the highest frequency that stays above the noise floor. A filter cutoff within one octave of it is never reported.
Sourcepub fn hard_limited(&self) -> bool
pub fn hard_limited(&self) -> bool
Returns whether the stem is flat-topped at its peak, as a limiter or clipping leaves it, in either of its first two channels.
Sourcepub fn stereo(&self) -> &StereoScreen
pub fn stereo(&self) -> &StereoScreen
Returns the stereo screen of the whole stem.
Trait Implementations§
impl StructuralPartialEq for Stem
Auto Trait Implementations§
impl Freeze for Stem
impl RefUnwindSafe for Stem
impl Send for Stem
impl Sync for Stem
impl Unpin for Stem
impl UnsafeUnpin for Stem
impl UnwindSafe for Stem
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