XB-BOX - 🗣️ CosyVoice3 说话人克隆
Synthesize in a saved voice, no reference audio required
- model
- audio
This is the node you use once you've gotten past the fun part (cloning a voice) and reached the productive part (using that voice over and over). SpeakerClone reads a saved speaker preset from disk and synthesizes any text in that voice, with no reference audio in the graph at all.
Think of it as the playback side of a voice library. You save a voice once with XB_CosyVoice3_SaveSpeaker, and from then on every workflow that wants that narrator, that character, that recurring host just picks it from a dropdown. Swap voices by swapping presets, not by rewiring audio clips.
How it works
The node scans ComfyUI/models/cosyvoice/speaker/ for .pt files and populates its speaker_preset dropdown from whatever it finds. Pick one, type your text, and it loads the file, injects the saved embedding into the model's frontend (spk2info), and calls inference_zero_shot with the zero_shot_spk_id pointing at your preset. That's the model's own code path for speaker-preset synthesis - the same one CosyVoice's CLI uses when you pass a spk2info file - so quality matches the reference implementation, minus the reference audio.
Because the embedding is already extracted, this is faster than live zero-shot cloning and, more importantly, deterministic in setup: the voice can't drift between runs because you used a slightly different clip.
The inputs that matter
- speaker_preset - the dropdown of saved voices. If it only shows
[none], you haven't saved a speaker yet; runSaveSpeakerfirst. That placeholder is the node's way of telling you the pipeline order is wrong. - text - what to synthesize. Multiline, no character limit complaints; long text gets chunked and re-stitched automatically.
- speed - 0.5x to 2.0x. Beyond ~1.2x things start sounding rushed in most voices.
- seed - default 42. Set it if you want the same take back;
-1for variety. - text_frontend - on by default. Off only for CMU phoneme input or special tags.
Output is a single audio (AUDIO) wire - straight into a preview, a saver, or a downstream lip-sync / digital-human pipeline.
Install and gotchas
Standard pack install: ComfyUI Manager (search XB_ToolBox) or git clone https://github.com/wjluoxiao/XB_ToolBox.git into custom_nodes, restart, and make sure the CosyVoice dependency stack from requirements.txt is installed.
The ordering trap is the classic one: the dropdown is built when the node loads, so if you save a new speaker while a workflow with SpeakerClone is already open, the new voice won't show up until you refresh or reload the workflow. And [none] isn't a bug - it's the node correctly telling you the speaker directory is empty.
Where people get burned: preset names with periods or spaces are fine (the code strips the extension cleanly), but two presets named the same way from different machines will collide. Also remember the preset only captures the voice - the emotion, pace, and energy of the original clip are not baked in. That's what SpeakerInstruct2's instruction text is for, and it's the difference between a flat reading and a performance.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COSYVOICE_MODEL | — | |
| text | STRING | Hello, this is my cloned voice speaking. | — |
| speaker_preset | COMBO | 1 options: [none] | |
| speed | FLOAT | 1.000.5–2 | — |
| seedopt | INT | 42-1–2147483647 | — |
| text_frontendopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |