Nodes/MD Nodes/MD: LFO Generator (Automator)
ComfyUI Node

MD: LFO Generator (Automator)

Animate any number over time — the LFO generator that outputs a list *and* a live value

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: LFO Generator (Automator)
    • current_value
    • value_list
    • lfo_plot
    • list_as_string
    waveformSine
    frequency1.0
    amplitude_min0.00
    amplitude_max1.00
    phase_offset0.00
    steps20
    seed0
    noise_smoothing0.50
    current_step0

    An LFO - low-frequency oscillator - is the musician's trick of wiggling a parameter on a slow, repeating wave. MD_LFO_Generator brings that to ComfyUI: it produces a list of values that oscillate between two bounds over a fixed number of steps, so you can sweep a denoise level, a strength, a scale - any FLOAT input - over the course of a batch or an animation instead of holding it constant.

    The neat part is the dual output. Most ComfyUI modulation nodes make you pick one style: a value list to splice into a batch, or a single value for the current frame. This one gives you both. And it renders a plot, because guessing whether your wave actually looks like what you wanted is the fastest way to waste a render.

    How it works

    The core is a tiny waveform generator. Pick a shape - sine, triangle, sawtooth, square, pulse, noise, or the easing variants - and it samples that wave across steps frames, mapped so the wave's low point hits amplitude_min and its high point hits amplitude_max. frequency sets how many full cycles fit across the whole run (not per-second, which trips people up - 1.0 means one cycle over the entire list). phase_offset shifts where the wave starts, so 0.5 begins halfway through a cycle. The Random waveform is seeded, and noise_smoothing runs a convolution over it so random jumps don't make your parameter spasm frame to frame.

    The inputs that matter

    • waveform - 12 shapes. Sine is the sane default; sawtooth for a ramp; square for hard on/off.
    • frequency - cycles across the whole duration.
    • amplitude_min / amplitude_max - the floor and ceiling of the sweep. These are the two you'll touch constantly.
    • steps - how many values the list holds. Match it to your batch size or total frames.
    • phase_offset - where the wave begins.
    • seed / noise_smoothing - only matter for the Random waveform.

    Outputs: current_value (a single FLOAT, ideal when wired with the optional current_step input so it tracks a changing frame index), value_list (the full FLOAT list for batch/broadcast workflows), list_as_string (for text or debugging), and lfo_plot (an IMAGE preview of the wave).

    Installing

    Ships with MD Nodes:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
    cd ComfyUI_MD_Nodes
    pip install -r requirements.txt
    

    Or ComfyUI Manager → MD Nodes → install, then restart. The plot output needs matplotlib; the values themselves don't.

    Common issues

    The most common mistake is reading frequency as "cycles per second" - it's cycles per full run, so a frequency of 1 over 20 steps is a single gentle swell, not a wobble. And remember that a plain LFO output doesn't change anything by itself: it's only useful connected to a parameter that varies per frame or per batch item. If your workflow expects one fixed number, wiring current_value with a fixed current_step just hands you back a constant - pick the output that matches how your consumer node consumes it.

    CategoryMD_Nodes/Modulation

    Inputs (9)

    NameTypeDefaultDescription
    waveformCOMBOSineWAVEFORM SHAPE • Purpose: The mathematical pattern used to modulate the values.
    frequencyFLOAT1.00.1–100FREQUENCY (SPEED) • Purpose: How many complete cycles occur over the batch duration.
    amplitude_minFLOAT0.00-10000–10000MINIMUM VALUE (FLOOR) • Purpose: The absolute lowest value the wave will hit.
    amplitude_maxFLOAT1.00-10000–10000MAXIMUM VALUE (CEILING) • Purpose: The absolute highest value the wave will hit.
    phase_offsetFLOAT0.000–1PHASE SHIFT • Purpose: Offsets where the wave begins. 0.5 starts the wave halfway through its cycle.
    stepsINT201–10000TOTAL STEPS (DURATION) • Purpose: The total number of frames/steps to generate in the list.
    seedINT00–9007199254740991STOCHASTIC SEED • Purpose: Controls the randomness of the 'Random (Noise)' waveform.
    noise_smoothingFLOAT0.500–1NOISE SMOOTHING • Purpose: Applies a convolution kernel to smooth out jagged points. Only active for Random waves.
    current_stepoptINT00–10000CURRENT STEP INDEX • Purpose: If connected, returns the specific float value at this index from the generated list.

    Outputs (4)

    NameTypeDescription
    current_valueFLOAT
    value_listFLOAT
    lfo_plotIMAGE
    list_as_stringSTRING