LFO_Sawtooth
The sweep-and-snap oscillator
- FLOAT
Some oscillations you want smooth, some you want sharp, and some you want to sweep in one direction and snap back. That last one is a sawtooth, and LFO_Sawtooth is the ComfyUI node that gives it to you.
Think of it like climbing a staircase that teleports you back to the bottom. The value rises steadily, hits the top, and instantly jumps to the bottom to start again. It's the deliberately asymmetric shape of the LFO family: there's no equal-time fall, because the "fall" is a single jump. That makes it perfect for anything that should cycle through values in one direction - a strength that climbs from subtle to aggressive then resets, a ControlNet influence that builds up over a run, a value that should spend its time growing, not shrinking.
How it works
From the pack's lfonodes.py, it's the sawtooth's favorite trick - keep only the fractional part of the phase:
phase = (position * frequency) - int(position * frequency)
return offset + amplitude * (2 * phase - 1)
phase wraps from 1 back to 0 at the end of every cycle, and 2*phase - 1 maps that to a value climbing linearly from -1 to +1 before the wrap yanks it back to -1. Add amplitude scaling and offset shifting and the output lives in offset - amplitude to offset + amplitude.
And yes, the same rule applies here as everywhere in this pack: this is a pure function of position, not a self-running oscillator. Nothing moves unless you drive position with something that changes - a frame counter, a batch index, a value from an animation scheduler. Leave it alone and the sawtooth outputs the same number on every execution, which feels broken until you remember who's supposed to push the input.
The inputs
Five float inputs, standard for this pack:
- position - the driver you wire to an advancing value. The whole "sweep" depends on this moving.
- frequency - cycles per unit of position. Default 1. How many sweeps you get per run.
- amplitude - the swing distance from center. Default 1.
- offset - the midpoint. Default 0, so a fresh node sweeps -1 to +1.
- phase_offset - where in the sweep you start, default 0.5.
The single FLOAT output plugs into any float socket: KSampler denoise, ControlNet strength, IPAdapter weight, AnimateDiff motion scale, CFG. If you've seen audio-reactive AnimateDiff workflows where music weights drive control strength, this is the same idea minus the audio - a deterministic ramp you control by hand.
Install and troubleshooting
Same story as the rest of Comfy-LFO: one small file, zero dependencies, no models. From your ComfyUI folder:
cd custom_nodes
git clone https://github.com/richinsley/Comfy-LFO.git
Restart ComfyUI, and the nodes show up under the LFO menu. ComfyUI Manager can usually install it by searching "Comfy-LFO" if you'd rather not touch a terminal.
The failure modes are the pack's failure modes. Output frozen? position isn't changing - wire a moving source. Node missing? Restart. Expected a nice symmetric wave? You grabbed the wrong node; the jump at the top of the cycle is the entire point of a sawtooth. If you want the rise and fall to be gradual, that's LFO_Triangle's job. A sawtooth is for one-directional sweep with a reset, and once you need that, nothing else in the pack does it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| position | FLOAT | 0.000 | — |
| phase_offset | FLOAT | 0.500 | — |
| frequency | FLOAT | 1.000 | — |
| amplitude | FLOAT | 1.000 | — |
| offset | FLOAT | 0.000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |