MidiToParamEx

Just a fyi. Although MidiToParamEx() function is faster than Scale() function, it gives unexpected results with certain parameters:

Print(MidiToParamEx(-1, -127, 127, 0.0, 1.0))
0.5000000
Print(Scale(-1, -127, 127, 0.0, 1.0))
0.4960630

So, for now I’m using Scale() which works just fine.

Scale and MidiToParam do not exactly return the same value.
MidToParam has to make sure that the returned value when you scale it back to Midi gives the correct Midi Value.
So I think some kind of rounding is implemented in the MidiToParam function.

There’s no such thing as a negative MIDI value — basically - don’t do that

The MidiToParamEx will normalize incoming values so if you pass in a value outside the range, it will be reset to the actual range between 0 and 127

I suppose I should do the same thing for the MIDI MIN and MAX values as well but I just assumed that people wouldn’t send in bogus values…silly me :confounded:

Edit: I just made this change to automatically constrain both MIDI values and the parameter values (which should always go from 0.0 to 1.0)

This will show up in the next official release (whenever that happens)

1 Like

Thanks Paul… I think you nailed it :+1: :slightly_smiling_face: