Audio Timeline Gate (continue/stop)
Keep generating, or stop?
- should_continue
- should_stop
- is_last_segment_out
- cursor_frames_out_passthrough
- report
Some nodes do real work, and some just answer yes or no. IAMCCS_AudioTimelineGate is the second kind, and it's a good example of a decision node done right. In a chunked audio-to-video loop you need one place that looks at the remaining frames and says "make another segment" or "we're done" - otherwise the loop either runs past the end of your audio or stops one chunk early. This is that place.
It's embarrassingly simple under the hood, which is the point. You feed it three numbers:
remaining_frames_after- how many track-aligned frames remain after the current segment.effective_unique_frames- how many actually-new frames the current segment contributed.min_next_frames- the minimum left over that justifies generating another segment.
Then it computes: if there's nothing left after the current segment, it's the last one; if strict_stop_on_last is on (the default), it stops immediately when nothing remains; otherwise it keeps going as long as remaining_frames_after >= min_next_frames. Outputs are the two booleans-as-ints you'll actually wire: should_continue and should_stop, plus an is_last_segment_out flag and a passthrough cursor_frames_out for routing. The report string logs the full decision math, which is worth one glance the first time because "why did my loop stop?" is usually a wrong remaining_frames_after on the input, not a bug in the gate.
There are two optional inputs worth knowing: is_last_segment lets an upstream node (the pack's AudioExtensionMath) force the last-segment verdict explicitly, and cursor_frames_out is a pure passthrough - useful if you're threading a loop cursor through the chain and don't want to re-route around the gate.
Where it lives: it's the loop-termination piece of the IAMCCS audio timeline system. The AudioSegmentAutoPlanner gives you the plan, the generation makes a segment, and this gate decides whether to iterate. It's also handy completely standalone in any ComfyUI loop that needs a frame-based continue/stop signal.
Installing it: part of IAMCCS/IAMCCS-nodes, installed with the pack - ComfyUI Manager → search "IAMCCS", or cd ComfyUI/custom_nodes && git clone https://github.com/IAMCCS/IAMCCS-nodes.git and restart. No models, no extra dependencies, pure integer logic.
One honest note: this is the kind of node that makes sense in the author's pipeline and can feel like overkill elsewhere. If you're hand-wiring a loop, a couple of math nodes can do the same thing - but they'll do it with the off-by-one errors that this gate exists to prevent. The default min_next_frames of 1 means "generate another segment if even one frame remains," which is the behavior you want for a seamless tail. Raise it to e.g. 8 if you'd rather not burn a whole generation for a handful of frames - that's the real tuning knob here.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| remaining_frames_after | INT | 00–10000000 | Remaining track-aligned frames after the current segment. |
| effective_unique_frames | INT | 00–10000000 | Actual usable unique frames of the current segment. |
| min_next_frames | INT | 11–100000 | Minimum remaining frames required to justify creating another segment. |
| strict_stop_on_last | BOOLEAN | true | If true, stop immediately when nothing remains after the current segment. |
| is_last_segmentopt | INT | 00–1 | Optional explicit last-segment flag from AudioExtensionMath. |
| cursor_frames_outopt | INT | 00–10000000 | Optional passthrough cursor for downstream routing. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| should_continue | INT | — |
| should_stop | INT | — |
| is_last_segment_out | INT | — |
| cursor_frames_out_passthrough | INT | — |
| report | STRING | — |