Nodes/comfyui-audio-trimmer/🎡 Audio Trimmer
ComfyUI Node

🎡 Audio Trimmer

Cut audio in ComfyUI like a video editor β€” no ffmpeg round-trip

By PixalaiΒ·Created 4 months agoΒ·Updated 4 months agoΒ· 0
🎡 Audio Trimmer
  • audio
  • AUDIO
β—„start_time0.000β–Ί
β—„end_time0.000β–Ί

ComfyUI gives you audio these days. LTX-2 generates video and sound in one pass, TTS nodes hand you voice lines, and every second video workflow has a separate audio stage bolted on. But once that AUDIO tensor exists in your graph, what do you actually do with it? Load it, maybe play it, save it. If you wanted to trim the dead air off the front, chop a clip to 8 seconds, or cut the "tin can" tail off an LTX take, you were out of luck - export, open an editor, re-import. 🎡 Audio Trimmer (AudioTrimmer_Timeline) is the node that closes that gap: a Premiere Pro-style waveform timeline rendered right on the node, with drag handles, zoom, and in-node playback, trimming via pure tensor slicing. Zero re-encoding, zero external tools.

How it works

The trick is that trimming is the easy part; seeing what you're trimming is the hard part, and this node solves the seeing. When you run it, the backend reads your audio tensor ([B, C, T] waveform plus sample rate) and pushes two things to the frontend: a mono downsampled waveform at ~2000 samples per second (0.5ms resolution, enough for surgical cuts), and a WAV copy written to ComfyUI's temp dir purely so the browser can play it back. The timeline canvas then renders per-pixel min/max peaks, so it stays pixel-accurate at up to 500x zoom instead of turning into a blur.

The trim itself is one line in the source: waveform[:, :, start_sample:end_sample]. start_time and end_time are converted to sample indices and clamped to the audio bounds, then sliced. No resampling, no bit-depth change, no compression - the output is bit-identical to that section of the input. The WAV the Play button uses is a 16-bit down-conversion, but that's only for the preview; the actual output is the untouched float tensor.

The inputs that matter

Only three, and you mostly touch two:

  • audio (AUDIO) - whatever you're trimming. Any node that emits an AUDIO output feeds it.
  • start_time (FLOAT, seconds, step 0.001) - where the cut begins.
  • end_time (FLOAT, seconds, step 0.001) - where it ends. 0 means "to the end of the audio" (author's own tooltip), so with both at their defaults the node is a lossless no-op passthrough - handy for testing.

You can type values or drag the green (start) and red (end) handles on the timeline; they sync both ways. Drag the region to move the whole selection, double-click to jump the nearest handle, Ctrl+Scroll to zoom anchored at your cursor. The output is a single AUDIO slot carrying the trimmed tensor at the original sample rate, plus an in-canvas audio preview.

One flow quirk to internalize: the waveform is only drawn after the node runs. Queue the workflow once to load it, drag your handles, queue again to get the trimmed result. It's an output node too, so ComfyUI treats it as a valid end of the graph - it's the last stop on your audio branch.

Installation

No model downloads, no pip dependencies - the requirements list is just Python 3.10+, PyTorch, and the torchaudio that ComfyUI already ships. Via ComfyUI Manager, search comfyui-audio-trimmer and hit Install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Pixalai/comfyui-audio-trimmer.git

Then restart ComfyUI. The one real catch: this is built on ComfyUI's newer class-based node API (comfy_api.latest), so it needs a recent ComfyUI. If the node doesn't appear after install, update ComfyUI first - it won't register on an old core.

Where people get burned

The "queue to see the waveform" loop trips everyone up on the first run - the timeline just shows a β–Ά prompt until the node executes. Don't assume it's broken. And remember the trim happens on the backend using your widget values, so if you drag handles and never re-queue, nothing changes downstream. If the preview won't play, it's the browser refusing autoplay, not the node - hit play once and it's fine. Otherwise this is one of the rare small packs that just works: one node, lossless, and it finally lets you stay in the graph instead of bouncing out to an audio editor.

Categoryaudio/edit

Inputs (3)

NameTypeDefaultDescription
audioAUDIOInput audio to trim
start_timeFLOAT0.0000–999999Trim start time in seconds
end_timeFLOAT0.0000–999999Trim end time in seconds (0 = end of audio)

Outputs (1)

NameTypeDescription
AUDIOAUDIOβ€”