ComfyUI Node

TS CosyVoice Dialog

Write a script, get a four-voice scene with every speaker on its own track

By AlexYez·Created 5 months ago·Updated about a month ago· 3
TS CosyVoice Dialog
  • model
  • speaker_A_Audio
  • speaker_B_Audio
  • speaker_C_Audio
  • speaker_D_Audio
  • dialog_audio
  • speaker_a_audio
  • speaker_b_audio
  • speaker_c_audio
  • speaker_d_audio
  • message
dialog_textSPEAKER A: Hello, how are you? SPEAKER B: I'm doing great, thanks for asking!
speed1.00
seed42

TS CosyVoice Dialog is the multi-speaker scene node: paste a script in SPEAKER A: ... / SPEAKER B: ... format, feed it a reference clip for each voice, and it renders the whole conversation - plus every speaker on its own track. It's the node you reach for when your visual novel, animated short, or radio-play mockup needs two to four distinct voices trading lines without you stitching audio together by hand.

The script format is the whole interface:

SPEAKER A: Hi, how are you?
SPEAKER B: I'm great, thanks for asking!
SPEAKER A: What did you do today?
SPEAKER B: Recorded a new podcast episode.

How it works

The node parses your dialog_text line by line, mapping SPEAKER A: through SPEAKER D: to the reference clips you provide. Each speaker's reference audio is prepared (trimmed to a 30-second max, and transcribed for the prompt text via Whisper if you didn't supply it elsewhere), then every line is generated individually with that speaker's voice. Lines are synthesized one at a time and assembled twice: once into a per-speaker track, once into a single mixed dialog_audio. It's deliberately built so each speaker's track is a separate output - that's what makes it usable in a DAW afterward instead of being stuck with one merged file.

The inputs that matter

  • dialog_text - the script. Must use the SPEAKER A: / SPEAKER B: prefixes; mislabelled lines are skipped with a warning, and a script with no valid lines returns an explicit error instead of a silent short render.
  • speaker_A_Audio / speaker_B_Audio - required references. The tooltips suggest 3–10 seconds, hard max 30.
  • speaker_C_Audio / speaker_D_Audio - optional. Two-voice scenes only need A and B; a line for an un-supplied speaker gets skipped and logged.
  • speed and seed - the usual suspects.

Outputs

Six of them, and they're the point:

  • dialog_audio - the final mix.
  • speaker_a_audio / speaker_b_audio / speaker_c_audio / speaker_d_audio - each voice isolated.
  • message - a status string with diagnostics like line counts and duration.

Wire the mix straight to Save Audio, or grab the individual tracks if you're mixing in a DAW. Cancellation works between lines, so a long script isn't a single uninterruptible inference.

Installing

ComfyUI Manager (search TS CosyVoice) or:

cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-ts-cosyvoice.git
cd comfyui-ts-cosyvoice
pip install -r requirements.txt

Plus one ONNX Runtime (onnxruntime-gpu on NVIDIA, onnxruntime otherwise) and CUDA torch before the pack's deps. If you want the per-speaker auto-transcription, pip install openai-whisper and ffmpeg on PATH - optional, but the prompt anchor matters for clone quality.

Troubleshooting

  • A line vanishes from the render - check the log for "no audio reference provided" or "unrecognised line." Fix the prefix or wire in the missing speaker.
  • Output comes back with empty speaker tracks - you referenced a SPEAKER C: line but never supplied speaker_C_Audio.
  • Voices sound off - same reference-quality rules as the rest of the pack: clean, one speaker, no music or reverb.
  • It's slow - a long script is many separate inferences. That's the design; each line is its own generation.

If you've ever hand-stitched four TTS takes together in an editor, this node deletes that whole job. Write the script, pick the voices, export the stems.

CategoryTS CosyVoice3/Synthesis

Inputs (8)

NameTypeDefaultDescription
modelCOSYVOICE_MODELЗагруженная модель CosyVoice из ноды загрузчика.
dialog_textSTRINGSPEAKER A: Hello, how are you? SPEAKER B: I'm doing great, thanks for asking!Текст диалога с репликами вида SPEAKER A:, SPEAKER B: и так далее.
speaker_A_AudioAUDIOРеференсный голос для SPEAKER A; желательно 3-10 секунд, максимум 30 секунд.
speaker_B_AudioAUDIOРеференсный голос для SPEAKER B; желательно 3-10 секунд, максимум 30 секунд.
speedFLOAT1.000.5–2Множитель скорости речи для всех реплик в диалоге.
speaker_C_AudiooptAUDIOНеобязательный референсный голос для SPEAKER C.
speaker_D_AudiooptAUDIOНеобязательный референсный голос для SPEAKER D.
seedoptINT42-1–2147483647Зерно случайности; значение -1 использует случайный seed.

Outputs (6)

NameTypeDescription
dialog_audioAUDIO
speaker_a_audioAUDIO
speaker_b_audioAUDIO
speaker_c_audioAUDIO
speaker_d_audioAUDIO
messageSTRING