API reference
KittenTTS
KittenTTS(
model_name="KittenML/kitten-tts-nano-0.8",
cache_dir=None,
backend=None,
)
| Argument | Type | Meaning |
|---|---|---|
model_name | str | Hugging Face repo ID or a name within KittenML |
cache_dir | str | None | Optional Hugging Face cache root |
backend | "cpu" | "cuda" | "amd_gpu" | None | Requested ONNX execution provider |
generate()
audio = tts.generate(text, voice="expr-voice-5-m", speed=1.0, clean_text=False)
Returns a NumPy array. Set clean_text=True for normal input containing non-spoken forms.
generate_stream()
for audio_chunk in tts.generate_stream(text, voice="Bella", speed=1.0, clean_text=True):
...
Returns a generator of NumPy arrays, one per text chunk.
generate_to_file()
tts.generate_to_file(text, output_path, voice="Luna", speed=1.0, sample_rate=24_000)
Generates all audio, then writes it with SoundFile.
available_voices
voices = tts.available_voices
Returns the eight display-name aliases.
normalize_text()
Available both as a module function and instance method:
normalize_text(text, locale="en-US", return_spans=False)
tts.normalize_text(text, locale="en-US", return_spans=False)
When return_spans=False, returns str. When true, returns a NormalizedTextResult with .text and .spans.
Compatibility helper
get_model(repo_id, cache_dir=None, backend=None) constructs KittenTTS for older integrations. New code should use KittenTTS(...) directly.