math.clamp#
Constrain value into the inclusive range [min, max].
SYNTAX#
function math.clamp(value: number, min: number, max: number): numberARGUMENTS#
value(number) — The value to clamp.min(number) — Lower bound.max(number) — Upper bound.
RETURNS#
number — the clamped value.
EXAMPLE#
const adj = math.clamp(rawSignal, -1, 1);
plot('signal', adj);