The method linlin, and friends

For any other arbitrary scaling of ranges, you can use the handy methods linlin, linexp, explin, expexp. The method names hint at what they do: convert a linear range to another linear range (linlin), linear to exponential (linexp), etc.

// A bunch of numbers
a = [1, 2, 3, 4, 5, 6, 7];
// Rescale to 0-127, linear to linear
a.linlin(1, 7, 0, 127).round(1);
// Rescale to 0-127, linear to exponential
a.linexp(1, 7, 0.01, 127).round(1); // don't use a zero for an exponential range