Nodes/Comfyui_URN_AudioTools/URN Audio Trim Fade
ComfyUI Node

URN Audio Trim Fade

Trim, fade and normalise ComfyUI audio without a detour through Audacity

By Clivey1234·Created 2 days ago·Updated a day ago· 4
URN Audio Trim Fade
  • audio_input
  • audio
  • audio_duration
◄length10.00►
◄start_sec0.00►
◄fade_in_sec3.00►
◄fade_out_sec3.00►
◄curvecosine►
◄pad_if_shorttrue►
◄gain_db0.0►
◄normalizefalse►
◄trim_modeLength►
◄end_sec10.00►

Every generated track has a job waiting for it that has nothing to do with generation: cut the 30-second intro off, fade the ending so it doesn't stop like a dropped phone, and lift a quiet clip to a usable level. Do that outside ComfyUI and you're exporting, editing, re-importing, and losing the graph.

URN Audio Trim Fade does it in the graph, with a waveform editor you can actually see. The internal class name is still URN_MP3_Trim_Fade from an earlier life; the node in your list says URN Audio Trim Fade. Same node, don't go hunting.

How it works

The node takes an AUDIO connection only - deliberately, so there's exactly one audio-loading path in your workflow (a Load Audio node upstream), not two competing file pickers. Then it's a straight signal chain, and the ordering is the interesting part:

  1. Slice the source - either Start Sec plus Length, or Start Sec to End Sec as two absolute timestamps.
  2. Apply fade in and fade out over the real trimmed audio.
  3. Optionally peak-normalise to 0 dBFS.
  4. Optionally apply gain_db.
  5. Only then pad with silence, if pad_if_short is on and the requested duration isn't there.

Steps 2–4 running before padding is the right call: a 3-second fade-out that lands inside your silence tail is a fade nobody hears.

Fades themselves are shaped by curve - cosine for the smooth, natural-sounding shape, linear for a constant-rate ramp you'd only pick if you want the mechanical feel.

There's a frontend editor: outer handles set trim start/end, diamond handles set the fades, and the waveform redraws to match. Preview Changes auditions your edit locally without queuing the workflow, which is the difference between this and nudging numbers blind.

Inputs and outputs

The ones you'll actually set:

  • audio_input - required AUDIO. Load Audio, or URN Audio Smart Splitter chunks, or a mixer output.
  • trim_mode - Length (Start Sec + Length) or End Sec (Start Sec and End Sec are absolute positions in the original). This is the setting people fumble: in End Sec mode, end_sec 30 → 42 with start_sec 30 gives you twelve seconds; in Length mode end_sec does nothing at all.
  • length - output duration in seconds, and 0 means "all remaining audio after Start Sec".
  • start_sec, fade_in_sec (default 3), fade_out_sec (default 3), curve.
  • normalize and gain_db - peak-normalise first, then apply dB. 0 dB is unchanged, and the useful range here is small: ±3 dB is a lot of change.
  • pad_if_short - pad to the requested duration with silence, or stop when real audio ends.

Two outputs: audio, and audio_duration as a FLOAT. Wire the duration to a filename prefix or a text node when you're building a batch; the audio goes to a save node or the mixer.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Clivey1234/Comfyui_URN_AudioTools

Restart ComfyUI. This node is pure torch - no ffmpeg, no models - but the pack's shared requirements.txt (faster-whisper, audio-separator, librosa, scipy, soundfile, mutagen) is what install.bat installs for the pack's heavier nodes. If you skip dependencies, only those heavy nodes break.

Manager: search Comfyui_URN_AudioTools. After an update, Ctrl+F5 - the waveform editor is a frontend file that has been through several versions, and install.bat even deletes stale older copies of it to stop them fighting.

Common issues

The fade-out is silent, or the clip sounds like it ends in a void. You're fading across silence. pad_if_short adds the tail after the fades are applied, so if your requested length extends past the source, the fade is over real audio and then there's dead air. Set length to the real audio length, or turn padding off.

Setting end_sec changes nothing. You're in Length mode. Switch trim_mode to End Sec.

Normalising made everything else quieter. Peak normalisation is exactly that - it lifts the loudest sample to 0 dBFS. One clip or transient and the rest of the track drops. If you want consistent loudness rather than peak level, don't reach for this toggle; ride gain_db per clip instead.

The node re-runs on every queue. It declares itself always-changed (the NaN fingerprint idiom), so ComfyUI won't serve it from cache. That's intentional for an editor over connected audio, but chain four of them and nothing downstream caches either.

CategoryURN Audio Tools

Inputs (11)

NameTypeDefaultDescription
audio_inputAUDIO—
lengthFLOAT10.000–100000Output audio length in seconds. 0 = use all remaining audio.
start_secFLOAT0.000–100000—
fade_in_secFLOAT3.000–3600—
fade_out_secFLOAT3.000–3600—
curveCOMBOcosine2 options: cosine, linear
pad_if_shortBOOLEANtrue—
gain_dbFLOAT0.0-60–24Volume adjustment in dB, applied after optional normalization. 0 dB = unchanged.
normalizeBOOLEANfalsePeak-normalize the trimmed audio to 0 dBFS before applying gain_db.
trim_modeCOMBOLengthLength uses the Length duration. End Sec treats end_sec as an absolute source timestamp.
end_secFLOAT10.000–100000Absolute end timestamp when trim_mode is End Sec. Example: start_sec 30, end_sec 42 = 12 seconds.

Outputs (2)

NameTypeDescription
audioAUDIO—
audio_durationFLOAT—