Home › Forums › General › General MIDI discussion › Slider with multi part message Program Change above 128
- This topic has 4 replies, 2 voices, and was last updated 9 years ago by neofelismale.
-
AuthorPosts
-
March 27, 2015 at 1:11 am #41812
Short explanation: I have a Roland VB-99 that I like to use with ctrlr. The VB-99 has 400 Memory, Patch storage locations. It organizes this in banks on CC #0 1 to 4 and uses Program Change 1-100.
How do I go about doing this, have a slider Dec/Inc button with a number of 1-400 that sends messages of type first a CC with bank number, than a Program Change value. One bank number CC 1 to 100, than next bank number and so on, displaying all the numbers as 1-400. Side note, the VB-99 does not respond to anything on CC #32.
Monitor message of one change:
[23:57:55:000002]: Time(1421096584) [Controller] Ch:[ 7] No:[ 0] Val:[ 1] RAW:[b6 00 01]
[23:57:55:000003]: Time(1444991789) [Controller] Ch:[ 7] No:[ 32] Val:[ 0] RAW:[b6 20 00]
[23:57:55:000004]: Time(1460311738) [Program change] Ch:[ 7] No:[ 7] Val:[—-] RAW:[c6 07]Thanks in advance for any help
March 27, 2015 at 6:04 pm #41896You can create a simple scritp and assign it to modulator’s method “called when the modulator value changes”. Also, set the midi message type to none
myMethod = function(mod, value) if value < 101 then m = CtrlrMidiMessage({0xb0, 0x00, 0x01}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value}) panel:sendMidiMessageNow(m) elseif value > 100 and value < 201 then m = CtrlrMidiMessage({0xb0, 0x00, 0x02}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value- 100}) panel:sendMidiMessageNow(m) elseif value > 200 and value < 301 then m = CtrlrMidiMessage({0xb0, 0x00, 0x03}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 200}) panel:sendMidiMessageNow(m) elseif value > 300 and value < 401 then m = CtrlrMidiMessage({0xb0, 0x00, 0x02}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xc0, value - 300}) panel:sendMidiMessageNow(m) end end
Be aware that this is for a fixed midi channel (in this script is always channel 1), but this can be controlled with a variable.
I’ve not tested it, but give it a try and let me know if it works.
March 28, 2015 at 2:55 am #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.
March 28, 2015 at 3:06 am #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 29, 2015 at 2:51 pm #42155Guess 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 🙂
-
AuthorPosts
- The forum ‘General MIDI discussion’ is closed to new topics and replies.