Nodes/comfyui-sequential-batcher/AutoLoopCalculatorTTSBatch
ComfyUI Node

AutoLoopCalculatorTTSBatch

Walk through many scripts, not just one

By Meisoftcoltd·Created 7 months ago·Updated 18 days ago· 3
AutoLoopCalculatorTTSBatch
    • current_text
    • current_index
    • total_chunks
    • current_file_name
    • log
    text_list
    file_names
    split_modePárrafos (Saltos de línea)
    current_loop_index

    The single-script TTS calculator handles "one long script, many scenes." But what if you have many scripts - a folder of narration files, each needing its own scene-by-scene walkthrough? That's the shape AutoLoopCalculatorTTSBatch exists for. It's the batch-aware sibling: it consumes a list of texts plus their file names, and it walks both levels of the loop - file by file and chunk by chunk within each file.

    Think of the difference this way: AutoLoopCalculatorTTS is a page-turner for one book; this one works through a whole shelf, resets the page counter when it starts a new book, and tells the trigger when the shelf is empty.

    How it works

    It takes text_list and file_names as list inputs (the pack's AUDIO_LIST/STRING_LIST machinery in text form) plus the loop index and split mode. The current file is selected by the pack's batch index, and within that file the same paragraph/sentence splitting runs as the single-file version:

    • Párrafos (Saltos de línea) - paragraphs, one per cycle.
    • Frases (Puntos) - sentences, with a ~5-word minimum fused together so you don't render a two-word "scene."

    The key coordination it does: it updates both the per-file chunk counter and the global_has_more_batches flag. When a file's chunks are done, the loop trigger resets the loop index to 0 and advances to the next file; when the last file's last chunk is done, the trigger stops for good. That two-level state is exactly what makes the auto-queue terminate correctly on a batch.

    Inputs and outputs

    • text_list (STRING) and file_names (STRING) - the lists, wired from a folder loader.
    • split_mode - the same Spanish-labeled enum (Párrafos / Frases).
    • current_loop_index (INT) - from SequentialLoopStart.

    Outputs: current_text (STRING), current_index (INT), total_chunks (INT), current_file_name (STRING) - so downstream nodes know which file they're rendering - and log.

    Where it fits

    Pair it with BatchAudioFolderLoader + AudioBatchSelector from the same pack: folder → audio list for the TTS side, and the parallel text list for this calculator. The batch index stays in sync between the audio selector and this node, which is the whole trick - one loop drive, two parallel walks (audio files and their scripts).

    Honest note: the input types are generic strings rather than true list types, so the wiring is slightly looser than the audio side. Check total_chunks and current_file_name on the first cycle to confirm the list arrived intact - it's the one failure mode that's easy to misdiagnose.

    Install

    ComfyUI Manager → "comfyui-sequential-batcher", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Meisoftcoltd/comfyui-sequential-batcher
    

    Restart ComfyUI. No model downloads. And as always with this pack: launch without --highvram so the loop's memory cleanup actually runs between cycles.

    Category🔁 Sequential Batcher/Text

    Inputs (4)

    NameTypeDefaultDescription
    text_listSTRING
    file_namesSTRING
    split_modeCOMBOPárrafos (Saltos de línea)2 options: Párrafos (Saltos de línea), Frases (Puntos)
    current_loop_indexINT

    Outputs (5)

    NameTypeDescription
    current_textSTRING
    current_indexINT
    total_chunksINT
    current_file_nameSTRING
    logSTRING