Nodes/IAMCCS-nodes/Segment Switch (by segment_index)
ComfyUI Node

Segment Switch (by segment_index)

A per-segment switch that routes different prompts to different LTX chunks

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
Segment Switch (by segment_index)
  • default_value
  • segment_01
  • segment_02
  • segment_03
  • segment_04
  • segment_05
  • segment_06
  • value
  • active_slot
  • report
modesingle_prompt
segment_index0

When you're generating a song-length LTX-2 video in segments, the last thing you want is the same prompt on every chunk. Verse, chorus, bridge, drop - each segment should get its own conditioning. IAMCCS_SegmentSwitch is the node that makes that mechanical: it picks one of up to six per-segment values based on the current segment_index and hands it downstream.

It's deliberately generic - it's an any-type switch, so the thing you're switching can be a prompt string, a conditioning, an image, even a latent. Most people use it for per-segment text, but nothing stops you from switching reference images per segment.

How it works

Two modes, and the naming is a little backwards so pay attention. In single_prompt mode it ignores everything and just passes default_value through. In by_segment mode it takes segment_index, adds 1, and looks up segment_{index+1:02d} - so index 0 reads segment_01, index 4 reads segment_05. If the matching slot isn't connected, it falls back to default_value rather than erroring. That fallback is the safety net that keeps loops from dying the moment you run more segments than you wired slots for.

It also reports which slot it chose via active_slot (0 for fallback) and a report string, so you can see at a glance whether segment 6 actually got its own prompt or silently reused the default.

Inputs and outputs

  • default_value - the always-connected input, and the fallback when no slot matches.
  • mode - single_prompt or by_segment.
  • segment_index - drive this from your loop (or from the segment_index_out of a SegmentPlanner).
  • segment_01 through segment_06 - the per-segment values, all optional and all any-type.

Outputs: value (the chosen input), active_slot, report.

A natural pairing: SegmentPlannersegment_index_out → this node's segment_index, with six prompt strings wired into the slots, and the output feeding your conditioning/prep chain. Six slots is the cap - if your song needs more than six distinct segments' worth of variety, group segments or use the fallback creatively.

Installing

Same pack as the rest of the LTX-2 family: ComfyUI Manager → search "IAMCCS", or

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

then restart. Pure routing logic - no models, no downloads.

Gotchas

Two things trip people up. First, the slot-to-index mapping is 1-based in the name but 0-based in the index: segment_index = 3 reads segment_04. It's obvious once you see it, maddening until you do. Second, remember mode has to be by_segment - the default is single_prompt, which quietly ignores all six slots and passes the default through, which looks like the switch "not working." And since unconnected slots fall back to default instead of erroring, it's easy to ship a workflow where segments 3–6 silently share a prompt. The active_slot output exists precisely so you can check.

CategoryIAMCCS/LTX-2

Inputs (9)

NameTypeDefaultDescription
default_value*
modeCOMBOsingle_prompt2 options: single_prompt, by_segment
segment_indexINT00–100000
segment_01opt*
segment_02opt*
segment_03opt*
segment_04opt*
segment_05opt*
segment_06opt*

Outputs (3)

NameTypeDescription
value*
active_slotINT
reportSTRING