Sqrt (Audio Op)
Sqrt (Audio Op) — the name is a lie, it actually computes y⁻²
- signal
- SIGNAL
Straight to the point: OpSqrt does not compute a square root. Look at the source and you'll find:
def sqrt(y, sr):
return y**-2
That's inverse square, not square root. It shipped with the "Sqrt" display name anyway, probably because the author (dmarx, porting his video-killed-the-radio-star notebook) jotted the math down fast and never came back. So before you reach for this thinking it'll soften a curve the way smoosh does, know what you're actually getting.
What does y**-2 do to a signal? It's the inverse of pow2, and it's aggressive. Values below 1 (which is nearly everything in an audio signal) blow up when raised to a negative power: 0.5**-2 = 4, 0.1**-2 = 100. Near-silence becomes enormous. Since y in a SIGNAL is typically a normalized waveform in roughly [-1, 1], this produces huge, inverted-looking numbers - unless the signal is strictly positive (e.g., an RMS envelope), in which case it's a violent contrast flattener: it crushes the peaks toward 1 and yanks the quiet parts up to massive values.
Honest advice: this is the node in the pack most likely to make you think your graph is broken when it isn't. If you actually wanted a square root - the gentle compression smoosh does - grab OpSmoosh instead, which does normalize-then-y**0.5-then-normalize and is clearly the thing "Sqrt" was probably meant to be. If you genuinely want inverse-square contrast shaping, this works, but you'll usually want Normalize right after so the output stays in a usable range.
Inputs and outputs
signal(SIGNAL) - fromARReadAudioor upstream of another operator.SIGNAL-yreplaced byy**-2, same length as the input. Feed it toARDrawSignalbefore you trust it, because the numbers will look weird even when it's doing what it says.
Installing it
Manager (search "AudioReactive") or:
cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-AudioReactive
Restart and wait out the first-load auto-install of scipy, scikit-learn, librosa, loguru (librosa pulls numba). If the pack won't load with ModuleNotFoundError: No module named 'keyframed', pip install keyframed.
Common issues
- Output numbers are enormous - that's
y**-2beingy**-2. Follow withNormalizeor pickSmoosh. - You expected a square root - this isn't one. That's not you misunderstanding the node; the node is mislabeled.
- Curve blows up to infinity near zero - raising near-zero values to a negative power diverges; the floating-point result can be huge (or inf). If the pack's
normalizewere applied you'd be fine, but this op doesn't normalize. - General early-port caveat - this op works (it computes what the source says), but the pack is a fresh single-commit port with a one-line README and several parameterized operators left as unwired stubs. Read the source before trusting display names around here.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| signal | SIGNAL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SIGNAL | SIGNAL | — |