Elixir bindings to the Kokoro-82M text-to-speech model
The easiest way to try the library is to run the livebook here.
- Add this library as a mix dependency:
# Hex package coming soon
{:kokoro, github: "samrat/kokoro"}
- Download ONNX model from https://huggingface.co/onnx-community/Kokoro-82M-ONNX/tree/main/onnx
- Download voice .bin file from https://huggingface.co/onnx-community/Kokoro-82M-ONNX/tree/main/voices
Then,
kokoro = Kokoro.new("/path/to/kokoro-v0_19.onnx", "/path/to/voices/directory")
Kokoro.save_audio_to_file(kokoro, "Hello from Elixir", "af_nicole", 1.0, "/tmp/output.raw")
Convert raw audio to wav
❯ ffmpeg -f f32le -ar 24000 -ac 1 -i /tmp/output.raw /tmp/output.wav
- Use
espeak
via NIF bindings(?) - [ ]
MIT License. © Samrat Man Singh