The Range Transform Node helps transform control signals (or audio signals) from a given range, to another range.
For example, if you have a Node that outputs a signal between 0–1, but the input expects the signal to be in the range of 0–22050 (common for frequency control), the Range Transform Node can easily transform the signal into the expected range, proportionally.
How to Use
This Node transforms a control signal (or audio signal). Thus, it expects a source signal from another Node connected, such as an LFO Node. The Range Transform Node outputs the transformed signal, which you then connect to its intended destination.
Driving a Frequency setting with an Envelope Pattern Node
Say you have an Envelope Pattern Node with a 0–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, 0 as the destination min value, 22050 as the destination max value.
This says: keep the output 0 when the input is 0, and 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 a -1–1 output range, 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. Clamped modes force-clamp the input signal between Source Min and Source Max, to avoid unexpectedly going out of Destination Min/Max range.
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.
If the input and output ranges are not symmetrical, this output will have a non-zero signal even if nothing is connected to the input (e.g. when transforming from [-1, 1] to [0, 1], in which case the output will be a constant 0.5 without any input).
Technical Details
Under the hood, the 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