(deforum) Derive Amplitude
When Your Animation Needs the Attack, Not the Loudness
- amplitude
- amplitude_derivative
An amplitude curve tells you how loud the music is. A derivative tells you how fast it's changing - and for audio-reactive animation, that second number is often the one you actually want. (deforum) Derive Amplitude is a one-input, one-output utility from the Deforum Nodes pack that computes the rate of change of an amplitude series so you can drive camera moves off transients and drum hits instead of sustained volume.
How it works
The implementation is a single line: np.diff(amplitude, prepend=amplitude[0]). It subtracts each sample from the next - the classic discrete derivative - and the prepend trick keeps the output the same length as the input, which matters because Deforum schedules expect a value per frame. No other math, no smoothing built in.
Why bother? Think about what a raw amplitude envelope looks like for a drum beat: a sharp spike when the hit lands, then a decay. The amplitude itself is high during both the attack and the tail. The derivative spikes hard at the start of the hit - the attack - and drops near zero (or negative) during the decay. So the derivative is effectively a crude onset detector. If you want a zoom punch that fires exactly when the kick lands, the derivative fires earlier and sharper than the amplitude does.
Inputs and output
- amplitude (AMPLITUDE) - the only input. Feed it an envelope, a frequency-band amplitude, a beat series, anything that comes out of the Deforum audio chain with the AMPLITUDE type.
- amplitude_derivative (AMPLITUDE) - same-length output, same type, ready to plug straight into an "Amplitude to Schedule" node or a deforum parameter node.
Because the output keeps the AMPLITUDE type, you can chain this thing - derive a derivative, smooth it, threshold it, invert it - before it ever touches a schedule. It's a pure signal-processing brick.
Where it fits
This is one of the audio nodes in XmYx's Deforum port, the ComfyUI-native take on the animation engine that made A1111's Deforum extension a household name in late 2022 (the KB's ui-history essay documents that era). The pack expects an AUDIO/AUDIO_FFT object from the surrounding Deforum audio ecosystem - the README points you at ComfyUI-AudioScheduler as a companion - and turns it into schedules you can plug into the Deforum params nodes. Note that no audio workflow ships in the pack's examples folder; the audio nodes are the experimental frontier of the project, and the Discord is where the real workflows circulate.
Installing it
Same pack as everything else:
cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes.git
Restart ComfyUI, or use Manager → "Deforum Nodes" by XmYx. The full pack install is heavy - deforum-studio from git plus librosa, moviepy, av, pydub, opencv-contrib, and a numpy<2.0.0 pin - and the README requires Python 3.10. If you only want the audio nodes you still pay for the whole install; the pack imports everything on load.
Common issues
Because the derivative has no smoothing, it's noisy - a quiet hiss in your track can produce bigger derivative spikes than the actual beat. Run the result through the pack's time-smoothing node or zero it below a threshold before it reaches a schedule, or your animation will twitch on background noise. And if the pack itself won't load, check for the classic orphan: an old A1111 deforum package in your Python. pip uninstall deforum, then retry, fixes that one most of the time.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| amplitude | AMPLITUDE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| amplitude_derivative | AMPLITUDE | — |