Audio Apply Batched Gain
Audio Apply Batched Gain — a different volume for every clip in the batch
- audio
- gain_values
- audio_out
Audio Blend can set one gain for one whole signal. Audio Apply Batched Gain (SET_AudioApplyBatchedGain) is the granular version: it applies a separate gain value to each item inside an audio batch. One wire in, one tensor of gains in, and every clip comes out with its own volume - which is exactly what you want when one clip in a batch is too loud and the other five are fine.
Inputs
audio- the batch of clips to adjust.gain_values- a 1D tensor with one value per batch item. The length must match the batch size, and the node will raise a clear error if it doesn't. Shape matters: it expects(batch_size,), not a scalar, not a 2D array.
Where does a tensor like that come from? The pack's own Audio Normalize (Peak) node outputs exactly this format as its original_peak_level output - one original peak per batch item. The README is explicit that this pairing is the intended use: normalize, then reverse the normalization per item whenever you want. That's the whole normalize_and_undo.json example workflow in one sentence.
You don't have to use it only for undo, though. Because it takes any TORCH_TENSOR, you can build gains from any node that emits per-item numbers - a scale, a schedule, generated values. Multiply any tensor you want as a gain and the batch obeys.
How it works
Internally it reshapes the gains to (batch, 1, 1) and multiplies the waveform tensor, broadcasting one gain across each clip's channels and samples. Simple, fast, batch-friendly. Negative gains work too, which makes it a per-item subtractor if you're feeling ambitious. The output audio_out is the adjusted batch, same sample rate, same shape.
When you'd reach for it
Any time "one batch, many levels" is the problem. A batch of generated voice lines where the third line is dramatically quieter than the rest - apply gains of [1, 1, 2.5, 1, ...]. Fading a batch in or out per item. Or the normalize-round-trip above. The moments you'll not reach for it: single-clip volume (just use Blend with audio2 empty), or applying the same gain to everything (also Blend, or a single-value tensor - though the node prefers the real batch).
Install & gotchas
It's part of Audio Batch - ComfyUI Manager search "Audio Batch", or:
cd ComfyUI/custom_nodes/
git clone https://github.com/set-soft/ComfyUI-AudioBatch
pip install seconohe
Then restart. The gotcha is the shape check: wire in gains from a node that emits one number per clip and you're fine; hand it a scalar and it'll complain about a batch-size mismatch. It'll also complain loudly if your gain tensor has the wrong length - which is a feature, because silent volume bugs are the worst kind. Watch for huge gains on silent clips: gain applied to silence stays silence, but a 10× gain on a loud clip will happily push you into clipping territory.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | The audio batch to apply gain to. | |
| gain_values | TORCH_TENSOR | A batch of gain values (e.g., from an Audio Normalize node). Expects a 1D tensor. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio_out | AUDIO | — |