September 29, 2013 at 1:43 pm #13756
Is there a way to have Ctrlr ask a hardware synth for it’s current preset & have Ctrlr move all knobs and sliders to the corresponding settings? Would this be panel / synth specific?
Thanks in advance, Pat.September 29, 2013 at 3:04 pm #13758
Hi Kingpeepee, I asked the same queston a couple of months back.
This was the reply:
One question regarding sysex, I’m hoping that the panel will be able to reflect patch changes made on the 3P. Will this require extra scripting or settings to be made in the Ctrlr panel?
yes.. you will need to get familiar with getting data and assigning values to modulators (knobs, sliders, buttons, etc).. Basically what you need to do is create a program change knob (or two buttons, – and +) that send a multimessage to your synth. first message is a program change, second message is a sysex program dump request.
Then on your panel itself (just click on “blank” space on your panel) go to the properties on the far right and look for “called when the panel receives a MIDI message”.
You’ll need to create a Lua method there called something like midiMessageRecieved. You need to create some hook that determines whether the message coming in is a program dump. Best ways to do this is ether by getting the nth byte to see if it is equal to your synth’s message ID for a program dump, or get the size of the message to compare to what a program dump’s byte length is. Here’s some example code of getting the 4th byte to see if it is equal to 0×10 (0x before a number represents HEX) which in my synths’s case indicates the message is a program dump from the synth:
midiMessageReceived = function(midiMessage) --this is a comment, it is ignored by the lua interpreter --create a variable "IDM" which is the value of the 4th byte of any incoming MIDI message: IDM = midiMessage:getLuaData():getByte(4) --is the fourth byte of incoming midi message equal to 0x10? if IDM == 0x10 then --if yes, then run another method called "assignValues" assignValues(midiMessage) --this next line is just a console message that alerts you that the script has run this far. View these in the "Lua Console" console ("program change sent, standby for panel update...") end end
IF the message is a program dump from the synth, you’ll then get the bytes that contain the values for your parameters, assign them to a variable (each one) and then assign that variable as the value for each modulator on your panel.
Here’s a shortened example of my “assignValues” method:
function assignValues(midiMessage) -- create a variable that contains all bytes of program data from the synths program dump, get this info from synth's manual: programData = midiMessage:getData():getRange(7,256) -- cool, we've got everything, all we need to do now is actually assign the values to the modulators. --NOTE: use "setValueMapped" if the modulator is a combobox with custom values. --use "setModulatorValue" if the modulator is a typical modulator with a value range of, say 0-127 panel:getModulatorByName("Osc 1 Octave"):setValueMapped(programData:getByte(1), false) panel:getModulatorByName("Osc 1 Semitone"):setValueMapped(programData:getByte(2), false) panel:getModulatorByName("Osc 1 Detune"):setModulatorValue(programData:getByte(3), false, false, false) --continue for ALL parameters within your program dump.. . endSeptember 30, 2013 at 9:12 am #13785
Wow, sounds complicated. 😉
Thanks for the help, it’s greatly appreciated but I might leave it for now. 😉
Best, Pat.October 1, 2013 at 1:12 pm #13834
Actually I think I’ve got my head around this but how do I find out which byte of a patch dump (on a Yamaha DX21) is the byte for the different parameters?
Thanks, Best….Pat.October 1, 2013 at 1:24 pm #13835
Yep, I am still getting my head around a lot of it.. there are example to be found panels in the Ctrlr app download, these are good for referencing examples of scripting / methods.
Atom has written a getting started guide here: http://ctrlr.org/getting-started/
I would recommend using the Ctrlr MIDI monitor found under the Windows Menu to see what your DX21 sends out in the form of CC or Sysex messages. You will also need the instruction manual for the DX21 which hopefully will have comprehensive tables showing you the MIDI CC and Sysex info.
Hope this helps : )October 1, 2013 at 1:30 pm #13837
Thanks lfo2vco, looks great!
🙂October 1, 2013 at 1:47 pm #13838
Good luck with the project Pat… it’s a great way to learn more about MIDI CC and Sysex. The programming side is a revelation too; if like me this is your first attempt at working with scripts / methods and the like.
You must be logged in to reply to this topic.