PyKokoro Documentation

PyKokoro is a request-centric Kokoro speech-synthesis engine. It accepts prepared speech requests and returns independent rendered waveforms. Parsing, speech planning, document semantics, timeline composition, and final-output mastering belong to the calling application and its other tools.

Contents:

Engine responsibilities

  • KokoroG2P prepared-text integration with explicit pronunciation languages, source-aligned overrides, and linguistic tokens

  • Kokoro voice, model, and style selection, including blends

  • Model token-capacity validation and opt-in sentence-level splitting for oversized requests, plus ONNX inference

  • Request-local timing reconstruction, waveform validation, tracing, and optional voice calibration

  • Independent RenderedSegment results and standalone WAV writing

Feature guides

PyKokoro does not parse SSMD or YAML, create UtterPlans or AudioJobs, compose separate caller requests, insert cross-request silence, or apply document-level effects. The v0.10.0 breaking boundary and migration examples are described in the release note.

Quick example

from pykokoro import GenerationConfig, KokoroSynthesizer, SynthesisConfig

config = SynthesisConfig(
    voice="af_sarah",
    generation=GenerationConfig(lang="en-us"),
)
with KokoroSynthesizer(config) as synthesizer:
    result = synthesizer.synthesize_text("Hello, world.", language="en-us")
result.save_wav("hello.wav")

See the maintained examples for requests with pronunciation context, linguistic tokens, and independent batch results.