pub struct BeatThis<S: InferenceSession> {
pub mel: MelProcessor<S>,
pub inference: BeatInference<S>,
pub post: PostProcessor,
}Expand description
High-level beat tracker composing the full pipeline.
Owns the mel spectrogram model, the beat inference model, and the post-processor. Generic over the inference session type, so it works with any backend (ort, rten, tract).
Fields§
§mel: MelProcessor<S>§inference: BeatInference<S>§post: PostProcessorImplementations§
Source§impl<S: InferenceSession> BeatThis<S>
impl<S: InferenceSession> BeatThis<S>
Sourcepub fn new<R: InferenceRuntime<Session = S>>(
runtime: &R,
mel_model_path: &Path,
beat_model_path: &Path,
) -> Result<Self>
pub fn new<R: InferenceRuntime<Session = S>>( runtime: &R, mel_model_path: &Path, beat_model_path: &Path, ) -> Result<Self>
Create a new beat tracker by loading both ONNX models via the given runtime.
runtime: anyInferenceRuntime(e.g.OrtRuntime::default())mel_model_path: path to the mel spectrogram ONNX modelbeat_model_path: path to the beat tracking ONNX model
Sourcepub fn process_file(&mut self, path: &Path) -> Result<BeatResult>
pub fn process_file(&mut self, path: &Path) -> Result<BeatResult>
Run the full pipeline on an audio file.
Loads the file, resamples to 22050 Hz mono, computes mel spectrogram, runs beat inference, and post-processes into beat/downbeat timestamps.
Sourcepub fn process_audio(
&mut self,
samples: &[f32],
sample_rate: u32,
) -> Result<BeatResult>
pub fn process_audio( &mut self, samples: &[f32], sample_rate: u32, ) -> Result<BeatResult>
Run the full pipeline on raw audio samples.
The samples are resampled to 22050 Hz if sample_rate differs.
Input should be mono f32 PCM.
Auto Trait Implementations§
impl<S> Freeze for BeatThis<S>where
S: Freeze,
impl<S> RefUnwindSafe for BeatThis<S>where
S: RefUnwindSafe,
impl<S> Send for BeatThis<S>where
S: Send,
impl<S> Sync for BeatThis<S>where
S: Sync,
impl<S> Unpin for BeatThis<S>where
S: Unpin,
impl<S> UnsafeUnpin for BeatThis<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for BeatThis<S>where
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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