ComfyUI Node

Abs (Audio Op)

Make everything non-negative before it feeds an envelope

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

OpAbs (display name "Abs (Audio Op)") applies the absolute value to its input signal - every sample goes positive. The implementation is np.abs(np.abs(y)) (the double-wrap is harmless; the author was being careful). It's the quiet, boring utility of ComfyUI-AudioReactive, and it's exactly the kind of node you won't think about until you're feeding a bipolar waveform into something that wants only positives.

Why would you ever need this? A raw audio waveform swings negative. A lot of downstream uses - driving an envelope, feeding a curve, comparing magnitudes - don't want the sign, they want "how big is this regardless of direction." Rectify the waveform with Abs and a sine wave becomes a train of half-bumps that, smoothed, reads as an energy envelope. It's the raw-DSP cousin of Rms, which does the rectification work implicitly inside its frame averaging.

It's a working operator from the pack's port of dmarx's video-killed-the-radio-star notebook. Simple, no parameters, no state.

How it works

Elementwise absolute value over y. Nothing else happens: no normalization, no resampling, same length in, same length out. Because it's sample-level and lossless-in-information (you just discard the sign), it plays fine before almost anything - stack it ahead of Smooth-style filtering or an RMS pass and you've essentially built a cheap envelope follower by hand.

One honest caveat: the pack's Normalize op already applies abs() internally, and Stretch/Smoosh normalize as part of their pipeline. So if you're already running one of those, Abs is redundant. It earns its keep mainly when you're chaining raw ops yourself - say, Abs → Pow2 to build a squared-energy curve, or Abs ahead of ARDrawSignal when you want to see the folded waveform rather than the bipolar one.

Inputs and outputs

  • signal (SIGNAL) - any signal: raw waveform from ARReadAudio, or a feature curve (abs of an already-positive envelope is a no-op, but harmless).
  • SIGNAL - y replaced by |y|, same length.

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 pulls numba, so first start takes minutes). ModuleNotFoundError: No module named 'keyframed' on load → pip install keyframed.

Common issues

  • Output is never negative - that's the point; don't chase a "bug" that's the feature.
  • No visible change on already-positive curves - correct; an envelope is already non-negative, so Abs is a pass-through there.
  • Doubled amplitude concerns - folding a bipolar waveform doubles its effective energy (the negative lobe folds up on top of the positive one). If you follow with Normalize you're fine; if you don't, the peak can sit around 2× what you expect on a loud track.
  • Early-port bucket - this one works as advertised; the pack's parameterized operators (Bandpass, Smooth, Sustain, Modulo, Quantize, Pow, Clamp) are still unwired stubs. Build on the working set.
CategoryAudioReactive/Operators

Inputs (1)

NameTypeDefaultDescription
signalSIGNAL

Outputs (1)

NameTypeDescription
SIGNALSIGNAL