Papcorns - Audio Trimmer
Papcorns Audio Trimmer, No Files Touched
- audio
- audio
Audio in ComfyUI is finally a real thing - LTX-2 generates synced sound, people pipe Wan videos through an audio stage, MMAudio and the VHS family load and save clips. But once you have audio in the graph, the tooling for just cutting a few seconds out of it is thin. Papcorns - Audio Trimmer is one of those rare nodes that operates entirely in memory: you feed it an AUDIO and it hands you a trimmed AUDIO without ever writing a file. No ffmpeg call, no temp path, no re-import dance.
How it works
ComfyUI represents audio as a dict: a waveform tensor plus a sample_rate. The node unpacks that, converts the waveform to a numpy array, and slices it by sample count. start_time_ms and duration_ms are converted to samples (start_sample = start_time_ms / 1000 * sample_rate), the slice happens, and the result is repacked into the same {"waveform", "sample_rate"} format. It handles mono, stereo, and batched shapes. If the start time runs past the end of the clip, it logs a warning and falls back to the start of the audio rather than crashing. If anything else throws, it returns your original audio untouched - fail-soft, which is the right instinct for a node mid-graph.
One thing you'll notice immediately: it prints a wall of 🍿|AUDIO| DEBUG: lines to the console on every run - start sample, end sample, shapes, durations. Useful when you're debugging, obnoxious when you're not. Think of it as a free waveform inspector that happens to also trim.
The inputs that matter
audio- anAUDIOsocket, so it plugs straight into a VHS audio loader, an LTX audio decode, or whatever else produces the format.start_time_ms- where to cut in, default 0, stepped at 100ms.duration_ms- how long a slice to keep, default 7000 (7 seconds), stepped at 100ms. Range up to 3,600,000 ms - an hour, in case your source is a podcast.
The single output is audio, an AUDIO of the same type you fed in, ready for a save node or another audio step.
Why in-memory matters
The sibling node in this pack, Papcorns - Audio Trim & Save, trims from a file path and writes a file back - fine for one-off batch work, but it round-trips through disk and needs an actual path. This one stays in the graph, which means you can chain it: load audio, trim the intro, feed the trimmed audio into an LTX audio-video workflow or an audio-aware save node without caring where anything lives. If you're building a reusable video+audio template, that's the workflow-friendly option.
Install
It ships with the Papcorns pack:
cd ComfyUI/custom_nodes
git clone https://github.com/papcorns/Papcorns-Comfyui-Custom-Nodes
cd Papcorns-Comfyui-Custom-Nodes
pip install -r requirements.txt
Restart ComfyUI (or search "Papcorns" in Manager). The requirements pull in pydub plus numpy/torch, but note this specific node doesn't actually call pydub - it's pure tensor slicing - so you don't need ffmpeg installed for this one. ffmpeg only becomes required when you export to compressed formats, which is the other node's job.
Caveats
It assumes the waveform is already on CPU (the code calls .cpu().numpy()), which is how ComfyUI's audio loaders hand it over, so you're fine unless something exotic feeds it a CUDA tensor. And because the output is in-memory only, if you want the trimmed audio on disk you still need a save/export node downstream. This is a "cut it, then decide what to do with it" node, and it does that one job without drama.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| start_time_ms | INT | 00–3600000 | — |
| duration_ms | INT | 7000100–3600000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |