Constant Range Transform Node

The Constant Range Transform Node, as its name implies, transforms control signals (or audio signals, or more specifically: samples in these signals) from a given range to another range.

For example, you can use it to transform a source oscillating between 0 to 1, to a range between 20 and 40. Values in-between are transformed proportionally. That is, 0.5 becomes 30 in this same example.


How to Use

This Node transforms a control signal (or audio signal). Thus, it expects a source signal from another Node, such as an LFO Node.

Driving a Frequency setting with an Envelope Pattern Node

Say you have an Envelope Pattern Node with a 0 to 1 output range (default), and want to drive the Frequency-control input of a Lowpass Filter Node (which accepts values in the [0, 22050] range). To do this, use 0 as the source min value, 1 as the source max value, 10 as the destination min value, 22050 as the destination max value.

This says: make the output 10 when the input is 0, make the output 22050 when the input is 1. And, interpolate between these values if the input is between 0 and 1.

Driving a Gain setting with an LFO Node

Say you have an LFO Node, with [-1, 1] output range (default), and want to drive the Gain-control input of a Gain Node (which accepts values in the [0, 1+] range). To do this, use -1 as the source min value, 1 as the source max value, 0 as the destination min value, and 1 as the destination max value. Leave the Transform Mode setting at Linear.

This says: make the output 0 when the input is -1, make the output 1 when the input is 1, and interpolate between these values if input is between 0 and 1.


Inputs

Control Input (source)

The control or audio signal to transform.

When you have no connections to this input, it’s the same as if you had a constant 0 signal connected. Depending on settings, this can result in non-0 output. For example, transforming [0, 1] to [1, 3] will result in a constant 1 signal in the output in this case.

Note that, while this signal should be in the range set by the Source min and Source max settings, the Node will work perfectly fine if the signal range exceeds this range. When this happens, the output will be also out of range, proportionally.


Settings

Source min

The expected lower bound of the Control Input (source) signal.

Source max

The expected upper bound of the Control Input (source) signal.

Destination min

The lower bound of the output range. Because of how this Node works, this is what the output value will be when the Control Input (source) signal is the same as the Source min setting.

Destination max

The upper bound of the output range. Similarly to the Destination min setting, the output value will be this value when the Control Input (source) signal is the same as the Source max setting.

Transform mode

Sets the transform scaling. Logarithmic mode applies a transformation to make the input curved.


Outputs

Control Output (destination)

The transformed control or audio signal (depending on input). Its channel count is the same as whatever is connected to the Control Input (source).

DSP-wise, this output signal is largely identical to the input signal, except the DC offset and amplitude are different, depending on settings. Thus, the frequency content of the signal, for example, will be the same as that of the input.


Technical Details

Under the hood, the Constant Range Transform Node uses an equivalent of the following equation, optimized into a single addition and a single multiplication per sample:

(((x - srcMin) * (destMax - destMin)) / (srcMax - srcMin)) + destMin