Audio Mix
Lay two audio tracks on top of each other, with per-track gain and offset
- audio_a
- audio_b
- audio
- output_path
- duration_sec
- summary
This is the "put the music under the dialogue" node. MKRAudioMix takes two audio sources, applies a gain to each, optionally slides one in time, and sums them into a single track - with peak normalization on by default so the result doesn't immediately clip. It's the difference between a ComfyUI pipeline that produces silent clips and one that produces finished, laid-out audio.
It's in the Utility branch of the MKRShift_Nodes audio set, which makes the distinction worth naming: Mix overlaps (durations add to the max, not the sum) while Concat chains end-to-end. If you want two clips to play at the same time, this is your node; if you want them back-to-back, use MKRAudioConcat next door.
How it works
When both inputs are real files and ffmpeg is present, it uses an ffmpeg filter_complex chain: volume on each input, then amix with normalize=0 (so it doesn't rescale your levels behind your back). A positive offset_b_ms delays track B (adelay), a negative one trims its start (atrim). If normalize_peak is on, it follows with a limiter at 0.98 so the mix stays just under full scale.
There's a pure-numpy fallback for when ffmpeg is missing or the inputs are waveform payloads: it resamples both to the higher sample rate, aligns channel counts, shifts by samples, pads the shorter track to the longest, sums with your dB gains, and normalizes. Same result, slower, no copy fast path.
Inputs that matter
audio_a,audio_b- the two tracks. A is "first", B is the one you can offset.gain_a_db,gain_b_db- per-track level, −40 to +40 dB. The standard mix move: music at −12 dB under voice at 0.offset_b_ms- −600000 to +600000 ms, default 0. Slide track B in time relative to A. Note it's milliseconds, so "5 seconds later" is 5000.normalize_peak- default on here (unlike most MKR audio nodes). This is deliberate: a sum of two signals almost always peaks higher than either alone.- Standard save block:
output_format,filename_prefix,subfolder,overwrite, optionalfilename_label.
Outputs: audio (MKR_AUDIO), output_path, duration_sec, summary (which mode ran - file_ffmpeg or waveform).
Install
ComfyUI Manager (search "MKRShift Nodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
Restart. The ffmpeg path is the good one for files; the numpy path covers everything else. No models.
Common issues
The offset sign trips people: offset_b_ms delays B into the mix, so a positive value pushes B later (it starts after A has begun), not earlier. If you want B to start first, negative. Also, because normalize=0 is set on the amix, the node won't fight your gain decisions - you're responsible for the balance, and normalize_peak only rescues the final peak, not your relative levels. And if one input is mono and the other stereo, the mono one is duplicated across channels (not panned to one side), which is usually what you want but worth knowing.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| audio_a | * | — | |
| audio_b | * | — | |
| gain_a_db | FLOAT | 0.0-40–40 | — |
| gain_b_db | FLOAT | 0.0-40–40 | — |
| offset_b_ms | INT | 0-600000–600000 | — |
| normalize_peak | BOOLEAN | true | — |
| output_format | COMBO | auto | 5 options: auto, wav, mp3, flac, ogg |
| filename_prefix | STRING | MKR_audio_mix | — |
| subfolder | STRING | — | |
| overwrite | BOOLEAN | false | — |
| filename_labelopt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| audio | MKR_AUDIO | — |
| output_path | STRING | — |
| duration_sec | FLOAT | — |
| summary | STRING | — |