# Control LFO

> A free-running or tempo-synced low-frequency oscillator on a control lane, 0 to 1, with depth, offset, phase, skew, random shapes and a reset input.

Source: https://docs.tune.toys/nodes/ctl.lfo/

Control LFO is a low-frequency oscillator whose output is a control lane, a number between 0 and 1 that moves in a repeating cycle. It runs on its own, and an optional reset input restarts it.

## What it does

Shape picks the waveform: sine, triangle, saw, square, or one of two random shapes. Rate sets cycles per second from 0.01 to 40 Hz on a logarithmic control. Setting Beats above 0 locks the cycle to the shared transport instead, so one cycle lasts that many beats (up to 64) and Rate is ignored; at 0 the oscillator is free-running. Depth is the peak-to-peak size of the swing and Offset is its centre, so the defaults (Depth 1, Offset 0.5) sweep the whole 0 to 1 range. Phase sets where in the cycle the oscillator starts. The output is a single control lane.

### Reset

A rising edge (0.5 or more) on the `reset` input restarts the cycle at the Phase parameter, free-running or locked to Beats, and does not report a `cycle`. Cable a clock or an [Envelope](https://docs.tune.toys/nodes/ctl.envelope/) `done` into it to restart a sweep on every note. The random shapes restart their sequence too.

### Random shapes

Random step holds one value per cycle; Random smooth glides from each cycle's value to the next with an eased curve. Values are drawn from a generator seeded by the node's path, so every host, block size and replay agrees, and a transport seek lands on the same values. Depth and Offset scale them like any other shape.

### Events

The `cycle` outlet sends an event: it is 1 for one block whenever the phase wraps from the end of a cycle back to the start, free-running or locked to Beats, and 0 otherwise. The first block does not count; a transport seek that moves the beat across a cycle boundary does. Cable it into a trigger input, such as [Counter](https://docs.tune.toys/nodes/ctl.counter/), to make a clock that ticks once per cycle whatever the Shape. Because control runs once per audio block, a cycle shorter than a block still reports one pulse per block, never more.

## When to use it

Use it to produce a moving control signal as an explicit node that can be scaled, smoothed, combined or compared downstream. To turn the 0 to 1 swing into a different range, follow it with [Scale](https://docs.tune.toys/nodes/ctl.scale/); to slow its edges use [Smooth](https://docs.tune.toys/nodes/ctl.smooth/).

## Ports

<!-- ports:start -->

| Port      | Direction | Signal  | Lanes |
| --------- | --------- | ------- | ----- |
| `reset`   | Input     | Control | 1     |
| `control` | Output    | Control | 1     |
| `cycle`   | Output    | Control | 1     |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter | Label  | Range      | Default | Unit  | Scale  | Notes                                                                                                                                                                                                                              |
| --------- | ------ | ---------- | ------- | ----- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `shape`   | Shape  | 0 to 5     | 0       |       | linear | Waveform of the oscillator. The random shapes draw a new value each cycle from a generator seeded by the node path, so every host and replay agrees. Choices: 0 Sine, 1 Triangle, 2 Saw, 3 Square, 4 Random step, 5 Random smooth. |
| `rate_hz` | Rate   | 0.01 to 40 | 1       | Hz    | log    | Cycles per second when Beats is 0.                                                                                                                                                                                                 |
| `beats`   | Beats  | 0 to 64    | 0       | beats | linear | Beats per cycle, synced to the shared transport. 0 uses Rate instead.                                                                                                                                                              |
| `depth`   | Depth  | 0 to 1     | 1       |       | linear | Peak-to-peak amount of the output swing.                                                                                                                                                                                           |
| `offset`  | Offset | 0 to 1     | 0.5     |       | linear | Centre of the swing.                                                                                                                                                                                                               |
| `phase`   | Phase  | 0 to 1     | 0       |       | linear | Starting phase of the cycle, and where a Reset edge restarts it.                                                                                                                                                                   |
| `skew`    | Skew   | 0 to 1     | 0.5     |       | linear | Where the Triangle peaks, or how the Saw bends. 0.5 is the plain shape.                                                                                                                                                            |

<!-- parameters:end -->

### Shape (`shape`)

Sine, Triangle, Saw, Square, Random step or Random smooth. A discrete choice. Square jumps between two levels, which makes it a handy clock for [Counter](https://docs.tune.toys/nodes/ctl.counter/) or [Sample and hold](https://docs.tune.toys/nodes/ctl.hold/).

### Rate (`rate_hz`)

Cycles per second, 0.01 to 40 Hz, used when Beats is 0.

### Beats (`beats`)

Beats per cycle, 0 to 64, locked to the shared transport. 0 hands control back to Rate.

### Depth (`depth`)

The peak-to-peak size of the swing, 0 to 1. At 0 the output is a steady line at Offset.

### Offset (`offset`)

The centre of the swing, 0 to 1. Depth and Offset together decide how much of the 0 to 1 range is used.

### Phase (`phase`)

The starting phase of the cycle, 0 to 1, and where a Reset edge restarts it. Two LFOs with the same Rate or Beats and different Phase move in step but offset in time.

### Skew (`skew`)

Moves the Triangle's peak earlier or later in the cycle, or bends the Saw so its midpoint arrives at that point. 0.5 is the plain shape and leaves the output exactly as it was; the other shapes ignore it.

## Tips

- Keep Depth and Offset consistent: a Depth of 1 with an Offset away from 0.5 pushes part of the swing past the 0 to 1 range.
- Use Beats for anything that should stay in time with the music, and Rate for slow drift.
- A control lane has no sound of its own. It acts when it is connected to a node that takes control input.
- Prefer `cycle` over a square wave when you need one tick per cycle: it fires on the wrap whatever the Shape, Depth or Offset, and stays a one-block pulse.

## See also

[Scale](https://docs.tune.toys/nodes/ctl.scale/), [Smooth](https://docs.tune.toys/nodes/ctl.smooth/), [Math](https://docs.tune.toys/nodes/std.math/), [Cables](https://docs.tune.toys/concepts/cables/).
