pub struct Transcriber { /* private fields */ }Expand description
The transcription model with its inference engine, built once and used for every stem, and the f0 tracker of the notes step.
Implementations§
Source§impl Transcriber
impl Transcriber
Sourcepub fn new() -> Result<Self, TranscribeError>
pub fn new() -> Result<Self, TranscribeError>
Loads the bundled model on the pure-Rust engine and spreads the windows over every core.
§Errors
Returns a TranscribeError when the engine cannot load the model.
Sourcepub fn with_threads(self, threads: NonZeroUsize) -> Self
pub fn with_threads(self, threads: NonZeroUsize) -> Self
Spreads the windows over this many threads. The thread count never changes the result.
Sourcepub fn with_backend(backend: impl Backend + 'static) -> Self
pub fn with_backend(backend: impl Backend + 'static) -> Self
Runs the model on another engine, such as one that counts its calls in a test.
Sourcepub fn with_tracker(self, tracker: Tracker) -> Self
pub fn with_tracker(self, tracker: Tracker) -> Self
Runs another f0 tracker in the notes step, such as one that skips the pYIN track in a test whose subject is not the track.
Sourcepub fn run(
&self,
mono: &[f64],
rate: SampleRate,
) -> Result<ModelRun, TranscribeError>
pub fn run( &self, mono: &[f64], rate: SampleRate, ) -> Result<ModelRun, TranscribeError>
Runs the model once on a mono signal at any rate. The signal is
resampled to MODEL_RATE and cast to f32, with its gain
untouched: the model output depends on the absolute level.
§Errors
Returns a TranscribeError when resampling fails, a sample is
not finite or the engine fails.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Transcriber
impl !UnwindSafe for Transcriber
impl Freeze for Transcriber
impl Send for Transcriber
impl Sync for Transcriber
impl Unpin for Transcriber
impl UnsafeUnpin for Transcriber
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> 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