public class SpeechSynthesizer implements AutoClosable
Resident Qwen3-TTS CustomVoice synthesis from GGUF or original HF Safetensors, implemented in Klyn/C++ using the existing Klyn NN backend. No additional inference library, Python service or external executable is used. Synthesis produces typed PCM, never implicit playback or microphone activation. Auto selects a compatible NVIDIA GPU, otherwise CPU. Packed projections execute on that device; causal audio kernels use synchronized CPU storage. An explicit GPU never falls back. NPU execution is not available yet. A synthesizer is single-owner; only SpeechStream.cancel is cross-thread.
try speech = SpeechSynthesizer.load("sakasegawa/Qwen3-TTS-12Hz-0.6B-CustomVoice-GGUF"): speech.synthesize("Hello", voice="ryan", language="en").play()
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | devicedevice as Device = Device.cpu |
Actual device, not the original selector. |
| public readonly property | sampleRatesampleRate as Int |
Output frequency in Hz. |
| public readonly property | voicesvoices as String[] |
Fresh array of built-in voice names. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SpeechSynthesizerSpeechSynthesizer(notnull folder as FolderPath, notnull device as Device = Device.auto, maxContext as Long = 1024l, maxFrames as Long = 512l, seed as ULong = 0ul, verbose as Boolean = false) |
Opens original HF Safetensors with the nested speech_tokenizer codec. |
| public | SpeechSynthesizer | Opens a local CustomVoice GGUF and keeps its parameters resident. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | closeclose() as Void |
Cancels and joins the active worker, then releases model parameters. |
| public static | loadload(notnull repository as String, quantization as ModelQuantization = ModelQuantization.AUTO, notnull device as Device = Device.auto, maxContext as Long = 1024l, maxFrames as Long = 512l, seed as ULong = 0ul, revision as String = "main", offline as Boolean = false, verbose as Boolean = false, token as String = "", format as ModelFormat = ModelFormat.AUTO) as SpeechSynthesizer |
Resolves a pinned Hub quantization through the shared verified cache, then loads it. |
| public | streamstream(notnull text as String, notnull voice as String = "", notnull language as String = "auto", notnull instructions as String = "") as SpeechStream |
Starts bounded, cancellable incremental synthesis on a registered Klyn worker. |
| public | synthesize | Produces a complete independent mono Float32 clip without playback. |