# Scale

> Map a control range onto another with a curve, clamp and inversion. Depth and offset for any modulation.

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

Scale maps a control range onto another range, with a curve, a clamp and inversion. It is how you set depth and offset for any modulation.

## What it does

The input range (Input min to Input max) is mapped linearly onto the output range (Output min to Output max), then bent by Curve. Curve at 0 is a straight line; negative values ease in (slow start, fast finish) and positive values ease out. Clamp holds the result inside the output range; with Extrapolate, input beyond the input range continues past the output range. All four range values run from -10000 to 10000. To invert a signal, set Output min higher than Output max. The same mapping applies to every lane of the input.

## When to use it

Use it between any source and destination whose ranges differ: shrink an LFO to a small depth around a value, flip a sensor, or reshape a linear ramp. Pair it with [Control LFO](https://docs.tune.toys/nodes/ctl.lfo/) for modulation.

## Ports

<!-- ports:start -->

| Port      | Direction | Signal  | Lanes                   |
| --------- | --------- | ------- | ----------------------- |
| `control` | Input     | Control | Inferred from the cable |
| `control` | Output    | Control | Inferred from the cable |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter | Label      | Range           | Default | Unit | Scale  | Notes                                                                                       |
| --------- | ---------- | --------------- | ------- | ---- | ------ | ------------------------------------------------------------------------------------------- |
| `in_min`  | Input min  | -10000 to 10000 | 0       |      | linear | Input value that maps to Output min.                                                        |
| `in_max`  | Input max  | -10000 to 10000 | 1       |      | linear | Input value that maps to Output max.                                                        |
| `out_min` | Output min | -10000 to 10000 | 0       |      | linear | Output at Input min.                                                                        |
| `out_max` | Output max | -10000 to 10000 | 1       |      | linear | Output at Input max.                                                                        |
| `curve`   | Curve      | -1 to 1         | 0       |      | linear | Bend of the mapping: negative eases in, positive eases out, 0 is linear.                    |
| `clamp`   | Clamp      | 0 to 1          | 1       |      | linear | Hold the output inside its range instead of extrapolating. Choices: 0 Extrapolate, 1 Clamp. |

<!-- parameters:end -->

### Input min (`in_min`) and Input max (`in_max`)

The input values that map to Output min and Output max. Narrowing this range makes the mapping more sensitive.

### Output min (`out_min`) and Output max (`out_max`)

The output at Input min and at Input max. Swap them to invert.

### Curve (`curve`)

From -1 to 1. 0 is linear, negative values ease in and positive values ease out.

### Clamp (`clamp`)

Clamp holds the output inside Output min and Output max; Extrapolate lets it run past them.

## Tips

- The defaults map 0 to 1 onto 0 to 1 and change nothing.
- To use 1 - x, set Output min to 1 and Output max to 0.
- Scale one control lane or a whole bundle; every lane is treated the same.

## See also

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