pub struct WhisperStreamPcm { /* private fields */ }Expand description
Streaming PCM transcriber — direct port of stream-pcm.cpp main loop.
Two modes:
- Fixed-step (
use_vad = false): processstep_mschunks with overlap. - VAD-driven (
use_vad = true): accumulate speech, transcribe on silence.
Implementations§
Source§impl WhisperStreamPcm
impl WhisperStreamPcm
Sourcepub fn new(
ctx: &WhisperContext,
params: FullParams,
config: WhisperStreamPcmConfig,
reader: PcmReader,
) -> Result<Self>
pub fn new( ctx: &WhisperContext, params: FullParams, config: WhisperStreamPcmConfig, reader: PcmReader, ) -> Result<Self>
Create a new WhisperStreamPcm processor (simple VAD or no VAD).
Sourcepub fn with_vad(
ctx: &WhisperContext,
params: FullParams,
config: WhisperStreamPcmConfig,
reader: PcmReader,
vad: WhisperVadProcessor,
) -> Result<Self>
pub fn with_vad( ctx: &WhisperContext, params: FullParams, config: WhisperStreamPcmConfig, reader: PcmReader, vad: WhisperVadProcessor, ) -> Result<Self>
Create a new WhisperStreamPcm processor with Silero VAD.
Sourcepub fn is_eof(&self) -> bool
pub fn is_eof(&self) -> bool
Returns true when the underlying reader has hit EOF and all samples are drained.
Sourcepub fn process_step(&mut self) -> Result<Option<Vec<Segment>>>
pub fn process_step(&mut self) -> Result<Option<Vec<Segment>>>
Run one iteration of the main loop.
Returns Ok(Some(segments)) if transcription occurred,
Ok(None) if waiting for more audio or sleeping,
Err on fatal error.
Returns Ok(None) with no more audio when EOF + drained.
Sourcepub fn run<F>(&mut self, callback: F) -> Result<()>
pub fn run<F>(&mut self, callback: F) -> Result<()>
Run until EOF or error. Calls callback for each transcription.
Sourcepub fn total_samples(&self) -> i64
pub fn total_samples(&self) -> i64
Get the total number of processed samples.
Auto Trait Implementations§
impl Freeze for WhisperStreamPcm
impl !RefUnwindSafe for WhisperStreamPcm
impl Send for WhisperStreamPcm
impl !Sync for WhisperStreamPcm
impl Unpin for WhisperStreamPcm
impl !UnwindSafe for WhisperStreamPcm
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