Clamp
The Clamp node takes a number and ensures it falls within a specified range. If the value is below the minimum, the output will be the minimum. If it is above the maximum, the output will be the maximum. If it is already within range, it passes through unchanged. This is useful for keeping values like volume levels, counters, or multipliers within safe boundaries.
Inputs
| Name | Type | Description |
|---|---|---|
Value | number | The number to constrain |
Outputs
| Name | Type | Description |
|---|---|---|
Result | number | The clamped value, guaranteed to be between the configured min and max |
Configuration
- Min: The minimum allowed value. Any input below this will output this value instead.
- Max: The maximum allowed value. Any input above this will output this value instead.
Example
You have a "volume boost" feature where viewers can increase TTS volume with channel points. You want to make sure the volume never goes below 10 or above 100. Set Min to 10 and Max to 100. If a calculation produces a volume of 150, the Clamp node outputs 100. If it produces -5, the output is 10.