transcribe_cpp library

Offline, on-device speech-to-text for Flutter, over transcribe.cpp, a ggml/GGUF speech engine, with Metal acceleration on iOS.

Two entry points. ModelManager downloads and verifies a model when the app asks for one; TranscribeSession loads it and turns the microphone into text, endpointing speech hands-free.

An app with its own audio stack can skip the microphone: TranscribeSession.transcribeStream runs the same endpointing and live text over audio the app pushes, and TranscribeSession.transcribe decodes a single clip. Both take any rate and channel count (AudioFormat). Audio handed to TranscribeSession.replay must already be mono float32 at TranscribeSession.sampleRate (16 kHz), with samples in [-1, 1].

Classes

AudioFormat
The layout of audio handed to TranscribeSession.transcribe or TranscribeSession.transcribeStream: its rate, channel count and sample format.
CancelToken
Lets one caller stop waiting for a download.
CaptureStatus
A capture state change, with the reason when there is one.
DownloadProgress
How much of a model has arrived. State, not an event: a progress bar that subscribes late should draw where the download is, not wait for the next chunk.
Dropout
Audio the capture layer lost, and had to be skipped over.
EndpointerConfig
Tuning for Endpointer.
EndpointerEvent
Something the Endpointer observed. Times are stream-relative.
InstalledModel
A model file that is on disk and has passed its hash check.
Live<T>
A value that can be read now and watched over time.
LiveLevel
What the front of the pipeline is hearing, right now.
LiveText
The transcript so far: what is final, and what is still being spoken.
ModelCatalog
The models an app can offer.
ModelDescriptor
Everything needed to fetch, verify and identify one model file.
ModelInfo
Static facts about a loaded model.
ModelManager
Downloads, stores and tracks the models an app offers.
NativeLog
Controls what the engine and ggml print.
NormalizerConfig
Tuning for AudioNormalizer.
Segment
SpeechDiscarded
A burst of speech was thrown away for not clearing EndpointerConfig.minSpeechDuration.
SpeechEnded
An utterance closed and its audio is ready.
SpeechStarted
Speech has been confirmed — it survived EndpointerConfig.minSpeechDuration.
Token
TranscribeSession
A loaded model and the pipeline around it: microphone in, text out.
Transcript
A complete result snapshot, fully copied out of the session.
Utterance
One endpointed span of audio, ready to hand to Transcriber.transcribe.
UtteranceResult
A transcript for one endpointed utterance, with the timing that produced it.
Wav
Minimal WAV support, for capturing a session and replaying it.
Word

Enums

CaptureState
What the microphone is doing.
ModelStatus
Where one model stands on this device.
SampleFormat
How each sample of pushed audio is stored. Little-endian, as on every platform the package runs on.
SessionState
What a TranscribeSession is doing.
TranscribeStatus
Mirrors transcribe_status in include/transcribe.h.

Extension Types

ModelId
Names one downloadable model file, such as parakeet-tdt_ctc-110m-Q4_K_M.

Exceptions / Errors

DownloadCancelledException
This caller cancelled. Bytes already received are kept for resuming.
InsufficientStorageException
Not enough free space to finish downloading a model.
ModelDownloadException
The transfer failed. Bytes already received are kept unless message says otherwise, so trying again resumes rather than restarts.
ModelIntegrityException
A download that cannot be installed: wrong size or wrong SHA-256.
TranscribeException
Thrown for any non-OK status from the native library.