Pow2 (Audio Op)
The cheapest dynamic-range trick in the pack
- signal
- SIGNAL
OpPow2 (display name "Pow2 (Audio Op)") squares its input: every value of y becomes y². That's it. It's the smallest, simplest operator in ComfyUI-AudioReactive, and precisely because it's so dumb it's worth knowing when to reach for it.
Why square a signal? Squaring is a nonlinearity with a very specific personality: it exaggerates differences. Values below 1 get smaller (and toward zero, vanishingly so), values above 1 get bigger. Since an audio signal lives mostly in the small range, squaring quietly suppresses the quiet parts and makes the loud parts stand out more - it sharpens contrast and pulls the dynamics apart. It also makes everything non-negative, which is handy if you're feeding something that expects a positive-only envelope.
It's a port of the pow2 helper from dmarx's video-killed-the-radio-star notebook, where it sat alongside pow (raising to an arbitrary exponent), stretch, and smoosh as the "shape the curve" toolbox. Think of it as a quick-and-dirty way to make a driver curve punchier before it hits your animation parameters.
How it works
y ** 2, elementwise. No windows, no state, no parameters, no model - pure NumPy-style array math. Because there are no parameters, this is one of the few operators in the pack whose node wrapper actually matches its implementation (see the "stub" warning below for what happens when they don't). Output keeps the same length as the input - if you feed it a sample-level waveform you get a sample-level waveform; if you feed it a frame-level feature curve from Rms, you get a contrast-boosted version of that curve.
Inputs and outputs
signal(SIGNAL) - anything: raw waveform fromARReadAudio, or a feature curve fromRms/Novelty.SIGNAL- the same dict withysquared.
A nice pattern: Rms → Pow2 → SignalToCurve. The RMS envelope gives you 0..1 energy; squaring it pushes the quiet passages closer to zero so the loud hits dominate the curve you drive animation with. You get a snappier, more musical pulse without touching any parameters.
Installing it
Manager (search "AudioReactive") or:
cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-AudioReactive
Restart and let the first-load auto-install of scipy, scikit-learn, librosa, loguru finish (librosa brings numba; first start takes minutes). ModuleNotFoundError: No module named 'keyframed' on load → pip install keyframed.
Common issues
- Squared values look tiny - expected: audio samples live well below 1, so
y²is smaller thany. That's the point. If you want the full range back, follow withNormalize. - Don't confuse it with
Pow-OpPow2works today.OpPow(arbitrary exponent) is one of the parameterized operators whose wrapper doesn't expose its parameter yet, so it emits garbage. If someone's workflow has "Pow (Audio Op)" in it, swap it forPow2or wait for the pack to finish wiring its params. - Everything else in the "early port" bucket - single-commit pack, working core ops, stubbed parameterized ops.
Pow2is one of the good ones.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| signal | SIGNAL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SIGNAL | SIGNAL | — |