View all articles
Text-to-speechKokoroCreatorsLocal AISpanish

Local Voiceovers for Your Videos with Open-Source Text-to-Speech

JG
Jacobo González Jaspe
|
Abstract illustration: a prism fanning a white beam into amber and white rays. Creators
Illustration generated with AI on our own machine.
This article is also available in Spanish:Locuciones para tus vídeos con texto a voz local y abierto

By the end of this post you will have a local text-to-speech server reading your video scripts, in English or Spanish, and you will know which voices to avoid. It runs in Docker; a GPU makes it fast, but the engine we recommend also ships a CPU image.

We measured three engines on the same script, because the first version of this post mixed up an English voice with Spanish text. That mistake is now a column in the table.

What you need

  • Docker, and an NVIDIA GPU if you want the speeds below (a CPU image exists; we did not time it)
  • A script as plain text, one paragraph per scene
  • ffmpeg to convert or join the files
  • 20 minutes

Step 1: start Kokoro

Kokoro-FastAPI wraps the Kokoro model in an OpenAI-compatible API on port 8880:

bash
# with an NVIDIA GPU
docker run -d --gpus all -p 8880:8880 --name kokoro ghcr.io/remsky/kokoro-fastapi-gpu:latest
# CPU only
docker run -d -p 8880:8880 --name kokoro ghcr.io/remsky/kokoro-fastapi-cpu:latest

List the voices. The first letter is the language, the second the gender: a American English, b British English, e Spanish.

bash
curl -s localhost:8880/v1/audio/voices | python3 -m json.tool | grep '"id"' | head -60

The Spanish voices are ef_dora, em_alex and em_santa.

Step 2: generate your first voiceover

bash
curl -s localhost:8880/v1/audio/speech -H 'Content-Type: application/json' \
  -d '{"model":"kokoro","voice":"af_heart","input":"Welcome back to the channel.","response_format":"wav"}' \
  -o intro.wav

For Spanish, pick a Spanish voice and set the language code, so the text is pronounced with Spanish rules:

bash
curl -s localhost:8880/v1/audio/speech -H 'Content-Type: application/json' \
  -d '{"model":"kokoro","voice":"em_alex","lang_code":"e","input":"Bienvenido de nuevo al canal.","response_format":"wav"}' \
  -o intro-es.wav

If the output sounds like an English speaker reading Spanish, the voice or the lang_code is wrong.

Step 3: one file per scene, then join them

Python
import pathlib, requests

paragraphs = pathlib.Path("script.txt").read_text(encoding="utf-8").split("\n\n")
for i, text in enumerate(paragraphs, 1):
    r = requests.post("http://localhost:8880/v1/audio/speech", json={
        "model": "kokoro", "voice": "em_alex", "lang_code": "e",
        "input": text, "response_format": "wav"}, timeout=300)
    r.raise_for_status()
    pathlib.Path(f"scene-{i:02d}.wav").write_bytes(r.content)

One file per scene means a correction re-renders one paragraph, not the whole video. Join them for a quick listen, or drop the scene files straight into your editor:

bash
for f in scene-*.wav; do echo "file '$f'"; done > list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy voiceover.wav

What we measured

On 2026-10-08 we ran scripts/bench/tts_voices.py on our DGX Spark (GB10, 128 GB unified memory). It sends the same script, 160 words in English and 159 in Spanish, to each engine and voice: one warm-up request, then two timed ones. It records wall time, audio length from the WAV header and the real-time factor (RTF: seconds of audio per second of work). Then Whisper medium (Speaches, language forced) transcribes each file, and we compute the word error rate (WER) against the script. Raw results: tts-voices-2026-10-08.json.

Engine, model (where it ran)VoicesScriptRTFWall timeWER
Kokoro (GPU)af_heart, am_michael, bf_emmaEnglish33.8 to 34.91.5 to 1.7 s0%
Kokoro (GPU)ef_dora, em_alex, em_santaSpanish35.6 to 35.71.4 s0.6% to 1.9%
Kokoro (GPU)af_heart (English voice)Spanish35.91.9 s11.3%
openedai-speech tts-1, Piper (CPU)alloy, echo, fable, onyx, nova, shimmerEnglish11.3 to 14.22.8 to 3.4 s0% to 4.4%
openedai-speech tts-1, Piper (CPU)same sixSpanish12.6 to 14.83.3 to 4.2 s18.2% to 31.4%
openedai-speech tts-1-hd, XTTS v2 (CPU)alloy, novaEnglish0.19 to 0.20317 s0%
openedai-speech tts-1-hd, XTTS v2 (CPU)alloy, novaSpanish0.21319 to 338 s1.3%

The audio ran 36 to 69 seconds depending on the voice. WAV files came out at 1.6 to 3.3 MB.

What the numbers mean in practice:

  • Spanish that works: Kokoro’s ef_dora, em_alex and em_santa, and XTTS v2. Whisper transcribed them with one to three slips in 159 words.
  • Spanish that does not: all six Piper voices behind openedai-speech’s tts-1. They are English models (en_US-libritts_r, en_GB-northern_english_male). Whisper heard “arquivo” for archivo and “paráforo” for párrafo. Kokoro’s English voice on Spanish text was better but still wrong one word in nine.
  • XTTS v2 is good and slow here. Our openedai-speech container has no GPU, so XTTS ran on the CPU at a fifth of real time: about five minutes per minute of audio. The first tts-1-hd request also downloaded the XTTS v2 model, 1.8 GB on disk, and the container keeps it loaded afterwards: check docker stats and restart the container if you need the memory back.

What the spec sheet won’t tell you

WER says whether a speech recogniser understood the voice. It does not say whether the voice sounds warm, natural or right for your channel. Our script is also easy: no brand names, no numbers. Listen to all three Spanish Kokoro voices with your own script before you pick one.

Kokoro’s model card lists grades for its English voices but none for Spanish, so we had no vendor claim to check; this table is the only grade we have.

Where this fits

Product walkthroughs, changelog videos, training clips and first drafts of a narration are a good fit: the voice is identical every time, so a correction recorded on Tuesday matches Monday’s take. A human narrator still wins on emotion and on tricky proper names.

If you publish synthetic voice, say so. A line such as “Synthetic voice generated with AI” in the description is enough and costs nothing.

Next steps

Setting up a content pipeline for a company channel? That is a project we take on: book a 15-minute call or see how we work in consulting.

Diagram
Share: LinkedIn X
Veredicto semanal

Get new guides before anyone else

Subscribe and we tell you when new guides, templates and workflows go up. One email a week, no spam.

Already published: 102 guides and 25 templates. All free, no signup.

Bonus: the local-AI starter pack PDF when you subscribe
Once a week No spam Unsubscribe anytime

See what you get