ComfyUI Node

Float to Int

Round a weight curve into discrete frame indices

By yvann-ba·Created 2 years ago·Updated 6 months ago· 708
Float to Int
  • floats
  • ints

Some things want continuous weights; some things want integers. Float to Int is the pack's one-trick converter for the latter: take any list of floats, round every value to the nearest whole number, and hand back an INTS list of the same length. 0.3 → 0, 0.5 → 1, 2.7 → 3. That's the whole node - but "round to nearest int" is a surprisingly useful step in a video pipeline.

Where it fits

In the Yvann audio pipeline, floats are the language of weights, but a lot of downstream consumers speak integers:

  • Frame indices - turn a continuous curve into a set of discrete index values you can use to select specific frames or drive logic nodes.
  • Counts - convert a per-section amplitude into a per-section integer count (frames to skip, repeats to apply, batch sizes).
  • Bridging to integer-only nodes - plenty of ComfyUI utility and logic nodes want INT, and this is the clean cast point instead of fighting widget types mid-graph.

The rounding follows standard rules (0.5 rounds up), so 0.5 → 1, not 0. If you need floor or ceiling semantics, that's a different tool - this node is strictly round-to-nearest.

Gotchas

  • It's a list converter, not a scalar converter. It takes the pack's FLOATS list type and outputs INTS (a list). If you want a single integer from a single float, this isn't the node.
  • Rounding destroys dynamics. If you round a normalized 0–1 weight curve, you get mostly 0s and 1s - the shape vanishes. Only use this when integer semantics are actually what you want, not as a casual cast.
  • No input validation beyond the type - pass a list, get a list, done.

Install

Nothing special:

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 one-liner under the hood, so it's instant and dependency-light - one of those nodes you forget you have until you need it, and then you're glad it's there.

Category👁️ Yvann Nodes/🔄 Convert

Inputs (1)

NameTypeDefaultDescription
floatsFLOATSList of floats to round to nearest integers

Outputs (1)

NameTypeDescription
intsINTS