Skip to main content

AudioTurnDetector

Trait AudioTurnDetector 

Source
pub trait AudioTurnDetector: Send + Sync {
    // Required methods
    fn push_audio(&mut self, frame: &AudioFrame<'_>);
    fn predict(&mut self) -> Result<TurnPrediction, TurnError>;
    fn reset(&mut self);
}
Expand description

Turn detector that operates on raw audio.

Implementations buffer audio internally and run prediction on demand. The typical flow with VAD:

  1. Every audio chunkpush_audio
  2. VAD fires “speech started”reset
  3. VAD fires “speech stopped”predict

Required Methods§

Source

fn push_audio(&mut self, frame: &AudioFrame<'_>)

Feed audio into the internal buffer.

Call continuously with incoming audio frames (16 kHz mono).

Source

fn predict(&mut self) -> Result<TurnPrediction, TurnError>

Run prediction on buffered audio.

Call when VAD detects end of speech.

Source

fn reset(&mut self)

Clear the internal buffer. Call when a new speech turn begins.

Implementors§