按静音切分音频
AudioSplitBySilence_CutAudio finds the pauses so you don't have to
- audio
- 音频片段
- 片段数量
- 对齐信息
Long audio in ComfyUI is a pain because nothing wants to deal with it as one lump. You want to split a podcast into questions, chop a voice-over into individual takes, or slice an interview into clips - and you'd rather not sit there with a stopwatch typing timestamps. AudioSplitBySilence_CutAudio is the auto-splitter from the ComfyUI-cut-audio pack (mailzwj, Apache-2.0): it listens for the pauses and cuts there, handing you a batch of segments plus a JSON alignment map. It's the most genuinely useful node in the pack, and the one people will actually build workflows around.
How it works
The mechanism is simple and visible in the source, which is worth understanding because it explains every tuning knob. The node:
- Downmixes to mono (mean across channels).
- Slices the waveform into 10 ms frames.
- Marks each frame silent if its peak amplitude is below a threshold. That threshold is your dB setting converted to a linear amplitude (
10^(dB/20), so-40 dB= 0.01), and "energy" here is the max absolute sample in the frame - a peak test, not an RMS average. One loud transient inside a pause means that frame is "not silent." - Collects runs of silent frames long enough to count (≥
min_silence_duration_ms) and makes each one a cut point - placed at the midpoint of the silence, so the gaps are split in half and shared between neighbors. - Drops any resulting segment shorter than
min_segment_duration_ms.
What comes out the other side is a batched AUDIO: every segment right-padded with zeros up to the length of the longest one, stacked into one tensor, with a segment_lengths key recording each segment's true size.
The inputs and outputs that matter
silence_threshold_dB(FLOAT, default -40.0) - how quiet "silent" means. Lower (more negative) = only deep quiet counts, so fewer, longer cuts. This is the knob you'll actually turn.min_silence_duration_ms(INT, default 300) - the shortest pause that earns a cut. Speech breaths are usually under this; a 300 ms default is a decent starting point for dialogue.min_segment_duration_ms(INT, default 200) - segments shorter than this get thrown away. Raise it if you're getting a pile of 50 ms crumbs.
Three outputs:
音频片段(AUDIO) - the padded batch.片段数量(INT) - how many segments survived.对齐信息(STRING) - a JSON array of{"start": ..., "duration": ...}per segment, in seconds of the original file. This is the useful one nobody expects: it's your timestamp map, ready to feed subtitle or annotation logic.
The padding trap
This is where people get burned. The batch is padded to the longest segment, so if you save it straight from this node, every segment except the longest has a tail of digital silence. That's why the pack pairs this node with AudioSelectSegment_CutAudio - the selector reads the segment_lengths key and trims the padding off whatever segment you pick. If you want the whole batch in one file with real boundaries, the alignment JSON tells you where the silence actually starts.
And if the split feels wrong, don't fight the algorithm blindly. Over-splitting (too many tiny fragments) → raise min_segment_duration_ms and/or raise the threshold. Under-splitting (long clips with mid-conversation pauses uncut) → lower the threshold or lower min_silence_duration_ms. Because detection is peak-based, a loud breath can bridge what should be two segments - bump the minimum silence up a notch and the pauses you actually mean will separate.
Installing it
Standard pack install. In ComfyUI Manager, search ComfyUI-cut-audio and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/mailzwj/ComfyUI-cut-audio.git
Restart. Dependency story is light: torch only, no models, Apache-2.0. It's written against the newer comfy_api.latest node API, so it needs a current ComfyUI - the README notes comfy_api ships built-in, so if the nodes are missing the fix is updating ComfyUI, not installing anything.
Where it fits
The pack's own workflow is the right shape: load audio → AudioSplitBySilence_CutAudio → AudioSelectSegment_CutAudio to pick one take → save or send downstream (TTS reference, lip-sync, video mux). It won't beat a DAW at fine editing - peak-based silence detection is a blunt instrument - but as the "give me all the clips in one run" step of an automated pipeline, it's exactly what ComfyUI was missing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| silence_threshold_dB | FLOAT | -40-80–0 | 静音阈值(dB)。低于此电平的帧视为静音。 |
| min_silence_duration_ms | INT | 30050–5000 | 触发切分的最短静音时长(毫秒)。 |
| min_segment_duration_ms | INT | 20050–10000 | 短于此时长(毫秒)的片段将被丢弃。 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 音频片段 | AUDIO | — |
| 片段数量 | INT | — |
| 对齐信息 | STRING | — |