Scale / Map incoming values
Posted: 02 Jan 2015 13:59
Hi all,
I am completely new to Lemur so sorry for my stupid question...
I am trying to get a key value from traktor and display it in a text type object on the lemur.
The traktor is representing the value as a knob with range of -12 to 12 which is in fact midi message with range 0 to 127.
When I use the value directly, I get value 63 for 0 what is logical but not very comfortable so I decided to translate the value...
1) When I simply made a value expression to value = value -63 to "round" it, it was nto usable due to the looped subtraction...
2) I tried to use the following formula to extrapolate the numbers:
(value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
==>
(value - 0) * (12 - - 12) / (127 - 0) + -12;
...but not working...
Could anyone please check my approach if its correct? Isn't there some built in function to scale the incomming numbers?
Is it possible that I make such function and call it for mapping the values I need?
Any idea why the expression as above is not working?
Thanks a lot for your help!
Cheers!
Marek
I am completely new to Lemur so sorry for my stupid question...
I am trying to get a key value from traktor and display it in a text type object on the lemur.
The traktor is representing the value as a knob with range of -12 to 12 which is in fact midi message with range 0 to 127.
When I use the value directly, I get value 63 for 0 what is logical but not very comfortable so I decided to translate the value...
1) When I simply made a value expression to value = value -63 to "round" it, it was nto usable due to the looped subtraction...
2) I tried to use the following formula to extrapolate the numbers:
(value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
==>
(value - 0) * (12 - - 12) / (127 - 0) + -12;
...but not working...
Could anyone please check my approach if its correct? Isn't there some built in function to scale the incomming numbers?
Is it possible that I make such function and call it for mapping the values I need?
Any idea why the expression as above is not working?
Thanks a lot for your help!
Cheers!
Marek