pub struct PipecatSmartTurn { /* private fields */ }Expand description
Pipecat Smart Turn v3 detector.
Wraps the Smart Turn v3 architecture (Whisper-Tiny encoder + binary
classification head). Use new for the embedded upstream weights, or
with_variant to pick a WaveKat fine-tune at runtime.
Buffers up to 8 seconds of audio internally. Call push_audio with
every incoming 16 kHz frame, then call predict when the VAD fires
end-of-speech to get a TurnPrediction.
§Usage with VAD
use wavekat_turn::audio::PipecatSmartTurn;
use wavekat_turn::AudioTurnDetector;
let mut detector = PipecatSmartTurn::new().unwrap();
// ... feed frames via push_audio ...
let prediction = detector.predict().unwrap();
println!("{:?} ({:.2})", prediction.state, prediction.confidence);Implementations§
Source§impl PipecatSmartTurn
impl PipecatSmartTurn
Sourcepub fn new() -> Result<Self, TurnError>
pub fn new() -> Result<Self, TurnError>
Load the upstream Pipecat Smart Turn v3.2 model embedded at compile time.
Equivalent to with_variant(SmartTurnVariant::PipecatV3).
Sourcepub fn with_variant(variant: SmartTurnVariant) -> Result<Self, TurnError>
pub fn with_variant(variant: SmartTurnVariant) -> Result<Self, TurnError>
Load a specific variant of the Smart Turn model.
SmartTurnVariant::PipecatV3uses the embedded ONNX bytes — no network required.SmartTurnVariant::Wavekat(when thewavekat-smart-turnfeature is enabled) downloads the corresponding language file from thewavekat/smart-turn-ONNXHuggingFace repo and caches it under$HF_HOME/hub/. SetWAVEKAT_TURN_MODEL_DIRto point at a pre-populated directory (offline / CI use).
Trait Implementations§
Source§impl AudioTurnDetector for PipecatSmartTurn
impl AudioTurnDetector for PipecatSmartTurn
Source§fn push_audio(&mut self, frame: &AudioFrame<'_>)
fn push_audio(&mut self, frame: &AudioFrame<'_>)
Append audio to the internal ring buffer.
Frames with a sample rate other than 16 kHz are silently dropped. The ring buffer holds at most 8 s; older samples are evicted.
impl Send for PipecatSmartTurn
impl Sync for PipecatSmartTurn
Auto Trait Implementations§
impl Freeze for PipecatSmartTurn
impl !RefUnwindSafe for PipecatSmartTurn
impl Unpin for PipecatSmartTurn
impl UnsafeUnpin for PipecatSmartTurn
impl !UnwindSafe for PipecatSmartTurn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more