pub struct WhisperStream { /* private fields */ }Expand description
Streaming transcriber — faithful port of stream.cpp main loop.
Two modes:
- Fixed-step (
step_ms > 0): sliding window with overlap. - VAD (
step_ms <= 0): transcribe on speech activity.
Implementations§
Source§impl WhisperStream
impl WhisperStream
Sourcepub fn new(ctx: &WhisperContext, params: FullParams) -> Result<Self>
pub fn new(ctx: &WhisperContext, params: FullParams) -> Result<Self>
Create with default config.
Sourcepub fn with_config(
ctx: &WhisperContext,
params: FullParams,
config: WhisperStreamConfig,
) -> Result<Self>
pub fn with_config( ctx: &WhisperContext, params: FullParams, config: WhisperStreamConfig, ) -> Result<Self>
Create with custom config.
Sourcepub fn feed_audio(&mut self, samples: &[f32])
pub fn feed_audio(&mut self, samples: &[f32])
Push samples into the internal buffer (replaces SDL capture).
Sourcepub fn process_step(&mut self) -> Result<Option<Vec<Segment>>>
pub fn process_step(&mut self) -> Result<Option<Vec<Segment>>>
Dispatch to fixed-step or VAD mode.
Sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Samples currently in the internal buffer.
Sourcepub fn processed_samples(&self) -> i64
pub fn processed_samples(&self) -> i64
Total samples consumed from the buffer.
Auto Trait Implementations§
impl Freeze for WhisperStream
impl RefUnwindSafe for WhisperStream
impl Send for WhisperStream
impl !Sync for WhisperStream
impl Unpin for WhisperStream
impl UnwindSafe for WhisperStream
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