Nodes/ComfyUI-AudioReactor/Audio Frame Transform (Beats)
ComfyUI Node

Audio Frame Transform (Beats)

A one-pixel IMAGE that's secretly a drum trigger

By tocubed·Created 3 years ago·Updated 2 years ago· 9
Audio Frame Transform (Beats)
  • audio
  • IMAGE
sample_rate22050
frame_count1
fps1

If you've ever watched a "reactive" music video where the cuts land on the kick drum, this is the node that computes where those cuts go. It takes your loaded audio and turns it into a per-frame beat signal aligned to your video's frame rate. The output is typed as an IMAGE, but it will never look like a picture - each frame is exactly one pixel. That's the trick: ComfyUI's image pipeline is the easiest way to move per-frame signals around, so a 1×1 "movie" is a carrier pigeon, not art.

How it works: the node runs librosa's beat_track on the audio - tempo tracking plus onset detection, hop length 512 - converts the detected beat times to frame indices at your chosen fps, then builds a [frame_count, 1, 1, 3] tensor. One RGB pixel per frame, white on a beat, black off it, with an exponential decay (factor 0.8^(60/fps)) so each hit leaves a short fading tail instead of a hard on/off blink. Preview it and you'll see a single pixel strobing faster than your eye can follow, which is exactly the moment to stop previewing and start wiring.

The inputs: audio (from Load Audio), sample_rate (match the loader), frame_count, and fps. The last two are the ones you actually think about. frame_count should equal your target video's length in frames, and fps should be that video's frame rate - beat boundaries get snapped to those frame boundaries, so decide on the timeline before you build the rest of the workflow.

Output: one IMAGE, [frame_count, 1, 1, 3]. This is where ComfyUI's flexibility earns its keep. A 1×1 image per frame is exactly the shape of a control signal, and the standard audio-reactive trick is to convert it into weights and drive something with it - ControlNet strength, IPAdapter reference switching, or AnimateDiff motion amount. The best-known audio-reactive pack in the community, Yvann's nodes, works on precisely this principle: audio-derived weights that modulate control and motion rather than pixels. Crop it, convert it to a multival, or route it through whatever strength-mapping nodes you already use - it rides ordinary IMAGE wires the whole way.

Install is the shared pack install (see Load Audio): Manager search "ComfyUI-AudioReactor," or clone, pip install -r requirements.txt, restart. librosa is the only real dependency and it brings numba/scipy with it. No models, no GPU requirement - this analysis runs on CPU.

Gotchas worth knowing before you commit. First, frame_count and fps are your job - the node won't extend or trim the audio to fit your timeline, it just maps beats onto however many frames you ask for. Second, a sample_rate mismatch between this node and the loader silently produces beat detection on sped-up or slowed-down audio. Third, the output is genuinely 1×1; if you route it somewhere expecting a normal image you'll get a pixel, not a picture. And because this pack is a tiny 2024 personal project, there's no docs page or issue tracker to lean on - but the source is short and readable if something surprises you.

The honest summary: this node is a drum trigger for your video. Feed it audio and a frame count, and it tells you, per frame, whether a beat landed there. That's a deceptively powerful thing to know.

CategoryAudio Reactor

Inputs (4)

NameTypeDefaultDescription
audioAUDIO
sample_rateINT220506000–192000
frame_countINT11–262144
fpsINT11–120

Outputs (1)

NameTypeDescription
IMAGEIMAGE