Free Text-to-Speech for YouTube Videos: My Kokoro TTS Pipeline
Every tutorial and Short on my YouTube channel Omilabs is narrated by a synthetic voice. I don't record my own voiceover for these videos. The narration comes from a script that turns each line of text into audio, and that script runs on Kokoro, a small open-weight text-to-speech model. In this post I explain how I set it up, the problems I hit, and the checks I now run so the voice sounds clean and stays consistent across more than a hundred videos.
Why I Picked an Open TTS Model
When you make one video, a paid voice tool is easy. When you make a full series of long episodes plus many Shorts, and you rebuild the audio every time a script line changes, a few things start to matter more:
- Re-runs cost nothing. I edit scripts often. With a local model I can regenerate a whole episode as many times as I want.
- It runs anywhere. The model is small enough to run on a normal CPU, including a free GitHub Actions runner, which is where my videos are rendered now.
- The output is repeatable. The same text with the same voice and speed gives me the same audio, so my caching works.
- No account or API key is needed inside the render job, which means one less secret to protect.
Kokoro is an 82-million-parameter model released under the Apache 2.0 licence. I use it through the kokoro-onnx Python package, which runs the ONNX version of the model with ONNX Runtime. You need two files next to your script: the model file (kokoro-v1.0.onnx) and the voices file (voices-v1.0.bin).
The Basic Script
The core is only a few lines. This is close to what my build step does for one line of narration:
from kokoro_onnx import Kokoro
import soundfile as sf
kokoro = Kokoro("kokoro-v1.0.onnx", "voices-v1.0.bin")
samples, sample_rate = kokoro.create(
"Your AI calls are failing silently. Here is why.",
voice="af_heart", speed=1.0, lang="en-us"
)
sf.write("line01.wav", samples, sample_rate)
The voices file contains many preset voices for different accents and languages. I picked one English voice for the whole channel and never switch it mid-series. Viewers notice when the narrator suddenly sounds different, and a consistent voice is part of the channel's identity.
How I Structure Narration: One Beat at a Time
I never send a whole script to the model in one go. Each video spec is a list of short "beats", and each beat has its own narration line and its own visual. The build step does this for every beat:
- Clean the text (more on this below).
- Make a cache key from the text, voice and speed.
- If a WAV for that key already exists, reuse it. Otherwise generate it with Kokoro.
- Measure the clip's duration.
- Write the duration into the timeline so the visuals for that beat last exactly as long as the speech.
This beat-level approach gives me three benefits. Changing one sentence only regenerates one clip. The video timing comes straight from the audio, so I never stretch visuals by hand. And I can check every beat on its own, which matters for the quality rules below.
Cleaning Text Before It Reaches the Model
Most of my early audio problems were not the model's fault. They came from text the model was never meant to read aloud. Now every line passes through a small normaliser first.
Numbers
Numbers like "2,000" or "0.85" can be read in odd ways. I convert them to words with the num2words library before synthesis, so the voice says what I mean. When this package was missing on one of my render runners, several jobs failed, so it is now pinned in the install step.
Brand names and acronyms
Product names, API terms and acronyms are the biggest risk. A tool name can be pronounced as a normal English word, and letters like "TTS" or "API" sometimes need help. I keep a small replacement dictionary that maps the written form to a speakable form only for audio. The on-screen text keeps the correct spelling.
Symbols and code
URLs, underscores, slashes and code snippets should never be spoken. My rule is simple: code goes on screen, and the narration describes it in plain words, like "the publish at field" instead of reading out raw syntax.
Making the Audio Sound Finished
Raw TTS output is usable but not ready for YouTube. After all the beats for a video are joined, I run a short audio finishing pass with ffmpeg:
- Loudness normalisation with ffmpeg's
loudnormfilter, targeting about −14 LUFS integrated with the true peak kept at or below −2 dBTP. This keeps my videos at a similar volume to each other. - Small gaps between beats so sentences don't run into each other. Too much silence makes Shorts feel slow, so I keep these short and trim long pauses.
- Background music kept low and ducked under the voice, or left out completely for Shorts.
Quality Checks I Run on the Voice
Because no human listens to every clip before a render, I added automatic gates. A video only moves forward when it passes them.
1. Speech recognition round-trip
I transcribe the finished narration with Whisper (the faster-whisper implementation) and compare the transcript with the script. If the match score falls below a threshold I set (0.85), something went wrong: a mispronounced word, a skipped phrase or a garbled number. This check catches more problems than I expected, and the same transcript is reused for captions.
2. Beat length limit
For Shorts, I fail the audio check if any single beat runs longer than about 6.5 seconds. A long beat usually means the line is too wordy and the screen stays on one visual for too long. The fix is almost always to split the sentence, not to speed up the voice.
3. Total duration
Each format has a target length. If the narration is far outside it, the script needs editing before anything is rendered.
Honest Limits of This Setup
Kokoro works well for clear, explanatory narration, but it has limits I want to be upfront about:
- Limited emotion control. You can choose the voice and speed, but you can't direct it like a voice actor. For excitement or emphasis I rely on visuals and on-screen text.
- Pronunciation needs supervision. New technical terms still need entries in my replacement list.
- Language coverage varies. The voices file includes some non-English voices, including a few Hindi ones, but I have only used English in production, so I can't vouch for the quality of the others yet.
- It is clearly synthetic. Listeners can tell. That is fine as long as you are open about it.
Disclose the AI Voice
Every Omilabs video says that the narration is a synthetic voice. YouTube also asks creators to disclose realistic altered or synthetic content in certain cases, and I prefer to be clear in the description regardless. Hiding it gains nothing and risks viewer trust. A clear line in the description, plus credit for who made the video, is enough.
What I Would Tell Someone Starting Today
- Start with one voice and keep it for the whole series.
- Generate audio per sentence or per beat, not per script, and cache it.
- Let audio duration drive your video timeline.
- Build a text normaliser early: numbers, acronyms, product names.
- Normalise loudness every time.
- Add a Whisper round-trip check so you catch errors without listening to every clip.
- Disclose the synthetic voice.
Conclusion
An open TTS model turned voiceover from the slowest part of my video work into an automatic step. The model itself was the easy part. Most of the effort went into the work around it: cleaning text, caching beats, normalising loudness and checking the result with speech recognition. If you build tutorials or Shorts with code, that surrounding pipeline is what makes a free voice sound reliable enough to publish week after week.
Written by Omkar Vijay Ghate, Mumbai.
More guides on this blog
Voice AI agents
- How to Reduce Latency in AI Voice Agents
- How to Write a System Prompt for an AI Voice Agent
- How to Test an AI Voice Agent Before Launch
- How to Read AI Voice Agent Call Logs
- Connecting AI Voice Agents to VICIdial and Asterisk
- Multilingual Voice AI for India
- Voice Cloning for Business in India
AI agents and automation
- What Is Agentic AI?
- How to Build an AI Agent Without Code
- How to Build a WhatsApp RAG Chatbot
- AI Workflow Automation with n8n
- Prompt Engineering Guide 2026
- AI Customer Service in India
- AI vs Human Customer Service
- The Future of Work with AI Agents
- AI and Human Creativity
YouTube automation
Comments
Post a Comment