scamp_extensions.utilities.math.remap
- scamp_extensions.utilities.math.remap(value_or_values, out_min, out_max, in_min=None, in_max=None, input_warp='lin', output_warp='lin', clip=True)[source]
Rescales the given value or values so that they fall within the given output range. Not efficient or vectorized, but unless you’re using large datasets, that shouldn’t be an issue.
- Parameters:
value_or_values – the value or values to rescale
out_min – lower bound of output range
out_max – upper bound of output range
in_min – lower bound of input range (defaults to minimum input value)
in_max – upper bound of input range (defaults to maximum input value)
input_warp – either “lin”, or “exp” depending on whether the input values are linearly (e.g. pitch) or exponentially (e.g. frequency) spaced.
output_warp – either “lin”, “exp”, or a number that corresponds to the shape of the warping curve. When using a number, 0 is linear, > 0 warps outputs towards the bottom of the range, and < 0 warps outputs towards the top of the range (see ~expenvelope.envelope.Envelope for a description of curve_shape).
clip – if True, clip output values so that they do not go outside of the designated output range
- Returns:
a suitable warped output value or list of output values