ꘇ chop.switch
Pick a source, or blend between two
- sources
- channels
- value
ꘇ chop.switch is an A/B selector for signal sources, with a trick: in float mode the index isn't a choice, it's a crossfade. Index 2.5 doesn't mean "the third source", it means "70% of the third, 30% of the fourth" - which turns a switch into a morph and makes it possible to animate between two completely different control sources.
What it is
The plumbing doc splits the switch family in two: A/B switches with a selector, and fallback switches that pass the first non-empty input. This is the first kind, deliberately - you point it at a source. But it's a wireless switch, which is the part people miss on first read, and it's the mechanism that makes it more than a wiring convenience. Drop an LFO on the index and you're crossfading between an oscillator and a MIDI CC. That's the sort of thing a TouchDesigner user takes for granted and a ComfyUI graph normally has no vocabulary for.
The design also follows the author's own note that TouchDesigner-ish naming is used for discoverability but the interface follows this pack's compact controls, which is why it's one node with an autogrowing socket list rather than a chain of merge/select hacks.
How it works
Sources are numbered sockets, source0, source1, source2…, and more appear as you connect them (up to 64). The index is clamped into range, floored to pick the low side, and - in float mode - the fractional part becomes the blend factor against the next source. In int mode the fraction is discarded, so a value of 2.9 selects 2 and a value of 0.4 selects 0. Non-finite indexes raise rather than guessing.
Two implementation details decide whether it works for you.
The index counts connected sources in socket order, not socket names. Unconnected sockets are skipped when the list is built, so if you unplug source0 then index 0 silently becomes your old source1. That's a plausible-cause for "why did my switch change behaviour when I deleted a wire", and there's no warning for it.
Blending requires matching channel names. The blend path compares the two blocks and raises "CHOP switch requires matching channel names" if their channel sets differ. It also resamples the second block's samples to the first block's length. This is why a morph between an oscillator (channels chan0) and a merged block with named channels (rms, peak) won't work - line those up with ꘇ chop.select upstream, or both through the same processor, before they meet here.
When nothing is connected at all, the node says so in its status line rather than producing silence you'd have to hunt for: "Connect CHOP sources", or "Waiting for selected CHOP source" if the chosen one is empty.
The inputs and outputs that matter
- sources - an autogrowing list of optional
GENERETI_CHOPinputs, prefixsource, minimum 1, up to 64. Optional, so you can leave gaps… except that gaps shift the indices, as above. - mode -
intorfloat. Int floors, float blends adjacent sources. - index - FLOAT default
0, 0..63, step0.01. The author's tooltip is the authoritative description: "Zero-based index of connected sources; int floors, float blends adjacent sources. Clamped to available sources." - channels out - the selected (or blended) block.
- value out - FLOAT, last sample of the first channel. Wire it into a numeric widget; wire an oscillator into
indexto animate the selection.
Install
Every node described here ships in the genereti pack. Manager → search genereti (title "ꘇ Genereti") → install → restart ComfyUI → hard-refresh the browser. Manual:
cd ComfyUI
git clone https://github.com/languel/genereti.git custom_nodes/genereti
./.venv/bin/python -m pip install -r custom_nodes/genereti/requirements.txt
Use your ComfyUI's Python for the pip line. Requirements are a single frontend pin, comfyui-frontend-package>=1.53.6; this pack deliberately doesn't bring torch, models or a model server along with it, which is unusual enough in the ComfyUI ecosystem to be worth pointing out - most node packs you install will reinstall more than this one does.
Common issues
You removed a wire and the switch aims somewhere else. Indices count connected sources. Re-check the numbering after any edit, or keep source0 occupied.
"Channel names don't match" on a blend. Set mode to int, or make the two sides expose the same channel names before they reach this node.
It only ever picks the first source. index needs to move. In int mode it needs to move by whole numbers - an oscillator swinging 0..1 across two sources will look like it's mostly not switching, because for most of the cycle it's flooring to 0. Give it a stepped source (ꘇ chop.logic output, or a square wave from ꘇ chop.oscillator) when you actually want hard cuts.
One frozen block on Queue. Live sources run in the browser; the queue evaluates explicit samples. A switch whose index is driven live will look static in a batch run.
Alpha, per the README. Super alpha, early classroom testing, back up workflows before pack updates.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 2 options: int, float | |
| index | FLOAT | 0.000–63 | Zero-based index of connected sources; int floors, float blends adjacent sources. Clamped to available sources. |
| sourcesopt | COMFY_AUTOGROW_V3 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| channels | GENERETI_CHOP | — |
| value | FLOAT | — |