Nodes/ComfyUI-Keyframed/KfSinusoidalWithFrequency
ComfyUI Node

KfSinusoidalWithFrequency

A sine-wave generator for people who hate keyframe strings

By dmarx·Created 3 years ago·Updated 2 years ago· 92
KfSinusoidalWithFrequency
    • KEYFRAMED_CURVE
    • SINUSOIDAL_CURVE
    frequency0.08
    phase0.0000
    amplitude1.00

    Most of the ComfyUI-Keyframed pack is about turning prompts into timed curves - that's the "prompt scheduling" workflow you came for. KfSinusoidalWithFrequency is the other side of the library: a pure oscillator. Give it a frequency and it hands back a curve that bounces forever between -amplitude and +amplitude, like a metronome drawn on graph paper. If the packed-in Entangled Curves nodes are the all-in-one version, this is the raw material you build your own from.

    You reach for it when a parameter should breathe rather than step. A LoRA weight that waxes and wanes across the animation, a denoise strength that pulses, some value oscillating in the background while your schedule does the talking. When people ask "can I do that with a curve?", this is the node that says yes.

    How it works

    Under the hood it constructs a SinusoidalCurve from the keyframed library - the whole pack is a ComfyUI wrapper around dmarx's own keyframed Python package. The formula is what you remember from high school: amplitude * sin(2π · frequency · t + phase). Three practical consequences:

    • Frequency is cycles per time step, where a time step is a frame in your animation. The default 1/12 means one full sine cycle every 12 frames.
    • The curve starts at 0, not at the top. sin(0) = 0, so at t=0 the value is 0 and rising. Want it to start at its peak? Nudge the phase.
    • It oscillates around 0. With default amplitude 1 it swings between -1 and +1. The Entangled Curves nodes do the 0-to-1 trick where several sines sum to exactly 1; this node does none of that.

    The inputs that matter

    Only three, and you'll touch all of them eventually:

    • frequency - cycles per frame, default 1/12. Smaller means a slower wave. If you think in "frames per loop" instead, use KfSinusoidalWithWavelength; they describe the same thing.
    • phase - phase offset in radians, default 0. The step is π/24, so it's tuned for fine nudging rather than free typing. π (≈3.14) flips the wave upside down.
    • amplitude - peak height, default 1. Dial it to 0.5 for a gentler swing.

    The two outputs (same curve, two coats)

    This is the quirk that trips people up. The node returns (curve, curve) - literally the same object on both sockets, but typed differently:

    • KEYFRAMED_CURVE - for the general keyframed ecosystem: curve arithmetic (Curve_1 * Curve_2), Apply Curve to Conditioning, the drawing utilities.
    • SINUSOIDAL_CURVE - for the sinusoidal sub-ecosystem: the Adjust and Get nodes like KfSinusoidalGetPhase.

    Neither is "better"; they're the same value wearing different type labels so ComfyUI enforces which sockets they'll plug into.

    Installing it

    The pack auto-installs its Python dependency (keyframed, plus toolz) on first load, so there are no model files to download - pure Python, no checkpoints, no weights. Install it the usual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dmarx/ComfyUI-Keyframed
    

    Then restart ComfyUI - or just use ComfyUI Manager and search "ComfyUI-Keyframed". The node lives under keyframed → sinusoidal.

    Common issues

    The most common failure is a mismatch, not a crash. You build a sine with the default amplitude 1 and wire it into something that expects 0-to-1 weights - conditioning weights that should sum to 1, for instance - and your value spends half its life negative. That's just what sin does. For prompt-weight work, prefer the entangled curve nodes or offset the curve yourself. And if you're doing curve arithmetic on the result, remember division is unreliable in this pack (a documented upstream issue) - reach for multiply.

    Categorykeyframed/sinusoidal

    Inputs (3)

    NameTypeDefaultDescription
    frequencyFLOAT0.08
    phaseFLOAT0.0000
    amplitudeFLOAT1.00

    Outputs (2)

    NameTypeDescription
    KEYFRAMED_CURVEKEYFRAMED_CURVE
    SINUSOIDAL_CURVESINUSOIDAL_CURVE