A Docker container for running Kokoro Text-to-Speech engine v.1, providing high-quality speech synthesis with 54 voices and 9 languages options.
- High-quality text-to-speech synthesis
- Multiple voice and languages options
- Voice blending capabilities
- Adjustable speech speed
- Support for .mp3 and .wav output files
You can directly pull and run the pre-built container from Docker Hub without building locally:
# Pull the latest image
docker pull usrbinbrain/kokoro-tts-container:latest
# Run a basic example
docker run --rm -v $(pwd):/app/shared usrbinbrain/kokoro-tts-container \
"Hello world!" \
output.mp3 \
--voice "af_sarah" \
--speed 1.0 \
--lang "en-us"
This way you can use Kokoro-TTS instantly without worrying about setup or build steps.
Building your kokoro-tts Docker image:
# Install requirements for setup
pip3 install -r requirements.txt
# Run setup to donwload model and gerenate voices bin file
python3 setup.py
# Build your kokoro-tts image
docker build -t kokoro-tts-container .
Run the container with a single voice.
The command below generates an output.mp3 file, where af_sarah
voice says "Hello my friend!" in English (US) with speed 1.2
docker run --rm -v $(pwd):/app/shared kokoro-tts-container \
"Hello my friend!" \
output.mp3 \
--voice "af_sarah" \
--speed 1.2 \
--lang "en-us"
Kokoro-TTS supports voice blending, allowing you to mix multiple voices with different weights.
The command below generates an output.wav file with combined voices, where af_sarah
contributes 40%
and am_adam
contributes 60%
to the final voice saying "Hasta la vista!" in Spanish with speed 0.8
docker run --rm -v $(pwd):/app/shared kokoro-tts-container \
"Hasta la vista!" \
output.wav \
--voice "af_sarah:40,am_adam:60" \
--speed 0.8 \
--lang "es"
Parameter | Description | Default |
---|---|---|
input_text |
The text to synthesize | Required |
output_file |
Output audio filename (.wav or .mp3 ) |
Required |
--voice |
Voice ID or blend (format: voice1:weight,voice2:weight ) |
af_sarah |
--speed |
Speech rate multiplier, allows 0.5 to 2.0 |
1.0 |
--lang |
Language code | en-us |
en-us
: English (US)en-gb
: English (British)fr-fr
: Frenchja
: Japanesehi
: Hindicmn
: Mandarin Chinesees
: Spanishpt-br
: Brazilian Portugueseit
: Italian
The container includes multiple voices for different languages, for a complete list of voices or another help, run:
docker run --rm kokoro-tts-container --help
Built with ❤️ on top of Kokoro ONNX - A special thanks to thewh1teagle and hexgrad for providing this amazing fast TTS engine that made this container project possible.