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:
- Every audio chunk →
push_audio - VAD fires “speech started” →
reset - VAD fires “speech stopped” →
predict
Required Methods§
Sourcefn push_audio(&mut self, frame: &AudioFrame<'_>)
fn push_audio(&mut self, frame: &AudioFrame<'_>)
Feed audio into the internal buffer.
Call continuously with incoming audio frames (16 kHz mono).
Sourcefn predict(&mut self) -> Result<TurnPrediction, TurnError>
fn predict(&mut self) -> Result<TurnPrediction, TurnError>
Run prediction on buffered audio.
Call when VAD detects end of speech.