Nodes/RobeNodes/Peaks Weights Generator 🐀
ComfyUI Node

Peaks Weights Generator 🐀

Mark the beats before the video reacts

By RobeSantoroΒ·Created 2 years agoΒ·Updated 3 months agoΒ· 0
Peaks Weights Generator 🐀
    • peaks_weights
    • count
    β—„frames_count0β–Ί
    β—„one_indices0, 4, 8, 12β–Ί
    β—„specify_peaks_manuallyfalseβ–Ί
    β—„peaks_binary_string[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]β–Ί

    Audio-reactive video lives on per-frame weights: a 1 where the beat hits, a 0 everywhere else, and a downstream node turns those weights into strength or motion. This node is how you build that 1-and-0 list without hand-writing it. Give it your frame count and either a list of "peak" frame indices or a manual binary string, and it returns a weights list plus a peak count - built explicitly to feed the Generate Peaks Weights style of node from the Yvann Nodes suite, the de-facto standard for this niche.

    How it works

    Two paths in, selected by the specify_peaks_manually toggle:

    Path one (default): frames_count + one_indices. Type which frames are peaks - 0, 4, 8, 12 - and the node builds a list of frames_count zeros with a 1 at each of those indices. Peaks every 4th frame over a 16-frame clip, exactly as the defaults suggest.

    Path two: specify_peaks_manually on, and peaks_binary_string carries the whole weight list as a Python-style array: [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]. It's parsed with ast.literal_eval and validated so every element is a 0 or 1 before it's accepted.

    Both paths return the same two outputs:

    • peaks_weights (FLOATS) - the per-frame 0/1 list, ready for an audio-reactive strength node
    • count (INT) - the number of peaks, i.e. the sum of the 1s

    Where it fits

    This is a pre-computation node. You wire peaks_weights into the audio-reactive weighting node downstream (Yvann's suite and its relatives consume these lists to drive per-frame strength, masking, or camera motion - a workflow people genuinely run, if often with a big GPU and a long render). It's a small node that turns a tedious, error-prone data-entry step into two fields.

    Installing the pack

    Search "Robe Nodes" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/RobeSantoro/ComfyUI-RobeNodes
    

    Restart ComfyUI. No downloads; this node touches none of the pack's heavier dependencies.

    Where people get burned

    Two failure modes, both silent-ish. Out-of-range indices (e.g. frame 40 on a 16-frame clip) are quietly skipped - no error, you just get fewer peaks than you typed. And an invalid peaks_binary_string (something that isn't a 0/1 list) prints an error to the console and returns an empty list with count 0, so your downstream node gets nothing. If you're hand-writing binary strings, keep them exactly [1, 0, ...] formatted. And remember count is just sum(peaks_weights) - it's a sanity check, not a separate knob.

    The node does what its name says and stays out of the way. That's the right shape for the boring-but-critical step between "I found the beats" and "my video reacts to them."

    CategoryRobeNodes

    Inputs (4)

    NameTypeDefaultDescription
    frames_countINT0β€”
    one_indicesSTRING0, 4, 8, 12β€”
    specify_peaks_manuallyBOOLEANfalseβ€”
    peaks_binary_stringSTRING[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]β€”

    Outputs (2)

    NameTypeDescription
    peaks_weightsFLOATSβ€”
    countINTβ€”