Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KittenML/KittenTTS/llms.txt
Use this file to discover all available pages before exploring further.
model.generate returns a NumPy array of audio samples at 24,000 Hz. You can save or process this array however you like. This guide covers the most common approaches.
Using soundfile (recommended)
soundfile is installed automatically with KittenTTS and supports WAV, FLAC, OGG, and other formats.sf.write is the sample rate. Always use 24000 to match KittenTTS output.
Using generate_to_file
For convenience, you can skip the intermediate array entirely:generate_to_file accepts the same voice and speed parameters as generate, plus an explicit sample_rate argument.
Inspecting the audio array
The array returned bygenerate is a standard NumPy array. You can inspect its properties before saving:
Audio is returned as 32-bit float samples normalized to the range
[-1.0, 1.0]. Most audio libraries accept this format directly.Format comparison
| Format | Extension | Lossy | Notes |
|---|---|---|---|
| WAV | .wav | No | Universally compatible, larger files |
| FLAC | .flac | No | Lossless compression, smaller than WAV |
| OGG | .ogg | Yes | Smallest files, slight quality loss |