Nodes/TKNodes/Smart Audio Chunker
ComfyUI Node

Smart Audio Chunker

Split long audio on silence so generation never cuts a word in half

By trashkollector·Created about a year ago·Updated a day ago· 1
Smart Audio Chunker
  • audio
  • num_chunks
  • chunk_size
  • start_time
  • total_duration
index0
chunk_secs10
variation2

Long-form generation is a VRAM problem wearing a video problem's clothes. You can't feed a video model ten minutes of audio-driven content at once, so you chunk it - but a dumb timer-based chunker will cheerfully slice straight through a sentence. Smart Audio Chunker is the fix: it looks for silence in your audio and puts the chunk boundaries there, so each piece is a coherent passage instead of a word severed mid-vowel. The README's framing is exactly right: for singing or talking, it "never breaks middle sentence."

It's the audio half of the pack's flagship chunking pair - TKSmartVideoChunker calls this node internally for its timing. On its own it doesn't cut audio up into AUDIO chunks; it computes the timing of the cuts (num_chunks, chunk_size, start_time, total_duration) that downstream slicing nodes then use. That's a subtle but important distinction.

How it works

It converts the incoming AUDIO to a mono 16-bit stream (pydub format) and walks it in windows around your target size. Give it chunk_secs (default 10) and variation (default 2), and it searches the window from chunk_secs - variation to chunk_secs + variation seconds for the first stretch of silence - using a 300ms minimum and -40dB threshold - then splits at the middle of that silence. No silence found in the window? It splits at exactly chunk_secs anyway. index is the loop counter: give it 0 and you get the first chunk's timing, 1 the next, and so on.

The chunk_secs tooltip carries the practical advice: for low VRAM, use 5 seconds. The chunk size is your VRAM/complexity dial - smaller chunks, lighter per-pass load.

The inputs that matter

  • audio - the full audio to be chunked (the AUDIO socket).
  • index - which chunk you want this pass, from your loop.
  • chunk_secs - target chunk length; drop to 5 on low VRAM.
  • variation - how far back/forward to search for silence (seconds). More variation = more chance of finding a clean break, at the cost of less predictable chunk sizes.

Outputs

Four FLOAT/INT timings: num_chunks (how many chunks the audio splits into), chunk_size (this chunk's actual length in seconds), start_time (its start in seconds), and total_duration (the audio's full length). Wire these into slicing or the video chunker, which consumes the same timing model.

Common issues

If your audio has no pauses at all (dense music, continuous speech), the silence search finds nothing and every chunk falls back to a hard cut at chunk_secs - which defeats the purpose. The honest answer is to build pauses into the source, which is exactly why the node's sibling for speakers tells you to put breaks in the audio. Also worth knowing: it converts to mono for detection (channel averaging), so stereo panning doesn't influence where the cuts land. And because it searches the first silence in each window, not the best one, chunk sizes bounce around - that's the trade for never cutting mid-word.

Installing it

Part of trashkollector/TKNodes ("ComfyUI Handy Nodes"). Install via ComfyUI Manager (search "Handy Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/trashkollector/TKNodes

Restart, and it's under the HandyNodes-KT category. Needs pydub (in the pack's requirements) and FFmpeg on your system PATH for compressed audio - the README calls both out, and FFmpeg is the classic first-run failure.

CategoryHandyNodes-KT

Inputs (4)

NameTypeDefaultDescription
audioAUDIOthe Full audio that will get chunked
indexINT0Index from the for loop
chunk_secsINT10Size of an Audio Chunk, for low VRAM use 5
variationINT2we separate when we find silence, this tells how far back and forward to search for silence

Outputs (4)

NameTypeDescription
num_chunksINTNumber Chunks Calculated for the audio.
chunk_sizeFLOATlength of chunk in seconds
start_timeFLOATstart time of chunk in audio
total_durationFLOATend time in chunk in audio