Kokoro

Description

The Kokoro node performs high-quality, lightweight Text-to-Speech (TTS) synthesis using the open-source Kokoro TTS engine. It converts incoming text into natural-sounding spoken audio, supporting multiple languages and distinct voice profiles (male and female).

Kokoro is designed for fast inference and excellent prosody, making it a powerful alternative to standard Windows TTS or heavier AI models. It is ideal for voice assistants, multilingual workflows, reading AI outputs aloud, or generating audio content locally without relying on cloud APIs.


Configuration Properties

🌐 Language Section

ComboBox
Selects the target language for the synthesis. This is the first and most important step, as it dynamically filters the available voices in the next dropdown.

Supported languages include:

  • Français (fr)
  • English (US) (en)
  • English (UK) (en-gb)
  • Español (es)
  • Italiano (it)
  • Português (Brasil) (pt)
  • हिन्दी (Hindi) (hi)
  • 日本語 (Japanese) (ja)
  • 中文 (Mandarin) (zh)

💡 Tip: Always select the language first. If you change the language, the voice selection will automatically reset to the first available voice for that new language.


🎙️ Voice Section

ComboBox
Selects the specific voice profile to use. The list is populated based on the chosen language. The dropdown displays a human-readable name (e.g., "Siwis (Féminin)", "Heart (Female)", "Kumo (男性)"), but the node internally saves the unique voice code (e.g., ff_siwis, af_heart, jm_kumo).

  • English (US) offers the widest variety (e.g., Heart, Alloy, Bella, Adam, Michael, Onyx).
  • English (UK) includes voices like Alice, Emma, Daniel, George.
  • Other languages have specialized voices (e.g., "Siwis" for French, "Xiaoxiao" for Mandarin).

🔊 Volume Section

TrackBar / Slider
Adjusts the playback volume. The interface scales the value from 0 to 10, which the node internally converts to a float between 0.0 (silent) and 1.0 (maximum volume).


📤 Output Mode Section

Pass Through Input Text (CheckBox)

  • When checked: The node sends the original input text to its output unchanged, while simultaneously playing the audio. This is useful when you want to hear the result but also need to pass the text downstream (e.g., to an Output node for display or a File Write node for logging).
  • When unchecked: The node acts purely as a side-effect. It plays the audio and sends nothing downstream, effectively ending that branch of the workflow.

Usage Example

"Multilingual AI Assistant":

  1. An Agent node is prompted to translate a user's input into French.
  2. A Kokoro node is configured with:
    • Language: Français
    • Voice: Siwis (Féminin)
    • Volume: 8 (80%)
    • Pass Through: unchecked
  3. The French translation is spoken aloud naturally, and the workflow branch ends.

"Read and Log Workflow":

  1. A File Read node loads a news article.
  2. A Kokoro node with Language: English (US), Voice: Heart (Female), and Pass Through checked.
  3. The article is read aloud.
  4. An Output node receives the text via the pass-through and displays it on the canvas for the user to read along.

Pitfalls to Avoid

⚠️ Language/Voice Mismatch: If you manually type or paste a voice code (e.g., ff_siwis) but change the Language dropdown to 日本語, the node may fail to synthesize or produce unexpected results. Always ensure the selected voice belongs to the selected language group.

⚠️ Pass Through Timing: When Pass Through is checked, the text is sent downstream immediately. Depending on the audio playback implementation, the audio might continue playing in the background while the next nodes execute. Do not rely on the audio finishing before the next node starts unless specifically designed to do so.

⚠️ Model Dependencies: Like the Orpheus node, Kokoro requires specific model files (e.g., .onnx or .bin files) to be present in the Datas folder relative to the TzuFlow executable. If these files are missing, the node will throw an error. Ensure you have downloaded the required Kokoro assets.

⚠️ Punctuation Matters: Kokoro, like most TTS engines, relies heavily on punctuation (commas, periods, question marks) to determine pacing, pauses, and intonation. Ensure the text sent to this node is properly formatted, especially if it comes directly from an LLM that might omit punctuation.

⚠️ Empty Input: If the node receives an empty string, it will not play any audio. If Pass Through is checked, it will simply pass the empty string downstream. Use a Filter or Switch node upstream if you need to prevent empty audio triggers.