ComfyUI Node

BPM Detector

Pulling a real BPM out of any audio

By grmchn·Created 4 months ago·Updated 4 months ago· 0
BPM Detector
  • audio
  • bpm

BPM Detector is the front door of the ComfyUI-Rhythm-Tracks pack, and it does exactly one thing: you feed it audio, it hands you a number. That number is the tempo in beats per minute, and you wire it straight into DrawRhythmTracks or RhythmGenerator so the motion actually lands on the music instead of on a guess.

Why bother with a node for this? Because tempo is a trap when you hand-type it. A song that feels like 140 might be a half-time 70 that your brain fills in, and then every swing in your video is off by a factor of two. This node measures the actual waveform, so the BPM you start from is the track's real one - and in a pack built for BPM-synced motion control, that's the whole game.

How it works

The mechanism is short and honest: the node takes the audio input (an AUDIO tensor from a Load Audio node, exactly as the tooltip says), squashes it to mono by averaging the channels, and hands it to librosa.beat.beat_track. That's the same tempo-estimation routine audio tooling has leaned on for years, based on onset energy and a dynamic tempo tracker. It then coerces the result to a plain float - librosa has returned arrays in newer versions, so the code defensively unwraps it - and that's your bpm.

There are no settings. No optional inputs, no strength knobs, nothing to tune. You plug audio in and read the float out.

What to know before you trust the number

  • It's one global tempo for the whole clip. If the track changes tempo mid-song, you get an average-ish read, not a timeline. Fine for a locked loop, wrong for a song with a tempo map.
  • Half/double tempo is the classic miss. Librosa's tracker locks onto periodicities, and it will happily report 70 where you'd count 140. If the number feels off, the fix is boring but effective: double it or halve it by hand before it goes downstream.
  • It's a mono mixdown. Stereo width gets averaged away, which is fine for tempo detection - you're counting beats, not mix position.
  • You get a BPM, not a beat grid. No onset positions, no downbeat info. Just the tempo, which is all the other nodes in this pack ask for.

The one input that matters is audio, and the one output that matters is bpm (a FLOAT). Drag it into the bpm socket of DrawRhythmTracks or RhythmGenerator and you're synced.

Install

ComfyUI Manager is the easy route - search "ComfyUI-Rhythm-Tracks" and restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/grmchn/ComfyUI-Rhythm-Tracks
cd ComfyUI-Rhythm-Tracks
pip install -r requirements.txt

The requirements are just librosa and torchaudio; PyTorch and numpy come with ComfyUI. No model files to download, no GGUF, no checkpoints - this pack is featherweight. The one real catch: it's written against ComfyUI's newer Node SDK (comfy_api.latest), so it needs a reasonably recent ComfyUI. If the node fails to load or the import errors, update ComfyUI before you blame the node. It's a small pack from a hobbyist author (grmchn, who posts AI audio/video experiments on X as @grmchn4ai), so don't expect a support team - but this node is simple enough that it rarely needs one.

Categoryrhythm/audio

Inputs (1)

NameTypeDefaultDescription
audioAUDIOAudio input from Load Audio node.

Outputs (1)

NameTypeDescription
bpmFLOAT