Nodes/yanhuo-easy-use/筛选音频
ComfyUI Node

筛选音频

\"5, 3, 0, 1\" means take them in that order — not sorted

By yanhuoxunxianren·Created 27 days ago·Updated 21 days ago· 2
筛选音频
  • audios
  • 筛选音频
◄indexes0, 1, 2►

Once you have an audio batch - from 加载批量音频 or 音频批次合并 - the next thing you always need is "not all of that." 筛选音频 is the small, sharp tool for that: give it a batch and a list of indexes, get back a batch containing exactly those segments, in the order you wrote them.

Why it's more useful than it looks

Two jobs hide here.

The first is selection: a TTS pass gave you eight takes, takes 2, 5 and 7 were the good ones, and you want them on a wire leading to a save node. Naming indexes beats deleting nodes.

The second, and the one people miss, is reordering. Index lists are applied in writing order, not sorted, so 5,3,0,1 gives you segment 5, then 3, then 0, then 1. If you built a sequence of clips and realized after wiring that the opening line belongs at the end, you fix it by editing one text field rather than redoing the graph. That's genuinely handy for assembling a dialogue sequence out of takes.

Inputs, outputs, and what the parser accepts

audios is the input batch - AUDIO, flagged as a list, so it takes the output of the batch nodes directly. The tooltip points at exactly those two producers, so wire it there.

indexes is a multiline string, default 0, 1, 2, and it's far more forgiving than the tooltip lets on. The parser accepts commas and Chinese commas, 、, semicolons in both widths, spaces, and newlines as separators - so all of these work identically:

5,3,0,1
0,2,5
0 1 2 3
0,
1,
2

Indexes are 0-based, out-of-range and unparseable tokens are dropped silently, and there is no complaint about duplicates - listing 0,0 legitimately gives you that segment twice. Which is a feature if you need a clip repeated.

The single output is 筛选音频, typed AUDIO and marked as a list, so it feeds 音频批次预览/保存 or another filter. Two safety nets are baked in: if every index is invalid you get segment 0 back (with a console note) rather than an empty batch, and if the input batch is empty you get one second of silence. Empty lists are what break downstream list consumers in ComfyUI, so the node refuses to emit one.

Install

Part of the 16-node yanhuo-easy-use pack - category yanhuo, Chinese labels, MIT, no dependencies beyond what ComfyUI ships. Manager: search the pack title. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yanhuoxunxianren/yanhuo-easy-use
# restart ComfyUI

Nothing to download, no pip install - pyproject.toml declares an empty dependency list, and PyAV (used by the pack's loaders and savers) already comes with ComfyUI.

Common issues

"It pulled the wrong segments." Remember it's 0-based, so 1 is the second clip. And it does not sort - if you wanted ascending order you have to type ascending order.

"The count is off, there's a segment I didn't ask for." That's the fallback: nothing in your index list was valid, so it handed you segment 0. Check the console - it prints a line when it does this. Usual cause is pointing at a smaller batch than you think, because an upstream node dropped silence.

"I get a second of silence down the chain." Your batch was empty when it reached the filter. That's an upstream problem - most likely a loader whose tracks all failed, or a 音频批次合并 whose inputs were all empty. Look further back.

"I want to keep everything except index 3." There's no exclusion syntax; write out the indexes you do want. With a 50-clip batch that's tedious, but it's the honest limit of this node.

"A list went in and a list of one came out." If your index list had exactly one valid entry, that's a batch of one. Correct behaviour - a batch node downstream will treat it as a single clip.

For where audio sits in ComfyUI and which node packs handle which job, docs/knowledge/audio-generation.md is worth ten minutes. The reason ComfyUI has a list-versus-single distinction that keeps biting people is covered in docs/knowledge/comfyui-node-plumbing.md.

Categoryyanhuo

Inputs (2)

NameTypeDefaultDescription
audiosAUDIO音频批次(列表),可来自音频批次合并或加载批量音频的某条轨道。
indexesSTRING0, 1, 2逗号分隔的索引(从 0 起),按书写顺序提取对应音频段,如 5,3,0,1;也支持多行。超出范围的索引会被忽略。

Outputs (1)

NameTypeDescription
筛选音频AUDIO—