Nodes/h4_Live/h4 - Linear Scheduler
ComfyUI Node

h4 - Linear Scheduler

A knob that turns itself, every loop

By m3rr·Created 9 months ago·Updated 10 days ago· 1
h4 - Linear Scheduler
    • Scheduled_Float
    ◄start_val1.00â–ș
    ◄end_val0.00â–ș
    ◄max_loops16â–ș

    One of the best things you can do in ComfyUI is stop treating generation as a one-shot and start running it as a loop that gets better each pass. The h4 - Linear Scheduler is the little node that makes those loops feel less dumb: it outputs a single float that slides from a start value to an end value as your loop counter climbs. Wire it into a KSampler's denoise or CFG, and every iteration automatically gets a slightly different setting. No manual knob-twiddling between runs.

    It's part of the h4_Live pack's "MissionControl" family - the group of nodes built around the toolkit's shared loop counter. If you've never used one of those loops, this node is a nice on-ramp because it does one clean thing.

    How it works

    Under the hood it's a lerp. The pack keeps a global loop count in memory (every h4_Live run increments it), and this node reads that count and computes:

    start_val + (end_val - start_val) * (current_loop / max_loops)

    At loop 0 you get start_val, at the final loop you get end_val, and in between you get a straight line. The node also marks itself as "always changed" internally, which forces ComfyUI to re-run it every pass instead of caching the result - that's the standard always-rerun trick utility nodes use, and it's exactly what you want from a scheduler.

    The inputs that matter

    • start_val - the value at loop 0. For a denoise ramp, this is your first pass strength (often high, like 1.0).
    • end_val - the value at the final loop. For a refinement pass, that's your low number (like 0.3).
    • max_loops - how many loops your workflow plans to run total. Get this roughly right; it's the denominator that paces the ramp.

    That's it. One Scheduled_Float output, which you convert-to-input onto whatever widget you want to sweep - denoise, CFG, or anything else that takes a float.

    What it's for

    Denoise ramps are the classic: pass 1 generates a composition at full strength, then each loop re-generates at lower denoise, converging on a finished image instead of flailing around. CFG ramps do the opposite trick - start tight, loosen up, or however your workflow wants to behave. Since it's just a number, you're not limited to samplers: sweep a style transfer strength, an upscale factor, whatever.

    Installing it

    It ships in the h4_Live pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/m3rr/h4_Live
    # restart ComfyUI
    

    Or use ComfyUI Manager and search "h4_Live." Zero extra dependencies - no pip install needed.

    Gotchas

    The loop count is global to the whole toolkit, not per-workflow, and it lives in memory for as long as ComfyUI runs. If you've got other h4_Live loop nodes in the same graph, they're all reading the same counter, so a Linear Scheduler somewhere else will also ramp - that's by design, but it can surprise you. Also, max_loops is a target you have to actually hit. Set it to 16 and only run 4 loops, and you'll never reach end_val; the ramp just stops early. And if you ever want to start fresh, that's what the loop reset nodes are for.

    It's a small tool with one job, and it does that job cleanly. If you've been eyeballing loop workflows and wondering how people make settings change between passes - this is the missing piece.

    Categoryh4_Live/MissionControl

    Inputs (3)

    NameTypeDefaultDescription
    start_valFLOAT1.000–10000Value at Loop 0.
    end_valFLOAT0.000–10000Value at Max Loop.
    max_loopsINT161–10000The total number of loops you plan to run.

    Outputs (1)

    NameTypeDescription
    Scheduled_FloatFLOAT—