URN Audio Trim Fade
Trim, fade and normalise ComfyUI audio without a detour through Audacity
- audio_input
- audio
- audio_duration
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:
- Slice the source - either
Start SecplusLength, orStart SectoEnd Secas two absolute timestamps. - Apply fade in and fade out over the real trimmed audio.
- Optionally peak-normalise to 0 dBFS.
- Optionally apply
gain_db. - Only then pad with silence, if
pad_if_shortis 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, orURN Audio Smart Splitterchunks, or a mixer output.trim_mode-Length(Start Sec + Length) orEnd Sec(Start Sec and End Sec are absolute positions in the original). This is the setting people fumble: inEnd Secmode,end_sec30 → 42 withstart_sec30 gives you twelve seconds; inLengthmodeend_secdoes nothing at all.length- output duration in seconds, and0means "all remaining audio after Start Sec".start_sec,fade_in_sec(default 3),fade_out_sec(default 3),curve.normalizeandgain_db- peak-normalise first, then apply dB.0 dBis 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.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| audio_input | AUDIO | — | |
| length | FLOAT | 10.000–100000 | Output audio length in seconds. 0 = use all remaining audio. |
| start_sec | FLOAT | 0.000–100000 | — |
| fade_in_sec | FLOAT | 3.000–3600 | — |
| fade_out_sec | FLOAT | 3.000–3600 | — |
| curve | COMBO | cosine | 2 options: cosine, linear |
| pad_if_short | BOOLEAN | true | — |
| gain_db | FLOAT | 0.0-60–24 | Volume adjustment in dB, applied after optional normalization. 0 dB = unchanged. |
| normalize | BOOLEAN | false | Peak-normalize the trimmed audio to 0 dBFS before applying gain_db. |
| trim_mode | COMBO | Length | Length uses the Length duration. End Sec treats end_sec as an absolute source timestamp. |
| end_sec | FLOAT | 10.000–100000 | Absolute end timestamp when trim_mode is End Sec. Example: start_sec 30, end_sec 42 = 12 seconds. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| audio_duration | FLOAT | — |