public class TranscriptionStream extends Generator<TranscriptionUpdate>
Owned, single-consumer stream of revisable/final hypotheses. Whisper uses bounded audio windows with VAD, not native incremental decoding. cancel() is cross-thread; close()/read()/iteration belong to the consumer. A for-loop closes the stream on break. Closing stops, but does not close, its borrowed microphone; the caller owns that device.
try updates = recognizer.stream(microphone, language="fr"): for update in updates: if update.isFinal: print(update.text)
| Modifier and Type | Member | Description |
|---|---|---|
| public override readonly property | currentcurrent as TranscriptionUpdate |
Last successful iteration value. |
| public readonly property | isFinishedisFinished as Boolean |
True when the consumer observed EOF or closed the stream. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | TranscriptionStreamTranscriptionStream(task as RecognitionTask, queue as RecognitionQueue, control as RecognitionControl, microphone as Microphone) |
Constructs a stream for a registered task; use SpeechRecognizer.stream(). |
| Modifier and Type | Member | Description |
|---|---|---|
| public | cancelcancel() as Void |
Stops capture and discards unfinished hypotheses, waking both ends. |
| public override | closeclose() as Void |
Cancels, joins and releases the worker, even when stopping the borrowed microphone raises an error. |
| public override | nextnext() as Boolean |
Advances the generator. |
| public | readread() as TranscriptionUpdate |
Waits for an update; null means EOF/cancellation. |