ComfyUI Node

Load Audio & Crop

Trim your reference audio by ear instead of guessing seconds

By sthao42·Created 4 days ago·Updated a day ago· 2
Load Audio & Crop
  • audioUI
  • audio
  • duration
audio
start_time0
end_time0

Typing start_time and end_time in seconds is a miserable way to work with audio. You load a song, guess that the good part starts around 47 seconds, run the whole pipeline, and discover the chorus actually begins at 51. Load Audio & Crop is the fix: it loads an audio file onto the node as a real waveform player, and you drag the trim handles until it sounds right - then it hands the cropped window to the rest of the graph.

Audio is the newest, most bolted-on layer of the ComfyUI stack, and it shows. Most of the models that consume it want a clean segment, not a whole file: an audio-driven talking head wants the ten seconds where someone talks, an LTX-2.3 audio-conditioned video wants the exact instrumental you're syncing to, a reference track for a music-to-dance run wants the chorus and nothing else. Feeding those models a four-minute file is both a memory bill and a conditioning mess. This node is the trim-before-you-feed step.

There's a second trick hidden in the file picker. It doesn't just take audio. Point it at an .mp4, .mov, .mkv, .webm, or .avi and it will rip the audio track out of the video via PyAV - so you can pull the dialogue straight off a downloaded reference clip without a separate conversion step.

How it works

The node decodes the file through PyAV first, then falls back through soundfile, torchaudio, and a standard-library wave reader until something succeeds. That chain covers wav, mp3, flac, ogg, m4a, aac, opus, wma, and video containers. The smart bit: when a crop is set, it seeks and decodes only the window you asked for, so memory is bounded by the crop rather than the whole track. No crop means a full decode of the file.

On the canvas you get a waveform with play/pause (Space), frame stepping ( / ), and draggable cyan trim pins. Drag between the pins to slide the whole window; click outside or ✕ Full to reset to the full track. The handles are two-way bound to the numeric inputs, so you can also just type a value and watch the handles jump.

Inputs:

  • audio - a file picker over your ComfyUI input folder. Upload, drag & drop, or pick something already there.
  • start_time / end_time (FLOAT, seconds) - where the crop begins and ends. Both snap to whole seconds. Setting end_time to 0 means "to the end of the track," so start_time 30 / end_time 0 gives you from 30 seconds onward.

Outputs:

  • audio - the crop as a standard ComfyUI AUDIO value (a {"waveform": tensor, "sample_rate": int} dict). It plugs straight into any node downstream that takes an AUDIO input.
  • duration - the output audio's length in seconds.

What to watch out for

Three honest gotchas, all visible in the source:

  • duration rounds up to the nearest whole second (math.ceil). A 3.2-second crop reports 4.0. Fine for sanity checks and most downstream math, but if you're wiring duration into exact frame or latent calculations, don't take it as gospel.
  • Everything snaps to whole seconds. You can't grab a 1.5-second slice from the middle of a track - the crop grid is second-aligned. That's deliberate (video models think in frames, and seconds keeps the trim aligned with them), but it means fine sub-second timing needs a different tool.
  • Ends can be quiet. Cropping on the second means the boundaries of your window land wherever they land mid-phrase. The waveform makes this visible before you commit, so nudge the handles until the edit sounds clean - that's the whole point of doing it visually.

How to install it

ComfyUI Manager - search "Comfyui-reference-loader" - or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/sthao42/Comfyui-reference-loader

Restart ComfyUI afterward - the interactive UI lives in frontend JS that only loads on startup, so a restart plus a browser refresh is what actually registers it. No model downloads, no API keys, and no extra pip packages beyond what ComfyUI already ships (PyAV is bundled). One note: installing the pack pulls in all four of its nodes, including the video and image loaders. This pack is very new, so if the waveform never appears after a clean restart, check the browser console for the node's own decode errors before assuming the install broke - that's where it logs what it couldn't read.

Categoryreference_loader/audio

Inputs (4)

NameTypeDefaultDescription
audioCOMBOThe audio file to load. Upload, drag & drop, or select an existing file.
start_timeFLOAT00–100000Crop start time in seconds (0 = start). Snaps to nearest second.
end_timeFLOAT00–100000Crop end time in seconds (0 = full track / end). Snaps to nearest second.
audioUIoptAUDIO_UI

Outputs (2)

NameTypeDescription
audioAUDIOThe loaded audio, cropped to the selected time range (or full audio if uncropped).
durationFLOATDuration of the output audio rounded up to the nearest second.