Docs /Templates/ sinapsis-kokoro

KokoroTTS

sinapsis-kokoroKokoroaudioaudio_generationkokorospeech

Python template · sinapsis_kokoro.templates.kokoro_tts

Overview

Template for text-to-speech (TTS) synthesis using the Kokoro 82M v1.0 model. This class handles the initialization of the TTS pipeline, speech generation, and packaging the output audio in the desired format.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-kokoro==1.0.0
uv pip install sinapsis-kokoro==1.0.0
uv add sinapsis-kokoro==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

speed

The speed at which the speech will be generated. Default is 1 (normal speed).

int | float
Optional
Default: 1
voice

The voice model to use for speech synthesis. Default is "af_heart". Notes: The list of languages and voices supported by Kokoro can be found at: https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md

typing.Literal['af_heart', 'af_alloy', 'af_aoede', 'af_bella', 'af_jessicaaf_kore', 'af_nicole', 'af_nova', 'af_river', 'af_sarah', 'af_sky', 'am_adam', 'am_echo', 'am_eric', 'am_fenrir', 'am_liam', 'am_michael', 'am_onyx', 'am_puck', 'am_santa', 'bf_alice', 'bf_emma', 'bf_isabella', 'bf_lily', 'bm_daniel', 'bm_fable', 'bm_george', 'bm_lewis', 'jf_alpha', 'jf_gongitsune', 'jf_nezumi', 'jf_tebukuro', 'jm_kumo', 'zf_xiaobei', 'zf_xiaoni', 'zf_xiaoxiao', 'zf_xiaoyi', 'zm_yunjian', 'zm_yunxi', 'zm_yunxia', 'zm_yunyang', 'ef_dora', 'em_alex', 'em_santa', 'ff_siwis', 'hf_alpha', 'hf_beta', 'hm_omega', 'hm_psi', 'if_sara', 'im_nicola', 'pf_dora', 'pm_alex', 'pm_santa']
Optional
Default: "af_heart"
device
typing.Literal['cpu', 'cuda']
Optional
Default: "cpu"
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
split_pattern

The regular expression pattern used to split the input text into smaller chunks. Default is r" +" (split on newlines).

str
Optional
Default: "\\n+"

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: KokoroTTS
  class_name: KokoroTTS
  template_input: InputTemplate
  attributes:
    speed: 1
    voice: af_heart
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "KokoroTTS"
    class_name: "KokoroTTS"
    attributes:
      speed: 1
      voice: "af_heart"
      device: "cpu"
      split_pattern: "\\n+"

Inheritance

Immediate parent: sinapsis_core.template_base.template.Template

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.