ComfyUI Node

AudioTempoMatch

Sync two tracks to the same BPM automatically

By christian-byrne·Created 2 years ago·Updated 4 months ago· 591
AudioTempoMatch
  • audio_1
  • audio_2
  • AUDIO
  • AUDIO

AudioTempoMatch takes two audio tracks running at different tempos and stretches both of them to meet in the middle. Feed it a 120 BPM track and a 100 BPM track, and you get two tracks back, both at 110 BPM - the average of the two. It's a one-node shortcut for a job that would otherwise mean detecting tempo, doing the ratio math, and running a manual stretch yourself.

Why you'd reach for it

This is for the mashup-and-crossfade case: you've got two songs, two stems, or a generated track and a reference track, and you want them to line up rhythmically instead of drifting against each other. Rather than running AudioGetTempo on each one, computing a target BPM by hand, and feeding that into two separate AudioSpeedShift calls, this node folds all three steps into one. If you ever do want manual control - say, matching to a specific target BPM rather than the average of the two - that's when you'd drop down to AudioGetTempo + AudioSpeedShift instead; this node's whole value is that it picks the midpoint for you and applies it automatically.

How it works

Per the node's own description: it works out the tempo of each input, then time-stretches both tracks to their average BPM - neither track is treated as the "reference" that the other one has to match; they both move toward each other. Given this pack builds its other tempo tooling (AudioGetTempo) on librosa's onset-detection-based tempo estimation, it's reasonable to expect this node uses the same detection approach internally before applying the stretch - though the info schema doesn't expose that step directly since there's nothing to configure.

The inputs and outputs that matter

Two required inputs, no optional settings:

  • audio_1 - the first track.
  • audio_2 - the second track.

Two AUDIO outputs, in the same order you plugged the inputs in - the first output is your audio_1 after being stretched to the shared average tempo, the second is audio_2 treated the same way. Both come out at the same BPM, ready to layer, crossfade, or feed into AudioCombine.

Installing it

Search audio-separation-nodes-comfyui in ComfyUI Manager, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/christian-byrne/audio-separation-nodes-comfyui, cd in, pip install -r requirements.txt, restart ComfyUI. Like the rest of the tempo and speed nodes in this pack, it runs on librosa - no model checkpoint to download, no GPU needed.

Common issues

Nothing here touches the Demucs model, so the checkpoint-corruption issue documented for AudioSeparation is irrelevant to this node. The failure modes worth knowing about are inherited from the two operations it chains together: tempo detection can suffer octave errors on some material (reporting double or half the "real" tempo, which would throw off the average it computes), and heavy time-stretching on tracks that are already far apart in tempo can introduce audible artifacts - the further apart your two inputs start, the more each one has to move to reach the average, and the more it'll sound stretched. If two tracks are wildly different tempos (say, 70 and 180 BPM), don't expect a seamless result; this node is built for nudging clips that are already reasonably close, not rescuing a mismatch that large.

Categoryaudio

Inputs (2)

NameTypeDefaultDescription
audio_1AUDIO
audio_2AUDIO

Outputs (2)

NameTypeDescription
AUDIOAUDIO
AUDIOAUDIO