Home › Forums › General › Programming › Need help with complex MIDI CC Expression
Tagged: MIDI CC's
- This topic has 9 replies, 3 voices, and was last updated 8 years, 11 months ago by dasfaker.
-
AuthorPosts
-
April 17, 2015 at 5:40 pm #44062
Hi guys,
I’ve very new at Ctrlr, but I’m trying to create a simple panel to control some deep aspects of a Kurzweil PC3, that cannot be assigned to MIDI CC’s.
The PC3 has a deep control method (called KPN’s) that can be used by editors utilizing 7 MIDI CC’s. (CC110, 111, 112, 113, 114, 118, 119) It’s a bit like a super NRPN and it’s required because of the sheer number of parameters that can be adjusted and the wide range of the parameters.
I can set up a Multi Message to control the parameter fine and that all works, however I’m not sure how to manipulate parts of the message with other console objects.
I’ve attached a panel, and at this stage I’m just interested in the 2 blue controls in the grey box. For background, each PC3 MIDI channel can host a PC3 program (patch). Each patch can be up to 32 layers deep and each layer has 3 envelopes. Using the KPN protocol any parameter on any layer of any channel can be controlled within the PC3’s program buffers (so the editing is non-destructive). At this stage, I just want to be able to control envelope parameters on different layers, where I can choose the layer. Later I want to assign the knob to different parameters (so using a menu or list choose that knob 1 might control LFO shape, for example).
What I want to do is that when I change the layer parameter, I want the value to be substituted into the complex message that is sent when the “AmpEnv Attack 1 Time” knob is turned (Layer 1 is equivalent to MIDI CC: 111 Value: 0) – which is the value displayed in the console.
Any help would be greatly appreciated.
Attachments:
You must be logged in to view attached files.The Puppeteer
http://godlike.com.auApril 30, 2015 at 8:12 am #45115Anyone???
Or even if someone can point me to an example of how to inject a global into a Multi CC message, rather than SYSEX.
The Puppeteer
http://godlike.com.auApril 30, 2015 at 3:09 pm #45126Hi
Dunno if I can help you because not fully understood what you want but :replaced console(k0) by console (“”..panel:getGlobalVariable(0) )
and I get in the console :
Knob 1 Layer: 5
21Did you seen that there is a panelCallback that is called when a glb var is changed ,
may be that helps you and there is an overview (a property)of all variables in the panel props
may be you can display this in good form on a uiLabelMay 1, 2015 at 6:53 am #45185Hi
Thanks for having a look.
If you assign the MIDI Out to the MIDI Monitor and look at the messages sent from moving the AmpEnve Attack 1 Time knob you will see the following
[12:48:35:000593]: RAW:[b0 6e 02]
[12:48:35:000593]: RAW:[b0 6f 00]
[12:48:35:000593]: RAW:[b0 70 09]
[12:48:35:000593]: RAW:[b0 71 00]
[12:48:35:000593]: RAW:[b0 72 02]
[12:48:35:000593]: RAW:[b0 76 40]
[12:48:35:000593]: RAW:[b0 77 33]What I want to do is the second message should be b0 6f 04 when the Layer is set to 5. I can’t find a way to get this to change.
The Puppeteer
http://godlike.com.auMay 1, 2015 at 10:04 am #45191You should use LUA for this. Remove the multi message stuff and create a script for “Called when the modulator value changes”. Add the messages you need to send, there you can insert any variable you want.
m = CtrlrMidiMessage({0xb0, 0x6e, 0x02}) panel:sendMidiMessageNow(m) m = CtrlrMidiMessage({0xb0, 0x6f, panel:getModulatorByName("AEnvA1TLayer":getValue()}) panel:sendMidiMessageNow(m) . . .
May 1, 2015 at 10:47 am #45194OK thanks. I’ll give this a go.
This method will almost certainly be better in the long run as well because I’ll need to change messages of the other MIDI messages based on other panel controllers as I develop this.
The Puppeteer
http://godlike.com.auMay 1, 2015 at 3:17 pm #45266Hi Dasfaker,
Thanks so much for your help. I got it working, now the hard work begins to start populating it all.
I’m sure I’ll have more questions as I get my head around everything.
Just one minor change for anyone coming along afterwards
One of the lines above is missing a “)”
m = CtrlrMidiMessage({0xb0, 0x6f, panel:getModulatorByName(“AEnvA1TLayer”:getValue()})
should be
m = CtrlrMidiMessage({0xb0, 0x6f, panel:getModulatorByName(“AEnvA1TLayer”):getValue()})
The Puppeteer
http://godlike.com.auMay 1, 2015 at 3:57 pm #45286Just one more question on this,
How would you make the midi channel dynamic (ie set 0xbn) where n is the MIDI channel of the host or panel
The Puppeteer
http://godlike.com.auMay 1, 2015 at 5:09 pm #45298Never mind, I worked it out.
There’s probably a much better way of doing this, but this works
-- get the MIDI Channel from the panel and set ch to the hex representation of that -- ready for transmitting as part of the MIDI message. -- Will need to move this either to InitializePanel and/or to a method when MIDI Channel changes ch = string.format("%x",L(panel:getPropertyString("panelMidiOutputChannelDevice"))) -- for debugging -- console (ch) if ch == "1" then Mch = 0xb0 elseif ch == "2" then Mch = 0xb1 elseif ch == "3" then Mch = 0xb2 elseif ch == "4" then Mch = 0xb3 elseif ch == "5" then Mch = 0xb4 elseif ch == "6" then Mch = 0xb5 elseif ch == "7" then Mch = 0xb6 elseif ch == "8" then Mch = 0xb7 elseif ch == "9" then Mch = 0xb8 elseif ch == "a" then Mch = 0xb9 elseif ch == "b" then Mch = 0xba elseif ch == "c" then Mch = 0xbb elseif ch == "d" then Mch = 0xbc elseif ch == "e" then Mch = 0xbd elseif ch == "f" then Mch = 0xbe else Mch = 0xbf end -- if
-- Controller 1 Program m = CtrlrMidiMessage({Mch, 0x6e, 0x02}) panel:sendMidiMessageNow(m) -- Controller 2 Layer. Get the layer from the AEnv1TLayer control m = CtrlrMidiMessage({Mch, 0x6f, panel:getModulatorByName("AEnvA1TLayer"):getValue()}) panel:sendMidiMessageNow(m)
The Puppeteer
http://godlike.com.auMay 1, 2015 at 6:20 pm #45311You can write it this way too.
ch = panel:getPropertyInt("panelMidiOutputDevice") m = CtrlrMidiMessage({176 + ch, 0x6e, 0x02}) -- 176 == b0 panel:sendMidiMessageNow(m)
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.