Overview
GenerationOptions controls all aspects of the speech synthesis pipeline, including sampling parameters, chunking strategy, and concurrency. All fields have sensible defaults, so the zero-argument initializer works for most use cases.
Initialization
Sampling temperature. Higher values (e.g., 1.0) make output more random; lower values (e.g., 0.5) make it more deterministic.
Top-K sampling parameter. Only the K most likely tokens are considered at each step.
Repetition penalty to discourage repeating tokens. Values > 1.0 penalize repetition.
Maximum number of tokens to generate in the autoregressive loop.
Number of concurrent workers for multi-chunk generation:
0: all chunks run concurrently in one batch (default, fastest for non-streaming use cases)1: sequential - one chunk at a time; required for real-timeplaystreamingN: at most N chunks run concurrently
How to split long text into chunks. Defaults to
.sentence. Set to .none to force a single-pass generation without sentence splitting.Target chunk size in tokens for sentence chunking.
nil resolves to TextChunker.defaultTargetChunkSize at the call site.Minimum chunk size in tokens.
nil resolves to TextChunker.defaultMinChunkSize at the call site.Optional style instruction for controlling speech characteristics (e.g.,
"Very happy"). Prepended as a text-only user prompt before the main TTS segment. For Qwen3, this is only supported by the 1.7B model variant.Force the legacy
[FloatType] inference path even on macOS 15+ / iOS 18+. When false (default), the MLTensor path is taken on supported OS versions. Set to true in tests to exercise the pre-macOS-15 code path on current hardware.Properties
Sampling Parameters
Sampling temperature. Default:
0.9Top-K sampling parameter. Default:
50Repetition penalty to discourage repeating tokens. Default:
1.05Maximum number of tokens to generate. Default:
245Chunking and Concurrency
Number of concurrent workers for multi-chunk generation. Default:
0 (all chunks concurrently)How to split long text into chunks. Default:
nil (resolves to .sentence)Target chunk size in tokens for sentence chunking. Default:
nil (uses TextChunker.defaultTargetChunkSize)Minimum chunk size in tokens. Default:
nil (uses TextChunker.defaultMinChunkSize)Style Control
Optional style instruction for controlling speech characteristics. Default:
nilOnly supported by the Qwen3 1.7B model variant.Advanced
Force the legacy
[FloatType] inference path. Default: falseStatic Properties
defaultTemperature
Default sampling temperature:
0.9defaultTopK
Default Top-K sampling parameter:
50defaultRepetitionPenalty
Default repetition penalty:
1.05defaultMaxNewTokens
Default maximum number of tokens to generate:
245