Nodes/Deforum Nodes/(deforum) Audio to Beat Amplitude
ComfyUI Node

(deforum) Audio to Beat Amplitude

The quick-and-dirty beat detector that needs no parameters

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) Audio to Beat Amplitude
  • audio
  • beat_times

(deforum) Audio to Beat Amplitude is the no-fuss member of the pack's beat-detection pair. You hand it an AUDIO object, it scans the signal for transient energy peaks, and it returns the timestamps of the beats as an AMPLITUDE series. It has exactly one required input and zero parameters to tune - which is either a blessing (nothing to get wrong) or a limitation (nothing to adjust), depending on how picky your source audio is. For most music with a clear kick, it just works.

How it works

The mechanism is a classic envelope-detection approach, and it's worth knowing because it explains both its strengths and its limits. The node computes the analytic signal of the first audio channel with a Hilbert transform, takes the magnitude to get an energy envelope, smooths it with a Gaussian filter, and normalizes it to 0–1. Then it runs scipy.signal.find_peaks with a fixed height threshold of 0.3 and reports the peak positions - converted from sample indices to seconds - as the beat times.

That's a threshold over the smoothed energy envelope. Loud, well-separated transients (a kick on the one) sail past 0.3 and get flagged; quiet, busy, or highly compressed music can either under-detect (nothing crosses the bar) or over-detect (every snare hits counts). The output beat_times series is indexed by beat number, with the value being the time in seconds - which is why these nodes call the output type AMPLITUDE even though it's really a timestamp list.

The inputs and outputs

  • audio - required AUDIO input. The pack reads the first channel if the audio is stereo, so multi-channel files are fine.
  • beat_times - the single output, an AMPLITUDE series of beat timestamps in seconds.

There's no sample_rate knob here (the v2 node, (deforum) Beat Detection v2, has one because it uses a different engine). This node just uses whatever the audio carries.

Which detector should you pick?

The pack ships two beat detectors, and this one is the heuristic one. If your source is a clean electronic track with obvious kicks, this gets you 80% of the way with zero configuration. If you're working with messy audio - live recordings, vocals-forward tracks, heavily compressed masters - the v2 node's librosa-based beat_track tends to lock onto a steadier tempo and is usually the better bet. A decent workflow: try this node first, and if the beat times look erratic when you plot them against the track, swap in v2 rather than fighting the threshold you can't change.

Installing it

Part of Deforum Nodes (XmYx). Install via ComfyUI Manager ("Deforum Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes.git

Restart ComfyUI and let install.py finish on first load - it installs librosa, scipy, opencv-contrib-python, moviepy, numpy<2.0.0 and the deforum-studio backend. The README calls for Python 3.10.

Where people get burned

The fixed 0.3 threshold is the thing to remember. If your beats don't register, it's not a wiring error - the track just doesn't have the transient headroom the detector expects, and the fix is the v2 node or a bit of pre-gain/limiting on the audio before it hits this node. And don't confuse the output with a per-frame amplitude: beat_times is a list of when beats happened, not how hard. If you want per-frame beat energy to drive zoom, feed this into a node that converts timestamps into a frame-length series instead.

Categorydeforum/audio

Inputs (1)

NameTypeDefaultDescription
audioAUDIO

Outputs (1)

NameTypeDescription
beat_timesAMPLITUDE