Nodes/DJZ-Nodes/Combine Audio Tracks
ComfyUI Node

Combine Audio Tracks

Volume-Controlled Audio Overlay

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Combine Audio Tracks
  • audio1
  • audio2
  • AUDIO
volume11.0
volume21.0

Combine Audio is the pack's answer to "I need a music bed under my dialogue" - it takes two AUDIO inputs, applies an independent volume to each, and overlays them into a single mixed track. It's a genuinely useful utility node in a pack that's mostly about visuals, and it's the only audio-mixing node in DJZ-Nodes. If you're assembling AI video with sound, this is how you get two audio sources onto one timeline without leaving ComfyUI.

The nice part is the per-track volume control: volume1 and volume2 run 0 to 2, so you can duck one track under the other - narration at full, music at 0.3 - and the node does the gain math for you.

How it works

Under the hood it's pydub doing the heavy lifting. The node pulls a file path out of each AUDIO input (it tolerates a few shapes - dicts with file/filename/path keys, or objects with the same attributes), normalizes both tracks to 44.1kHz stereo so mixing is well-defined, applies the volume as a linear-to-dB gain (dB = 20 * log10(volume)), and overlays them. The output is a pydub-style AUDIO dict with the mixed file path and a duration. It deliberately uses audio1's duration for the output, so if your two tracks differ in length, the shorter one just ends when the longer one does.

One honest caveat: the code is defensive to the point of being chatty. It prints a lot of debug lines to stderr about formats and dBFS levels. That's noise, not errors - ignore it.

The inputs that matter

  • audio1, audio2 - the two AUDIO inputs. Both required; there's no optional pass-through.
  • volume1, volume2 - 0–2 gain, default 1.0. Zero mutes a track; 2.0 is +6dB. For a bed under dialogue, try music at 0.3–0.5.

Output is a single AUDIO that wires into whatever audio-save node your workflow uses.

Installing it

Combine Audio ships in DJZ-Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt

Restart ComfyUI, or search "DJZ-Nodes" in ComfyUI Manager. This node specifically needs pydub (in the requirements) and a working ffmpeg on your PATH - pydub shells out to ffmpeg to read and write audio. If ComfyUI runs in an environment without ffmpeg, the node will fail at AudioSegment.from_file.

Common issues

The failure you'll actually hit is an AUDIO input whose shape this node can't figure out. It tries three key names and then gives up (falling back to reusing audio1 for audio2 in one branch, which silently mixes a track with itself - check your output if something sounds weird). So feed it AUDIO from standard loaders, and if you're using an exotic audio node, verify it exposes a file path. Sample-rate mismatch is handled (everything gets converted to 44.1k stereo), so that's not the problem - the input shape is. And if the whole thing errors, it just returns audio1 unchanged, which is a graceful failure but an easy one to miss.

Categoryaudio

Inputs (4)

NameTypeDefaultDescription
audio1AUDIO
audio2AUDIO
volume1FLOAT1.00–2
volume2FLOAT1.00–2

Outputs (1)

NameTypeDescription
AUDIOAUDIO