Conditional Branch Audio (Lazy)
A/B Your TTS Engines Without Running Both
- input_if_true
- input_if_false
- output
This is a two-wire switch: give it a boolean, feed it two audio streams, and it passes one through to the output. On its own that would be trivial. What makes it worth having is the word in its name - lazy - because it decides which branch to compute before anything downstream runs.
Here's the mechanism. ComfyUI nodes normally execute every input chain, whether you use the result or not. ConditionalBranchAudio implements check_lazy_status, which tells ComfyUI "I don't need both of these, only the one my condition picks." When condition is true, the node requests input_if_true and everything upstream of it; input_if_false - and the whole graph feeding it - never executes. Flip the boolean and you skip the other side entirely.
Why does that matter in this pack? The bundled example workflow routes two full TTS chains - CosyVoice and FishSpeech - into this one node, then into a single SaveAudioAdvanced, so you can A/B the engines on the same reference audio and text. Without lazy evaluation, every run would fire both engines and throw away the loser. With it, toggling the boolean is nearly instant, because the engine you're not looking at doesn't run. On a pack where each engine drags along its own heavyweight runtime, that's the difference between a quick comparison and waiting on a synth run you're about to discard.
Inputs and output
condition- BOOLEAN, the switch. Drive it from a primitive or a toggle and you get a mute/A-B style control.input_if_true- AUDIO, selected when condition is on.input_if_false- AUDIO, selected when condition is off.output- AUDIO, whatever branch won.
Keep both branches fed. The lazy machinery only requests the branch you pick, so if the winning side is left unconnected, the node hands back nothing and your save node chokes on an empty clip. When in doubt, route both engines through it (or wire the same source into both inputs) so either selection is valid.
It's listed under TTS/FishSpeech because that's what the pack uses it for, but it's generic - it works on any AUDIO from any pack, so it's also a decent poor-man's mute or source switcher for VHS-style audio work.
Gotchas
- It is not an output node. Wire
outputintoSaveAudioAdvanced(the sample writes Opus/MP3/FLAC) or another audio sink. - The lazy behavior is a feature with a side effect: if you actually wanted both branches rendered - say, exporting both engines to disk in one pass - this node won't do it. It's a router, not a "render everything" node.
Install is the shared pack story: clone Dlight160/comfyui-tts-pack with --recursive into ComfyUI/custom_nodes/, set up the Python 3.12 env with the pack's CUDA 12.8 constraints, then use this node the way the sample workflow does - both engines in, one output out.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| condition | BOOLEAN | false | — |
| input_if_trueopt | AUDIO | — | |
| input_if_falseopt | AUDIO | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | AUDIO | — |