Nodes/FizzNodes/SquareWave πŸ“…πŸ…•πŸ…
ComfyUI Node Runs on cloud

SquareWave πŸ“…πŸ…•πŸ…

An on/off switch that follows the beat of your animation

By FizzleDorfΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 479
SquareWave πŸ“…πŸ…•πŸ…
    • FLOAT
    • INT
    β—„phase1β–Ί
    β—„amplitude0.5β–Ί
    β—„x_translation0β–Ί
    β—„y_translation0.50β–Ί
    β—„current_frame1β–Ί

    SquareWave is the bluntest instrument in the FizzNodes wave family, and that's a compliment. Where SinWave and TriangleWave glide between values, this one snaps: the output is either at the top of its range or the bottom, with no easing and no in-between. Feed its FLOAT output into a numeric input and that parameter flips on and off, frame after frame, at a rate you control. Perfect for strobing effects, blink patterns, on-beat cuts, or anything that wants a hard binary state rather than a smooth ramp.

    It shares its five inputs with the sine family - phase, amplitude, x_translation, y_translation, and current_frame - and the meaning carries over: phase is the cycle length in frames, amplitude the swing, y_translation the center, x_translation the horizontal shift. In a 24fps animation, phase of 12 gives you a flip every half second. The INT output is the float truncated, which works nicely when the thing you're toggling wants a whole number.

    What it's for

    Because the square wave's only two states map so cleanly onto booleans, it's the wave you reach for when you want a parameter to switch on a schedule rather than oscillate. The classic use is audio-reactivity: if you sync the phase to the beat of a track (the README points at framesync.xyz for exactly this), you get a light that snaps on every hit. It's also handy as a poor-man's gate - drive a blend weight or a controlnet strength with it and the effect pops in and out instead of fading.

    Install and gotchas

    Same pack, same install. ComfyUI Manager β†’ search FizzNodes β†’ install β†’ restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/FizzleDorf/ComfyUI_FizzNodes
    cd ComfyUI_FizzNodes && pip install -r requirements.txt
    

    Dependencies are just numpy, pandas, numexpr. The node sits under FizzNodes πŸ“…πŸ…•πŸ… β†’ WaveNodes.

    The trap is expecting smoothness that the node never promised. A square wave spends its whole cycle at the extremes, so if your parameter visibly jumps, that's the design - if you wanted the fade between states, use SinWave or TriangleWave instead. And the usual family caveat: current_frame must actually advance, or you'll stare at one frozen state wondering why nothing blinks.

    CategoryFizzNodes πŸ“…πŸ…•πŸ…/WaveNodes

    Inputs (5)

    NameTypeDefaultDescription
    phaseFLOAT10–9999β€”
    amplitudeFLOAT0.50–9999β€”
    x_translationFLOAT00–9999β€”
    y_translationFLOAT0.500–9999β€”
    current_frameINT10–9999β€”

    Outputs (2)

    NameTypeDescription
    FLOATFLOATβ€”
    INTINTβ€”