Skip to main content

Embedder

Trait Embedder 

Source
pub trait Embedder {
    // Required methods
    fn embed(
        &mut self,
        window: &[f32],
    ) -> Result<Option<Vec<f32>>, SpeakerError>;
    fn dimension(&self) -> usize;
}
Expand description

Turns audio into a comparable voice vector.

Implementations map their own failures through BackendError::engine and name themselves with Engine::NAME.

Required Methods§

Source

fn embed(&mut self, window: &[f32]) -> Result<Option<Vec<f32>>, SpeakerError>

A unit-norm embedding for one window of 16 kHz samples.

Ok(None) means the window carried no voice worth embedding — too short, or too quiet. That is an ordinary answer, not a failure, and a caller usually keeps whatever label it already had. Err means the model itself broke.

Source

fn dimension(&self) -> usize

The width of every embedding this engine produces. A profile of any other width was made by a different engine and cannot be compared.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§