The Curious AI Guy

Guide

Make a voice on your own computer

Three free tools that turn text into speech without a subscription: Piper, Kokoro and Chatterbox. Pick one, run a few commands, and you have a voice file.

Which one should I try?

They all do text to speech. They differ in effort, quality and what they can do.

Piper

Easiest and fastest. Runs locally, many voices and languages, no voice cloning. A good first try.

Easy

Kokoro

Small and natural. An 82 million parameter model that is quick, with ready-made voices. No voice cloning.

Medium

Chatterbox

Most capable. Many languages and voice cloning from a short clip. Heavier, and a graphics card helps.

Technical

The paid tool they stand in for is ElevenLabs. They do not match its polish in every language, so listen to a sample for your language before you commit. Details on each: Piper, Kokoro, Chatterbox.

Before you start

You need

  • Python. All three install with pip. Chatterbox was developed and tested on Python 3.11.
  • A terminal. Windows PowerShell, macOS Terminal or a Linux shell.
  • Patience on the first run. The first time, the program downloads its model files.

A tip

  • Use a virtual environment. It keeps each tool's packages in their own folder, so they do not clash. Create one with python -m venv voice and activate it before you install.
  • Try with a short text first. One sentence is enough to check it works.

Piper: your first voice in three commands

  1. Install.
    pip install piper-tts
  2. Download a voice. This example downloads an American English voice to the current folder. To see all voices, run the same command without a name.
    python3 -m piper.download_voices en_US-lessac-medium
  3. Make a sound file.
    python3 -m piper -m en_US-lessac-medium -f test.wav -- 'This is a test.'
    This writes test.wav. On Windows, python may work where python3 does not.

The command line reloads the model each time, so it is slow for many files. For repeated use, Piper has a web server mode. Add --cuda for GPU speed (it needs the onnxruntime-gpu package).

Read this: Piper says it is intended for personal use and text-to-speech research. Each voice comes with a MODEL_CARD file with its own license, and some voices have restrictive licenses. Check the voice you pick before you publish or sell anything. Also, the project is currently looking for maintainers, so check how active it is. Piper on this site.

Kokoro: a small model that sounds natural

  1. Install the package.
    pip install "kokoro>=0.9.4" soundfile
  2. Install espeak-ng. Kokoro uses it for some words and languages. On Windows: open the espeak-ng releases page on GitHub, download the latest .msi file and run it. On Linux, install the espeak-ng package, for example with sudo apt-get install espeak-ng.
  3. Run this script. Save it as say.py and run python say.py. The a means American English, and af_heart is one of the ready-made voices.
    from kokoro import KPipeline
    import soundfile as sf
    
    pipeline = KPipeline(lang_code='a')
    text = 'Hello, this is a short test of Kokoro.'
    
    for i, (gs, ps, audio) in enumerate(pipeline(text, voice='af_heart')):
        sf.write(f'{i}.wav', audio, 24000)

Other language codes from the project: b British English, e Spanish, f French, h Hindi, i Italian, p Brazilian Portuguese, j Japanese and z Mandarin (these two need an extra package). Dutch is not in the project's list. Make sure the language code matches the voice.

Good to know: Kokoro has fixed voices and does not clone voices. The model weights are Apache-licensed according to the project. Kokoro on this site.

Chatterbox: many languages and voice cloning

  1. Install.
    pip install chatterbox-tts
  2. Run this script. Use cuda if you have an NVIDIA graphics card, mps on an Apple Silicon Mac, or cpu if you have neither (slower).
    import torchaudio as ta
    from chatterbox.tts import ChatterboxTTS
    
    model = ChatterboxTTS.from_pretrained(device='cuda')
    wav = model.generate('Hello, this is a short test of Chatterbox.')
    ta.save('test.wav', wav, model.sr)
  3. To clone a voice, pass a short reference recording. The project's own example does it like this:
    wav = model.generate(text, audio_prompt_path='your_ref_clip.wav')

The multilingual model covers 23+ languages. Match the reference clip to the language you generate, otherwise the accent of the clip can carry over.

Built-in watermark: every file Chatterbox generates carries an imperceptible watermark from Resemble AI, designed to survive MP3 compression and editing, so generated audio can be detected. That is worth knowing if you plan to publish the audio. Chatterbox on this site.

Good to know

Only clone voices you have permission to use. Cloning someone's voice without their consent can cause real harm and can be illegal. Use your own voice, or get a clear yes.

Check the license of the voice or model. The code and the voices can have different rules, especially if you plan to sell or publish what you make.

Say it was made by AI where it matters. If listeners could think a real person recorded it, tell them it is synthetic.

New to running things yourself? Start here. Prefer video models? Read the ComfyUI guide.

Want to hear what it sounds like?