Skip to main content

Crate extract_speech

Crate extract_speech 

Source
Expand description

Voice activity detection inference for several popular VAD model families.

Detector accepts mono, normalized f32 PCM sampled at SAMPLE_RATE and returns speech intervals expressed as sample offsets.

use extract_speech::{Detector, Model, Result, Runtime, VadParams};

let mut detector = Detector::builder("models/silero-vad-v6.onnx")
    .model(Model::Silero)
    .runtime(Runtime::Candle)
    .parameters(VadParams {
        threshold: 0.7,
        ..VadParams::default()
    })
    .build()?;

let samples = vec![0.0_f32; 16_000];
let segments = detector.detect(&samples)?;

Re-exports§

pub use assets as download;
pub use models::fsmn::candle as fsmn_vad;
pub use models::fsmn::onnx as fsmn_vad_ort;
pub use models::fsmn::frontend as fsmn_vad_frontend;
pub use models::fsmn::iterator as fsmn_vad_iter;
pub use models::marblenet::candle as marblenet;
pub use models::marblenet::onnx as marblenet_ort;
pub use models::marblenet::frontend as marblenet_frontend;
pub use models::marblenet::iterator as marblenet_iter;
pub use models::pulsevad::candle as pulsevad;
pub use models::pulsevad::onnx as pulsevad_ort;
pub use models::pulsevad::frontend as pulsevad_frontend;
pub use models::pulsevad::iterator as pulsevad_iter;
pub use models::pyannote::candle as pyannote_vad;
pub use models::pyannote::iterator as pyannote_vad_iter;
pub use models::pyannote::onnx as pyannote_vad_ort;
pub use models::silero::candle as silero_v5;
pub use models::silero::candle as silero_v6;
pub use models::silero::onnx as silero_v5_ort;
pub use models::silero::onnx as silero_v6_ort;
pub use models::ten::candle as ten_vad;
pub use models::ten::onnx as ten_vad_ort;
pub use vad::config as utils;
pub use vad::iterator as vad_iter;
pub use utils::TimeStamp;
pub use utils::VadParams;
pub use utils::VAD_SAMPLE_RATE;
pub use utils::TimeStamp as SpeechSegment;
pub use utils::VAD_SAMPLE_RATE as SAMPLE_RATE;
pub use vad::detector::Detector;
pub use vad::detector::DetectorBuilder;
pub use vad::detector::Model;
pub use vad::detector::Runtime;
pub use vad_iter::VadIter;
pub use vad_iter::VadModel;
pub use vad::detector::init_onnx_runtime;
pub use candle_core;
pub use ort;

Modules§

assets
Checksum-verified downloads and persistent caching for model bundles and the dynamically loaded ONNX Runtime library.
models
Model-specific inference implementations.
vad
Runtime-independent VAD configuration, iteration, and detector APIs.

Structs§

Error
The Error type, a wrapper around a dynamic error type.

Type Aliases§

Result
Result<T, Error>