📊 Auto Loop Calculator (TTS/Texto)
Turn one big script into per-scene chunks, one loop at a time
- current_text
- current_index
- total_chunks
- log
Here's a workflow shape that doesn't get enough tooling love: you've got a voiceover script - a page of narration, twenty scenes worth of text - and you want each scene generated and rendered in its own loop cycle, in order, then assembled. In a normal ComfyUI graph you'd either write twenty prompt nodes by hand or rig up a fragile indexing contraption. AutoLoopCalculatorTTS makes the whole script one input and lets the loop walk through it scene by scene.
It's called a "calculator" because inside the pack it plays the same role as the frame calculators - it reports how far the loop has progressed and what the current unit of work is. Only the unit here isn't frames, it's paragraphs (or sentences).
How it works
You paste your full text into the text field and pick a split_mode:
- Párrafos (Saltos de línea) - splits on blank lines. One paragraph per cycle. Good for scripts already broken into scenes.
- Frases (Puntos) - splits on sentence punctuation, then fuses tiny fragments back together so you don't get a one-word "scene." It enforces a minimum of ~5 words per chunk, which is the difference between useful sentences and junk.
On each cycle it pulls the chunk at the loop index, returns it as current_text, and - the important bit for the loop - updates the pack's globals to say "chunk N of M done." That's how the SequentialLoopTrigger knows whether to keep re-queuing. It also remembers that this is a "step by chunk" flow, so the stitcher doesn't double-count frames against a video timeline.
Inputs and outputs
text(STRING, multiline) - the whole script. Yes, just paste it all in.split_mode- the two-way enum above; defaults to paragraphs.current_loop_index(INT) - from SequentialLoopStart.
Outputs: current_text (STRING) - wire this into your prompt encoder or TTS node; current_index (INT) and total_chunks (INT) - your progress readouts; log (STRING).
The catch
The loop index is zero-based and the node clamps it to the chunk count, so the last cycle just repeats the final chunk rather than crashing - which means if you set it up wrong, the loop can silently loop on the last paragraph. Check total_chunks on the first run and make sure your trigger stops correctly. Also note the enum labels are in Spanish (the pack's author is Spanish-speaking): "Párrafos" is paragraphs, "Frases" is sentences. There's no English alias, so just remember those two.
Install
ComfyUI Manager → search "comfyui-sequential-batcher", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Meisoftcoltd/comfyui-sequential-batcher
Restart ComfyUI. No models, no audio dependencies needed for the text splitting itself. Pack-wide reminder: run ComfyUI without --highvram.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| split_mode | COMBO | Párrafos (Saltos de línea) | 2 options: Párrafos (Saltos de línea), Frases (Puntos) |
| current_loop_index | INT | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| current_text | STRING | — |
| current_index | INT | — |
| total_chunks | INT | — |
| log | STRING | — |