---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Kokoro-82M Local Apache 2.0 TTS Batch Skill"
description: "Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex how to synthesize zero-API-cost commercial voiceovers locally using Apache 2.0 Kokoro-82M (82M params, runs on CPU or GPU), resample native 24 kHz WAV outputs to broadcast 48 kHz stereo, normalize to -14 LUFS, and emit exact scene duration manifests."
canonical: "https://framesfield.com/skills/kokoro-local-apache-tts-batch-skill"
---

# Kokoro-82M Local Apache 2.0 TTS Batch Skill

> Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex how to synthesize zero-API-cost commercial voiceovers locally using Apache 2.0 Kokoro-82M (82M params, runs on CPU or GPU), resample native 24 kHz WAV outputs to broadcast 48 kHz stereo, normalize to -14 LUFS, and emit exact scene duration manifests.

- **Canonical URL:** https://framesfield.com/skills/kokoro-local-apache-tts-batch-skill
- **Raw Payload URL:** https://framesfield.com/raw/skills/kokoro-local-apache-tts-batch-skill
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** Kokoro-82M (Apache 2.0) / Python / FFmpeg
- **License:** MIT
- **Last Verified:** 2026-12-01

## Setup & Install

```bash
mkdir -p .claude/skills/kokoro-local-tts-batch && curl -fsSL https://framesfield.com/raw/skills/kokoro-local-apache-tts-batch-skill -o .claude/skills/kokoro-local-tts-batch/SKILL.md

```

## Copyable Asset (SKILL.md)

````markdown
---
name: kokoro-local-tts-batch
description: Generate zero-API-cost offline commercial narration batches using Apache 2.0 Kokoro-82M on CPU or GPU, resample native 24 kHz PCM WAV to broadcast 48 kHz stereo via FFmpeg, normalize to -14 LUFS integrated (-1.0 dBTP), and write a scene timing manifest JSON for video editors or Sync Lipsync 2.0. Use when producing NDA rough cuts, faceless explainers, or high-volume narration without cloud TTS fees.
---

# Kokoro-82M Local Apache 2.0 TTS Batch Playbook

## 1. Environment Check & One-Time Setup
Verify Python 3.10+, `espeak-ng` (phonemizer), `kokoro`, `soundfile`, and `ffmpeg` before rendering:
```bash
# macOS Homebrew: brew install espeak-ng ffmpeg
# Python venv:    pip install -q kokoro soundfile
python3 -c "import kokoro, soundfile; print('kokoro ready')"
```
If the user wants zero local Python setup, fall back cleanly to fal.ai `fal-ai/kokoro/american-english` (`$0.02 / 1,000 chars`) and note the exact cost first.

## 2. Batch Render Native 24 kHz Stems per Scene
Write a clean deterministic runner reading `scenes.json` (`[{"id":"s01","voice":"af_heart","speed":1.0,"text":"..."}]`):
```python
import json, pathlib, numpy as np, soundfile as sf
from kokoro import KPipeline

out_dir = pathlib.Path("audio_raw_24k")
out_dir.mkdir(exist_ok=True)
pipe = KPipeline(lang_code="a")  # 'a' American EN, 'b' British EN, 'e' ES, 'f' FR, 'j' JA

for row in json.loads(pathlib.Path("scenes.json").read_text()):
    chunks = [audio for _, _, audio in pipe(row["text"], voice=row.get("voice", "af_heart"), speed=row.get("speed", 1.0))]
    wav = np.concatenate(chunks)
    sf.write(out_dir / f"{row['id']}.wav", wav, 24000, subtype="PCM_16")
```

## 3. Mandatory Broadcast Conform (24 kHz → 48 kHz Stereo, -14 LUFS)
Never drop raw 24 kHz mono WAV straight into a 48 kHz video timeline (prevents NLE resampling artifacts and uneven volume). Conform every scene stem with FFmpeg and log exact duration:
```bash
mkdir -p audio_master_48k
for f in audio_raw_24k/*.wav; do
  base=$(basename "$f")
  ffmpeg -y -i "$f" \
    -af "aresample=48000,pan=stereo|c0=c0|c1=c0,loudnorm=I=-14:TP=-1.0:LRA=11" \
    -c:a pcm_s16le -ar 48000 "audio_master_48k/$base"
  dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "audio_master_48k/$base")
  echo "$base -> ${dur}s (48kHz stereo -14 LUFS)"
done
```

## 4. Verification Gate
Confirm every stem exists, is non-silent, matches `sample_rate=48000` and `channels=2`, and emit `audio_manifest.json` containing scene IDs and exact durations in seconds so downstream Remotion, FFmpeg beat-sync, or Sync Lipsync 2.0 jobs align cleanly.
````

## Example Input

```text
Synthesize our 6-scene documentary script in scenes.json using local Apache 2.0 Kokoro-82M (voice af_heart, speed 1.0), conform every stem to 48 kHz stereo WAV at -14 LUFS, and output audio_manifest.json with exact durations.
```

## Expected Output

```text
Rendered 6 local Kokoro-82M stems at $0.00 API cost (48 kHz stereo PCM_16, -14 LUFS).
Manifest: s01.wav (5.84s), s02.wav (6.12s), s03.wav (5.40s), s04.wav (6.31s), s05.wav (5.92s), s06.wav (5.68s) -> Total 35.27s.
```

## Requirements

- Python 3.10+, `kokoro`, `soundfile`, and `espeak-ng` installed locally (CPU or GPU; ~330 MB weights)
- Local FFmpeg 6+ installed for 24 kHz → 48 kHz stereo resampling and `-14 LUFS` normalization

## Known Limits

- Kokoro-82M uses curated voice packs rather than arbitrary zero-shot voice cloning—switch to ElevenLabs TTS when cloning a specific client spokesperson
- Spell out large numbers, currency amounts, and rare acronyms cleanly in scenes.json before synthesis

## Implementation Notes

## Zero-cost commercial narration without cloud uploads

For NDA client rough cuts, faceless explainer channels, and automated Remotion video pipelines, paying `$0.08/1k chars` on cloud TTS across dozens of script revisions adds friction and exposes unreleased scripts to third-party servers. [Kokoro-82M](/specs/kokoro-82m) solves both problems with an **82-million-parameter Apache 2.0 model** that generates clean speech faster than real time right on your laptop CPU.

Use this skill alongside our [Talking-Head Explainer & Lip-Sync Voice Swap workflow](/workflows/talking-head-explainer-and-lip-sync-dub-pipeline) or pair it with our [Faceless Explainer & Documentary Script-to-Shotlist Builder](/skills/faceless-explainer-and-documentary-script-builder) to turn a text outline into broadcast-ready 48 kHz `-14 LUFS` stems in one command.
