ComfyUI Node

Invert Floats

Flip a weight curve so silence becomes motion

By yvann-ba·Created 2 years ago·Updated 6 months ago· 708
Invert Floats
  • floats
  • inverted_floats

Invert Floats does one thing: takes a list of floats and flips every value around the midpoint of the list's own min–max range. If your weights run 0 to 1, a 0.3 becomes 0.7 and a 0.9 becomes 0.1. The loud parts go quiet, the quiet parts go loud, and the shape of the curve is preserved - just upside down.

Why you'd want that

Audio-reactive workflows generate weights that describe when the music is energetic. But the video you want doesn't always want motion on the loudest beats:

  • Calm during the drop. Animate a stillness that holds through the loud section and releases in the gaps. Invert the weights before they hit the motion module and the opposite of the beat drives the motion.
  • A/B switching. Combine inverted and non-inverted curves to drive two complementary effects that trade off - one active when the other is quiet.
  • Experiments. Invert just to see what the mirror of your analysis looks like; sometimes the "wrong" curve is the more interesting one.

The inversion is relative to the midpoint of your actual data (min + max)/2), not a fixed 0.5. So a list that runs 0.2 to 0.8 flips around 0.5, and a list running 0.0 to 0.6 flips around 0.3 - the result stays inside the original range. That's a nice property: no scaling surprise, the output occupies the same territory as the input, just mirrored.

Where it plugs in

It's a pure utility in the FLOATS world. Typical spot: hang it between Audio Analysis and Edit Audio Weights, or between Edit Audio Weights and whatever consumes the curve, to reverse the direction of a whole branch. Because it's one in / one out with no parameters, you can drop it into an existing graph without touching any other node.

Gotchas

  • It needs a real min and max. If every value in the list is identical (a flat curve), min equals max and the midpoint is that same value - inverting produces identical values. No harm, no effect, but don't expect magic from a flat input.
  • It inverts the curve, not the meaning. If you invert "loudness," you get "quietness," which isn't the same as "opposite instrument." For true complementarity you'd want the separation model's other stems - this node only mirrors numbers.
  • Six-decimal rounding on output keeps things tidy; no behavior to worry about.

Install

The pack's standard one-liner:

cd ComfyUI/custom_nodes
git clone https://github.com/yvann-ba/ComfyUI_Yvann-Nodes

or ComfyUI Manager → search ComfyUI_Yvann-Nodes. It's a numpy operation, instant and dependency-free beyond the pack. A tiny node, but the kind that unblocks a whole class of "actually, what if it moved in the opposite direction" ideas.

Category👁️ Yvann Nodes/🛠️ Utils

Inputs (1)

NameTypeDefaultDescription
floatsFLOATSList of float values to invert relative to range midpoint

Outputs (1)

NameTypeDescription
inverted_floatsFLOATS