Docs · Leokani-tts

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-tts

Leokani 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.wav

With no text, it reads standard input.

Model size

OptionFile
(none)leokani-tts.onnx, FP32
--fp16leokani-tts-fp16.onnx
--int8leokani-tts-int8.onnx, the smallest
python leokani_onnx.py --int8 "Same voice, the smallest file." -o int8.wav

Options

Option
-o, --out FILEOutput WAV. Default leokani.wav.
--speed N1.0 is normal.
--espeak PATHWhere 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.wav

Leokani-tts is CC BY-NC 4.0. For a commercial license or a custom voice, email hello@milliwattlabs.com.