List Length (ASA)
How Many Items Are in That List? This Node Is the Whole Answer
- input_list
- length
List Length (ASA) does exactly one thing and does it exactly: take a LIST in, give you the number of items in it as an INT out. It's the audio pack's version of the len() you'd type in Python, and it exists for the same reason all the other value nodes in the plumbing layer exist - because in a graph, "how many items are in this thing" is a fact you need as a wire, not as a number you eyeball.
Where it actually gets used in this pack's workflows: bounding loops. The classic setup is Long Text Splitter → list of chunks → a for loop that runs once per chunk → Index Select From List to pull chunk N. The loop needs to know how many iterations to run, and that's exactly what text_chunks_length could give you directly - but when the list comes from somewhere else, or you've shuffled items around, List Length is the clean way to compute the loop bound at runtime instead of hardcoding a count that goes stale the moment you edit your text.
How it works
One required input, one output, no state, no config. input_list can be any list - text chunks, audio objects, paths, whatever. The node returns len(input_list). That's the whole mechanism, and it's one of the few nodes where the source code and the docs are a perfect one-liner match.
Wiring it
- input_list - any
LIST. Required. - Output length -
INT, the count.
Feed it into anything that takes an integer: a loop-end input, an INT comparison, or a text formatter for a status readout.
Installing it
Part of whmc76/ComfyUI-AudioSuiteAdvanced (display "AudioSuiteAdvanced"). ComfyUI Manager → search "AudioSuiteAdvanced", or:
cd ComfyUI/custom_nodes
git clone https://github.com/whmc76/ComfyUI-AudioSuiteAdvanced
cd ComfyUI-AudioSuiteAdvanced
pip install -r requirements.txt
Restart ComfyUI. No models, no downloads.
Gotchas
Honestly, there's not much to trip on with a node that calls len(). The one thing to remember is what the output is for: it's a count, not an index. A list of 5 items gives you 5, but valid indexes run 0 through 4. If you're feeding this straight into an index-selector, subtract one - or, better, use it as a loop bound so the loop runs the right number of times and Index Select's range-clamping never has to save you.
If you're thinking "this is a waste of a node, I could count these myself" - sure, for a fixed list. The moment the list is the output of another node and changes every run (which is the entire point of the splitter→loop pattern), the count becomes a runtime value only a node can produce. That's the whole reason this thing exists.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | LIST | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| length | INT | — |