Nodes/MKRShift_Nodes/Audio Silence Trim
ComfyUI Node

Audio Silence Trim

Chop the dead air off your AI voice clips automatically

By criskb·Created 7 months ago·Updated 5 months ago· 0
Audio Silence Trim
  • audio
  • audio
  • output_path
  • duration_sec
  • summary
threshold_db-45.0
min_silence_ms120
trim_starttrue
trim_endtrue
pad_ms0
output_formatauto
filename_prefixMKR_audio_trim_silence
subfolder
overwritefalse
filename_label

Every TTS output ships with dead air - a beat of silence before the first word, a long tail after the last, sometimes a full second of room tone at the start. It's invisible in the graph and annoying in the cut. MKRAudioSilenceTrim finds the leading and trailing silence and removes it, with a configurable threshold and a padding option so you can keep a little breathing room on either end. It's the kind of tiny cleanup that makes generated dialogue feel edited rather than raw.

It's a Utility in the MKRShift_Nodes audio set, and it slots naturally right after generation or before concat - trim each clip's dead air first, then MKRAudioConcat them, so you don't concatenate a bunch of silences into your joined track.

How it works

The node computes the per-sample level of the loudest channel and flags samples below threshold_db (default −45 dB - that's very quiet, so normal speech won't be mistaken for silence). It then walks in from the start and end to find the first/last sample that's above threshold, and cuts everything outside that. trim_start and trim_end are independent booleans, so you can trim only the head, only the tail, or both.

If you want a little air kept, pad_ms re-adds up to 5000 ms of silence at whichever end you trimmed. That's the "don't make the clip feel claustrophobic" knob - a 50–100 ms pad at each end of dialogue usually sounds more natural than zero.

The default min_silence_ms (120 ms) mostly matters for internal gap detection: it prevents a tiny drop-out in the middle of a word from being treated as a boundary. The node trims edges only - it won't remove silence in the middle of your clip, which is the correct conservative behavior.

Inputs that matter

  • audio - MKR_AUDIO payload, waveform tensor, or file path.
  • threshold_db - default −45 dB. Raise it (say −35) if your source is noisy and the trim isn't cutting enough; lower it if you're cutting into quiet audio you wanted to keep.
  • min_silence_ms - default 120 ms.
  • trim_start / trim_end - both on by default.
  • pad_ms - default 0, up to 5000.
  • Standard save block: output_format, filename_prefix, subfolder, overwrite, optional filename_label.

Outputs: audio (MKR_AUDIO), output_path, duration_sec (now shorter - compare with the summary), summary (includes threshold used and warnings).

Install

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

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

Restart. Pure numpy; no ffmpeg needed for the operation, only for compressed output. No models.

Common issues

Two things bite people. First, this trims edges, not gaps - if your clip has silence inside it, this node won't touch it, and users expecting a full silence-cleanup tool are surprised. Second, on noisy sources (hums, room tone, music), the default −45 dB threshold never triggers because the noise floor is above it - your "silence" is actually noise, and you'll trim nothing. For music, that's correct behavior; for noisy dialogue you may need to raise the threshold toward −35 or −30 dB and accept cutting a hair of the quiet attack. And pad_ms pads silence - if you want a loop or mirror pad, that's MKRAudioPadTrimDuration's job.

CategoryMKRShift Nodes/Media/Audio/Utility

Inputs (11)

NameTypeDefaultDescription
audio*
threshold_dbFLOAT-45.0-90–0
min_silence_msINT1200–10000
trim_startBOOLEANtrue
trim_endBOOLEANtrue
pad_msINT00–5000
output_formatCOMBOauto5 options: auto, wav, mp3, flac, ogg
filename_prefixSTRINGMKR_audio_trim_silence
subfolderSTRING
overwriteBOOLEANfalse
filename_labeloptSTRING

Outputs (4)

NameTypeDescription
audioMKR_AUDIO
output_pathSTRING
duration_secFLOAT
summarySTRING