transcribeStream consumes an AsyncStream<Data> of PCM chunks and yields partial results as the
native session decodes them. Segmentation and endpointing happen inside the SDK, so the app just
pumps microphone audio in.
Basic usage
Method signature
async nor throws: it returns immediately. Failures arrive as a terminal
RASTTPartialResult with isFinal == true and the failure text in text, prefixed
"STT stream failed".
Each element of audio must be Data holding PCM samples at 16 kHz mono.
RASTTPartialResult
Live transcription
SwiftUI integration
Voice command detection
Act on non-final partials so a command fires without waiting for the utterance to close.Options
transcribeStream takes the same RASTTOptions as transcribe. Two fields matter most here:
Performance tips
Chunk size
Chunk size
Yield microphone buffers as they arrive rather than accumulating seconds of audio. The native
session handles buffering.
Finish the continuation
Finish the continuation
Always call
continuation.finish() when the session ends. An unfinished stream keeps the native
session and its buffers alive.Main actor
Main actor
Decoding runs off the main thread. Hop back to the main actor before touching view state.
Error handling
There is nothing to catch. Errors surface in-band as a terminal partial..speechRecognition. Check currentModel(_:) before starting a session.
Basic Transcription
Non-streaming transcription
STT Options
Configure transcription