ComfyUI Node

Pow (Audio Op)

Pow — arbitrary exponent shaping, and the builtin-`pow` collision that left it a stub

By dmarx·Created 3 years ago·Updated 2 years ago· 11
Pow (Audio Op)
  • signal
  • SIGNAL

OpPow (display name "Pow (Audio Op)") is meant to be the general version of Pow2: raise the signal to an arbitrary exponent k, so you can do mild shaping (y**1.3) or extreme shaping (y**8) instead of only the fixed square. In the source, the author even left a note about the naming collision that's half the story here:

# so... apparently `pow` is a python builtin. whoops. Meh, fuck it.
def _pow(k):
    def pow_(y, sr):
        return y**k
    return pow_

He hit the classic "my function name shadows a builtin" problem, prefixed it with an underscore, and moved on. Which is fine - except the wrapper never got the k input wired up.

The honest status: it's a stub

_pow is a factory - you call _pow(k) to get a raising function. But the node wrapper in nodes/audio_operator_nodes.py calls every operator as f(y, sr), so it calls _pow(y, sr) with the signal as the exponent. That doesn't raise anything to any power; it returns a closure parked in the SIGNAL's y slot. The node "runs" cleanly, and the garbage - a Python function object - flows downstream until something that does actual math explodes with a TypeError.

The info_schema tells the same story: the node exposes only a signal input. There's no exponent input at all. So as shipped, Pow is unusable, and it's not you - it's the port being unfinished. This is one of a whole family (Pow, Bandpass, Clamp, Modulo, Quantize, Smooth, Sustain) that shares the "real backend, unwired wrapper" pattern in dmarx's port of his video-killed-the-radio-star notebook.

What to do instead

  • Need fixed squaring? Use OpPow2 - it works, no parameters needed.
  • Need an arbitrary exponent? The working Stretch (normalize → square → normalize) and Smoosh (normalize → sqrt → normalize) give you the two most useful shaping curves without needing Pow. Or take a curve through SignalToCurve and do the exponent math in the keyframe domain.
  • Watch the repo. The backend is a one-liner away from working; it needs the wrapper to expose a k input and call _pow(k) properly.

Inputs and outputs

As shipped:

  • signal (SIGNAL) - in.
  • SIGNAL - out, containing a function object rather than a raised signal. Don't build on it.

Installing it

Manager (search "AudioReactive") or:

cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-AudioReactive

Restart and sit through the first-load auto-install of scipy, scikit-learn, librosa, loguru (librosa drags in numba). ModuleNotFoundError: No module named 'keyframed' on load → pip install keyframed.

The takeaway

Pow is a "build on the siblings, wait on the wrapper" node. The pack around it is worth using - the core feature ops (Rms, Novelty, Predominant_Pulse, Harmonic, Percussive) and the shapers (Stretch, Smoosh, Normalize, Pow2) all work - but treat every parameterized operator here as a placeholder until the repo catches up.

CategoryAudioReactive/Operators

Inputs (1)

NameTypeDefaultDescription
signalSIGNAL

Outputs (1)

NameTypeDescription
SIGNALSIGNAL