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
Scale / Map incoming values
Re: Scale / Map incoming values
If you have also mapped any object to that value you can use the object's x with this formula:
value = x*24-12
If you wan to directly translate midi range (0-127) then use:
value= Midivalue*(24/127)-12
Here's a working example with both cases!
value = x*24-12
If you wan to directly translate midi range (0-127) then use:
value= Midivalue*(24/127)-12
Here's a working example with both cases!
- Attachments
-
- values.jzml
- (3.61 KiB) Downloaded 55 times
Re: Scale / Map incoming values
Hi Softcore,
Thanks for your explanation and example! - this is exactly what I was looking for.
One more question to this one - when I mapped the encoder to send the value to the application (the current status is only for displaying the value), it was not sending whole numbers (1 - +/- 12) even I set the encoder to grid 25 (for the middle 0 and 24 to each limit value)
-1 is -0.58 etc.
thanks!
Thanks for your explanation and example! - this is exactly what I was looking for.
One more question to this one - when I mapped the encoder to send the value to the application (the current status is only for displaying the value), it was not sending whole numbers (1 - +/- 12) even I set the encoder to grid 25 (for the middle 0 and 24 to each limit value)
-1 is -0.58 etc.
thanks!