Leokani for Python
Text to a 24 kHz WAV file, on any CPU. Python 3.10 or later.
Install
pip install huggingface_hub onnxruntime
hf download milliwattlabs/leokani-tts --local-dir leokani-tts
cd leokani-ttsLeokani needs espeak-ng for phonemes: brew install espeak-ng on a Mac, sudo apt install espeak-ng on Debian or Ubuntu.
Speak
python leokani_onnx.py "Hello there. How was your day?" -o hello.wav
python leokani_onnx.py "A little slower, please." --speed 0.85 -o slow.wavWith no text, it reads standard input.
Model size
| Option | File |
|---|---|
| (none) | leokani-tts.onnx, FP32 |
--fp16 | leokani-tts-fp16.onnx |
--int8 | leokani-tts-int8.onnx, the smallest |
python leokani_onnx.py --int8 "Same voice, the smallest file." -o int8.wavOptions
| Option | |
|---|---|
-o, --out FILE | Output WAV. Default leokani.wav. |
--speed N | 1.0 is normal. |
--espeak PATH | Where espeak-ng is, if it isn't on your PATH. |
--phonemes "..." | Kokoro-style phonemes instead of text, without espeak-ng. |
PyTorch
The same voice from the safetensors weights:
pip install -r requirements.txt
python leokani.py "Hello there. How was your day?" -o hello.wav
python leokani.py --fp16 "Same voice, half-size weights." -o fp16.wavLeokani-tts is CC BY-NC 4.0. For a commercial license or a custom voice, email hello@milliwattlabs.com.