Nodes/MKRShift_Nodes/Audio Trim/Fade/Normalize
ComfyUI Node

Audio Trim/Fade/Normalize

Cut, fade, and loudness-match in one node

By criskb·Created 7 months ago·Updated 5 months ago· 0
Audio Trim/Fade/Normalize
  • audio
  • audio
  • output_path
  • duration_sec
  • summary
start_sec0.00
end_sec-1.00
fade_in_sec0.00
fade_out_sec0.00
normalize_modepeak_-1db
output_formatauto
filename_prefixMKR_audio_edit
subfolder
overwritefalse
filename_label

This is the node that does the three edits every piece of finished audio needs - cut the dead parts, fade the edges so nothing clicks, and set the loudness so it matches the rest of your project. MKRAudioTrimFadeNormalize is the closest thing in the MKRShift_Nodes audio set to "one button audio polish," and for generated voice clips it's often the entire finishing stage by itself. The peak_-1db default even gives you a sensible loudness target out of the box, which is more than most people set up on their own.

It's a Utility, but it's the last one in the chain before export: trim → fade → normalize → MKRPresaveAudio → done.

How it works

With a file input and ffmpeg, it builds a single ffmpeg filter chain:

  • Trim via atrim - start_sec/end_sec cut the region you want. end_sec = -1 (the default) means "to the end." Set both and it cuts a precise window; set only start_sec and it trims from there.
  • Fades via afade - fade_in_sec and fade_out_sec ramp volume up at the head and down at the tail, eliminating clicks at the cut points. The fade-out length is subtracted from the trimmed duration automatically.
  • Normalize via one of four normalize_modes: off does nothing; peak_-1db (default) uses dynaudnorm to bring the loudest peak to just under full scale; lufs_-14 and lufs_-16 use ffmpeg's loudnorm for a true loudness (LUFS) match - −14 LUFS is the streaming standard, −16 is the broadcast/podcast target.

If the input is a waveform payload rather than a file, it falls back to numpy trimming/fading (with peak normalization only - the LUFS modes need ffmpeg's loudnorm).

Inputs that matter

  • audio - MKR_AUDIO payload, waveform tensor, or file path.
  • start_sec / end_sec - the trim window. end_sec defaults to −1 (through to the end).
  • fade_in_sec / fade_out_sec - 0 to 60 s each. 50–150 ms is the sweet spot for dialogue.
  • normalize_mode - off, peak_-1db, lufs_-14, lufs_-16.
  • Standard save block: output_format, filename_prefix, subfolder, overwrite, optional filename_label.

Outputs: audio (MKR_AUDIO), output_path, duration_sec (post-trim), summary.

Install

ComfyUI Manager (search "MKRShift Nodes"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes

Restart. The full normalize modes and fades need ffmpeg on PATH - without it you're limited to the numpy fallback (trim + peak normalize only). No models.

Common issues

Biggest one: LUFS vs peak is not a preference, it's a target. peak_-1db makes the clip as loud as possible without clipping, which is fine for a single voiceover but wrong if you're matching a project where other tracks were loudness-matched. If clips in your timeline sound inconsistent, use the same LUFS mode on all of them - that's the point of loudness normalization. Second, end_sec uses a sentinel value of −1 for "rest of clip," so you can't actually trim to a negative end time - set it to 0 or a positive number or you'll get the whole tail back. And dynaudnorm on peak_-1db can pump on very dynamic material; if the voice swells oddly, switch to lufs_-16 which behaves more gently.

CategoryMKRShift Nodes/Media/Audio/Utility

Inputs (11)

NameTypeDefaultDescription
audio*
start_secFLOAT0.000–86400
end_secFLOAT-1.00-1–86400
fade_in_secFLOAT0.000–60
fade_out_secFLOAT0.000–60
normalize_modeCOMBOpeak_-1db4 options: off, peak_-1db, lufs_-14, lufs_-16
output_formatCOMBOauto5 options: auto, wav, mp3, flac, ogg
filename_prefixSTRINGMKR_audio_edit
subfolderSTRING
overwriteBOOLEANfalse
filename_labeloptSTRING

Outputs (4)

NameTypeDescription
audioMKR_AUDIO
output_pathSTRING
duration_secFLOAT
summarySTRING