Expand description
Native streaming speech-to-text input and microphone capture for Rust apps.
Recognition keeps going across as many utterances as the user speaks, until you stop it. An “utterance” is just a chunk of words spoken by the user: partial transcripts replace the current one, whereas a final transcript commits it.
Note that speech always stays as plain text here. This crate never interprets spoken works as commands or synthesizes key events from them, so saying something like “enter” will just type the word “enter”.
Dictation turns those transcripts into edits of a text field, so an app
only has to apply the replacements it hands back.
Apple builds need the Xcode command line tools (xcode-select --install), and
support macOS 11+ and iOS 13+. For macOS builds, set the MACOSX_DEPLOYMENT_TARGET
env var to 11.0 or newer for the whole Cargo invocation, including the final app.
This mostly just matters on Intel x86 macs, but it doesn’t hurt to always set it.
Re-exports§
pub use dictation::Dictation;pub use dictation::Replacement;
Modules§
- dictation
- Puts dictated words into a text field.
Structs§
- Native
Speech Options - Native
Speech Session - Owns the system microphone and recognition task; dropping it cancels both.
- Speech
Error - A
SpeechErrorKindthat you can match on, plus the message the OS gave us.Displaywrites just that message, which is already worded for end users.
Enums§
- Native
Speech Event - Speech
Error Kind - The cause of a speech failure, so you can handle each one properly instead of matching on message text.
Functions§
- cancel_
all - Cancels every active session, for things like suspending or quitting the app.
- engine_
name - The short, stable name of the recognizer this build uses, e.g.,
"apple-sfspeech". Handy for logs and bug reports.