Looking for a way of scaling my data and I really like how Max does it.
aka [scale] (input-low input-high output-low output-high)
In SCAMP I have been doing:
1 fund = data['f0'] # this is reading from a JSON file
2 xmin, xmax = min(fund), max(fund) # this gets the min/max of input
3 for i, val in enumerate(fund): # normalize
4 fund[i] = (val-xmin) / (xmax-xmin)
5 midiFund = [round(element * 30) + 50 for element in fund]
# the first int above is the effectively the range
# the second int is where to place that range
Anyway, it seems like this is beating around the bush quite a bit. Is there a simpler way to get desired results?