Nodes/ComfyUI-KokoroTTS-Zh/KokoroTTSGenerator
ComfyUI Node

KokoroTTSGenerator

Where the speech happens — and the save step that isn't

By ruanjianlun·Created about a year ago·Updated about a year ago· 2
KokoroTTSGenerator
  • model
  • pipeline
  • text
  • voice_settings
  • audio
  • filename
output_filenamekokoro_output.wav
speed_modeauto
fixed_speed1.0

This is the payoff. KokoroTTSGenerator takes the model, pipeline, text, and voice settings from the other three nodes in this pack and actually turns them into audio. It's the only node here that produces something you can hear, and it's also the one with the gotcha that quietly surprises people: it hands you audio, but it does not save the file itself.

What it is

The terminal stage of the Kokoro chain. Whatever you're building - Chinese narration on a video, voiceover for a slideshow workflow, a character voice for a talking head - this is where the text you typed becomes a waveform. Kokoro's whole appeal is that this stage is cheap: the model is tiny and runs in real time, so regenerating to fix a pronunciation is nothing.

How it works - and the save gotcha

The node walks your paragraphs from KokoroTextInput sentence by sentence, runs each through the pipeline with the chosen voice and a speed callback, inserts silence_between_paragraphs between paragraphs, and concatenates everything into one waveform. What comes out the audio output is a standard ComfyUI AUDIO object - a waveform tensor plus a sample_rate of 24000 - which is exactly what the core PreviewAudio and SaveAudio nodes expect.

Here's the part the README's "generate and save audio" framing overpromises: in the shipped source, the node never writes the wav. The filename output is the full path it would use (your output_filename joined onto ComfyUI's output directory, with .wav appended if you forgot it), but the actual writing is on you. Wire audio into PreviewAudio to hear it, or SaveAudio to keep it. The pack's own example workflow uses PreviewAudio. The filename output is more of a promise than a write, and the community's pain with TTS-in-ComfyUI clusters exactly here - getting the audio to land in a file with a sensible name.

The inputs

Seven inputs, but only three you'll regularly touch:

  • model, pipeline, text, voice_settings - the four typed wires from the loader, text input, and voice selector. No defaults; the graph isn't complete without all four.
  • output_filename - default kokoro_output.wav. A fixed name, so repeated runs would overwrite. Since this node doesn't write anyway, let SaveAudio handle prefixes, or change the name per run if you're wiring the string elsewhere.
  • speed_mode - auto or fixed. Auto is the interesting one: it applies a piecewise speed curve that keeps short sentences near normal pace and slows long ones down. That's not stylistic - Kokoro's training data runs out past roughly a hundred tokens and it starts rushing, so the curve is there to keep long narration from sounding like an auctioneer. Fixed just uses fixed_speed.
  • fixed_speed - 0.5 to 2.0, default 1.0, step 0.1. Only matters in fixed mode.

The outputs

Two outputs: audio (AUDIO) and filename (STRING, the absolute path). The string is easy to ignore unless something downstream wants the path. The audio is the whole point.

Installing

Same pack, one install - ComfyUI Manager, search "ComfyUI-KokoroTTS-Zh", install, restart; or git clone https://github.com/ruanjianlun/ComfyUI-KokoroTTS-Zh into custom_nodes and pip install -r requirements.txt. Restart, and all four nodes appear under KokoroTTS. If the Chinese pipeline throws a G2P error at load time, your misaki install is missing the zh data - pip install "misaki[zh]>=0.8.1" fixes it.

Try the pack's bundled example workflow (example_workflows/kokoro-zh-basic.json) first - it's wired exactly right, loader → text → voice → generator → PreviewAudio, so you get to hear Kokoro before you start rearranging things.

CategoryKokoroTTS

Inputs (7)

NameTypeDefaultDescription
modelKOKORO_MODEL
pipelineKOKORO_PIPELINE
textKOKORO_TEXT
voice_settingsKOKORO_VOICE_SETTINGS
output_filenameSTRINGkokoro_output.wav
speed_modeCOMBOauto2 options: auto, fixed
fixed_speedFLOAT1.00.5–2

Outputs (2)

NameTypeDescription
audioAUDIO
filenameSTRING