(deforum) Audio Schedule Expression Templates
53 ready-made math expressions for your audio schedules, no trial-and-error
- STRING
Every audio-reactive schedule needs a math expression - the math field in (deforum) Amplitude to Schedule that turns raw amplitude into motion. Writing those by hand means remembering that sin, exp, and pi are all available, guessing at the scale, and typo-ing your way through the first render. (deforum) Audio Schedule Expression Templates is the pack's cheat sheet: a dropdown of 53 pre-written expressions that outputs the chosen one as a STRING. Pick one, wire it to the math input of a schedule node, done. It's filed under deforum/help, and that's exactly what it is.
How it works
The node does one trivial thing: it returns the selected expression string. The real content is the list, which is thoughtfully organized in two layers. The first group is simple transforms on x (the amplitude value): x * 2, x / 2, abs(x), x * x, sqrt(abs(x)), log(abs(x) + 1), x * sin(x), -x, x * (exp(x) - 1), min(x, 0.5), max(x, -0.5), x % 0.5, tan(x), 1 / (abs(x) + 1), pow(e, -abs(x)) - quick shaping of a single amplitude value. The second layer is time-based, where the expressions also use t (frame index) and max_f (total frames): x * t / max_f for linear growth, x * sin(2 * pi * t / max_f) for a sinusoidal pulse over the clip, x * exp(-t / max_f) for decay, triangle-wave shaping, factorial modulators, conditional branches like x * sin(...) if t < max_f / 2 else x * cos(...). These are the classics of the Deforum community, collected so you don't have to re-derive them.
The inputs and outputs
expression- the dropdown with 53 entries.STRING- the selected expression, ready to plug into amathinput.
How to use it well
The workflow is: drop this node, pick an expression, wire the STRING into the math input of (deforum) Amplitude to Schedule. For a first pass, the time-based expressions are the better starting point than the pure x transforms - they give motion that evolves over the whole clip instead of just scaling the raw audio. And don't treat the list as gospel; it's a starting library. The moment you want something it doesn't have, you can paste the template into the math field and edit it - the templates teach you the syntax (sin, cos, exp, pi, e, t, max_f) so writing your own stops being guesswork.
Installing it
Part of Deforum Nodes (XmYx). ComfyUI Manager → "Deforum Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes.git
Restart and let first-boot install.py finish (librosa, pandas, opencv-contrib-python, moviepy, numpy<2.0.0, deforum-studio backend). Python 3.10 per the README.
Where people get burned
Two small things. First, this node outputs a string, not a magic number - it only helps if you actually wire it into the math input of a schedule node; leave it dangling and it does nothing (it's marked as an output node, so it'll show in the UI, but it's inert). Second, the expressions assume the variables exist. If you copy a template into a context that doesn't define t or max_f, the evaluation fails - stick to wiring the templates as-is into Amplitude to Schedule, which defines all of them.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| expression | COMBO | 53 options: x * 2, x / 2, abs(x), x * x, sqrt(abs(x)), log(abs(x) + 1), +47 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |