public class SpeechStream implements AutoClosable
Single-consumer incremental synthesis with at most 64 KiB of queued PCM. read() applies backpressure, never dropping samples. cancel() may be called from another thread; close() belongs to the consumer and joins the producer. No callback executes application code on the synthesis worker.
try stream = synthesizer.stream("Hello", voice="ryan", language="en"): block = stream.read()
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | channelschannels as Int = 1 |
One mono channel. |
| public readonly property | generatedSamplesgeneratedSamples as ULong |
Generated scalar samples, including queued blocks; retained after closure. |
| public readonly property | isCancelledisCancelled as Boolean |
Whether cancellation was requested. |
| public readonly property | isClosedisClosed as Boolean |
Whether ownership was released. |
| public readonly property | isFinishedisFinished as Boolean |
True after read() observed end, or after closure. |
| public readonly property | sampleRatesampleRate as Int |
Output frame rate in Hz. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SpeechStreamSpeechStream(notnull task as SpeechGenerationTask, notnull queue as PcmQueue, sampleRate as Int) |
Binds an owned queue and registered Klyn generation task. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | cancelcancel() as Void |
Requests cooperative cancellation and discards unread blocks. |
| public override | closeclose() as Void |
Cancels, joins and frees queue ownership. |
| public | readread() as AudioClip |
Waits for PCM; null means end/cancellation. |