Nodes/ComfyUI_Lam/音频前后加静音
ComfyUI Node

音频前后加静音

Pad your audio with silence, before or after, in seconds

By yanlang0123·Created 2 years ago·Updated 18 days ago· 76
音频前后加静音
  • audio
  • audio
before0.00
after0.00

AudioBeforeAfterSilence (音频前后加静音, "add silence before/after audio") takes an AUDIO tensor, prepends and/or appends a specified number of seconds of silence, and returns the padded AUDIO. Two float inputs (before, after) in seconds, one output, and that's the entire node.

Boring, yes. But it's the exact tool for the fiddly timing problems that show up constantly in audio+video ComfyUI work: your narration track needs a beat of quiet before the speaker starts, or a tail after the last word so it doesn't cut off abruptly at the video's end, or you're aligning an audio track to a fixed-length video and need exactly N seconds of padding. ComfyUI's stock audio tools don't have a direct "add silence" knob, so when you hit this gap, a dedicated node is a relief - it's the audio equivalent of a Pad Image node.

How it works

Straightforward tensor work, and it's honest about what "silence" means. It takes the incoming waveform, creates zero-filled tensors of sample_rate × before and sample_rate × after samples, and concatenates them on the time axis: silence, your audio, silence. The result keeps the same sample rate and channel count. Because the padding is generated on the audio tensor, it slots in before any node that mixes or encodes audio - no file round-trip needed. The tooltips on the inputs are the author's own, in Chinese: "时长(秒)" - duration in seconds. Both default to 0, so a node with nothing set is a no-op passthrough, which is convenient for a shared template.

Inputs and output

  • audio - an AUDIO tensor from any audio source node.
  • before - FLOAT seconds of silence to prepend.
  • after - FLOAT seconds of silence to append.
  • Output: audio - the padded AUDIO tensor.

Install

In yanlang0123/ComfyUI_Lam - Manager search "ComfyUI_Lam", or:

cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam

restart. Pure torch - it only depends on the AUDIO type ComfyUI itself provides, so no extra pip packages and none of the README's install.bat requirements. This is about as dependency-free as a node gets.

Gotchas

Sub-second precision is the thing to remember: the seconds are multiplied by the sample rate and truncated to whole samples, so at 44.1kHz a before = 0.5 is accurate to a hair, but extreme precision below one sample isn't a thing (it can't be). Fractional-second steps are supported in the widget (step: 0.01), so timing like 0.75s works fine. The real caveat is that padding is silence - it lengthens the track, it doesn't compress or trim anything. If your audio is already too long, this node can't help; trim first, pad after. And since it works on the tensor, check whether your downstream encoder likes the resulting sample rate - it inherits the input's, which is almost always what you want. Small, precise, and quietly indispensable in audio-sync workflows.

Categorylam

Inputs (3)

NameTypeDefaultDescription
audioAUDIO
beforeFLOAT0.000–9999999时长(秒)
afterFLOAT0.000–9999999时长(秒)

Outputs (1)

NameTypeDescription
audioAUDIO