But it’s not what i want. It gives too much “weight” to the first value. Eg if my scale is 1 to 3, then 66% of the midi knob is “1” which is uneven. Does this make sense?
The trick is to normalise your input to a range of [0.0, 1.0] and then scale according to your output range:
local input_min = 0
local input_max = 127
local output_min = 1
local output_max = 3
local input = some value between [input_min, input_max]
local normalised_input = (input - input_min) / (input_max - input_min)
local output = output_min + (normalised_input * (output_max - output_min))