pub struct Dictation { /* private fields */ }Expand description
One dictation: audio pushed in, a transcript out.
Implementations§
Source§impl Dictation
impl Dictation
Sourcepub fn new(
weights: &[u8],
tokenizer: &[u8],
config: &[u8],
trailing_silence_ms: u32,
) -> Result<Self, JsError>
pub fn new( weights: &[u8], tokenizer: &[u8], config: &[u8], trailing_silence_ms: u32, ) -> Result<Self, JsError>
Loads a Whisper model the page has already fetched, and opens a recording to push into.
trailing_silence_ms is how long the speaker must stay quiet after
speaking before Dictation::speaker_stopped returns true.
Sourcepub fn push_audio(&mut self, samples: &[f32])
pub fn push_audio(&mut self, samples: &[f32])
Takes one frame of mono audio, already resampled to 16 kHz.
Sourcepub fn speaker_stopped(&self) -> bool
pub fn speaker_stopped(&self) -> bool
Whether the speaker has spoken and then gone quiet for the configured
pause. A page polls this to decide when to call Dictation::finish.
Trait Implementations§
Source§impl FromWasmAbi for Dictation
impl FromWasmAbi for Dictation
Source§impl IntoWasmAbi for Dictation
impl IntoWasmAbi for Dictation
Source§impl LongRefFromWasmAbi for Dictation
impl LongRefFromWasmAbi for Dictation
Source§impl OptionFromWasmAbi for Dictation
impl OptionFromWasmAbi for Dictation
Source§impl OptionIntoWasmAbi for Dictation
impl OptionIntoWasmAbi for Dictation
Source§impl RefFromWasmAbi for Dictation
impl RefFromWasmAbi for Dictation
Source§type Abi = WasmPtr<WasmRefCell<Dictation>>
type Abi = WasmPtr<WasmRefCell<Dictation>>
The Wasm ABI type references to
Self are recovered from.Source§impl RefMutFromWasmAbi for Dictation
impl RefMutFromWasmAbi for Dictation
impl SupportsConstructor for Dictation
impl SupportsInstanceProperty for Dictation
impl SupportsStaticProperty for Dictation
Source§impl TryFromJsValue for Dictation
impl TryFromJsValue for Dictation
Source§impl VectorFromWasmAbi for Dictation
impl VectorFromWasmAbi for Dictation
Source§impl VectorIntoWasmAbi for Dictation
impl VectorIntoWasmAbi for Dictation
Auto Trait Implementations§
impl !Freeze for Dictation
impl RefUnwindSafe for Dictation
impl Send for Dictation
impl Sync for Dictation
impl Unpin for Dictation
impl UnsafeUnpin for Dictation
impl UnwindSafe for Dictation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.