Skip to main content

Segmenter

Trait Segmenter 

Source
pub trait Segmenter {
    // Required methods
    fn shape(&self) -> ChunkShape;
    fn segment(
        &mut self,
        chunk: &[f32],
    ) -> Result<Vec<Activity>, SegmentationError>;
}
Expand description

Speakers active in each frame of one fixed-width chunk of audio.

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

Required Methods§

Source

fn shape(&self) -> ChunkShape

The chunk width this engine reads and the frame grid it answers on. Fixed for the life of the engine — it is a property of the graph.

Source

fn segment(&mut self, chunk: &[f32]) -> Result<Vec<Activity>, SegmentationError>

Who speaks in each frame of chunk, which must be exactly ChunkShape::samples long. A caller with less audio than that pads it; a caller with more cuts it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<S: Segmenter> Segmenter for &mut S

Source§

fn shape(&self) -> ChunkShape

Source§

fn segment(&mut self, chunk: &[f32]) -> Result<Vec<Activity>, SegmentationError>

Implementors§

Source§

impl Segmenter for NoSegmenter

Available on crate feature silero and non-target_family=wasm only.