Forum Replies Created
-
AuthorPosts
-
March 29, 2015 at 2:51 pm in reply to: Slider with multi part message Program Change above 128 #42155
Guess I was tired yesterday, just a few adjustments and the script runs fine.
I had to add a -1 one to the value else the logic gets wrong. And I was wrong about bank 1 to 4, it was 0 to 3.But this got me thinking, that range conversion must be quite a big thing in programs like this. And that a general easy to use formula could help out many people not so much in to math. I found this formula on http://rosettacode.org/wiki/Map_range#Lua, but I can not figure out how exactly to use this in ctrlr, this could also been used to solve this issue:
It could be modified to take range variables of the fader and its step value, then have some easy explainable variables to add the new range:
function map_range( a1, a2, b1, b2, s )
return b1 + (s-a1)*(b2-b1)/(a2-a1)
endfor i = 0, 10 do
print( string.format( “f(%d) = %f”, i, map_range( 0, 10, -1, 0, i ) ) )
endHere is the working script I use now:
myMethod = function(mod, value)
x = -1
if value < 101 then m = CtrlrMidiMessage({0xb0, 0x00, 0x00}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value + x}) panel:sendMidiMessageNow(m) elseif value > 100 and value < 201 then m = CtrlrMidiMessage({0xb0, 0x00, 0x01}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 100 + x }) panel:sendMidiMessageNow(m) elseif value > 200 and value < 301 then m = CtrlrMidiMessage({0xb0, 0x00, 0x02}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 200 + x}) panel:sendMidiMessageNow(m) elseif value > 300 and value < 401 then m = CtrlrMidiMessage({0xb0, 0x00, 0x03}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 300 + x}) panel:sendMidiMessageNow(m) end end Thank you, feel like a level up now 🙂
March 28, 2015 at 3:06 am in reply to: Slider with multi part message Program Change above 128 #41950All good now 🙂
From Atom “there is a special way to do this, when starting Ctrlr hold CTRL+R, it should clear stuff up,”
Will look more into your script tomorrow.
March 28, 2015 at 2:55 am in reply to: Slider with multi part message Program Change above 128 #41949Thanks for the try. It totally crashed my ctrlr, every time I start I get an error. Tried to move all my panels to new locations, still no go.
I will be back with new info when I get ctrlr up and running.
-
AuthorPosts