Home › Forums › General › Programming › update panel on dump request using Lua
- This topic has 31 replies, 4 voices, and was last updated 12 years, 9 months ago by atom.
-
AuthorPosts
-
July 12, 2011 at 2:40 am #376
Hi Atom,
I’ve finally gone from [i:xo9k1j2f]dinking around[/i:xo9k1j2f] with your Lua examples to just [i:xo9k1j2f]digging in[/i:xo9k1j2f]…so. for now…
going off the DEMO-midi Lua example,
m = CtrlrMidiMessage({0xF0, 0x01, 37, 5, bank:getModulatorValue(), program:getModulatorValue(), 0xf7})
I get the learning example here of passing a modulator’s knob value to a script (here the bank and program number of the DSI morpho synth) but suppose I just want to do a dump request of the synth’s [i:xo9k1j2f]edit buffer[/i:xo9k1j2f] and I have the precise sysex string to do so already working with a pre-existing button on my panel
I don’t understand the "0x" before the F0, 01 and f7 but not the 37 or 5.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 12, 2011 at 8:00 am #2924the 0x means it’s a hex notation (the compiler will interpret the numbers as hexadecimal not decimal numbers)
July 12, 2011 at 3:42 pm #2925so
[f0 01 25 05 00 2a f7]the 25 and 05 are binary? so this synth uses a combination of binary and hex values in it’s sysex command to request a dump?
The question I was asking isn’t what is the 0x for, my question is why the inconsistency between hex and binary in the sysex string in your DEMO.midi panelMonstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 12, 2011 at 4:52 pm #2926no it’s HEX and DEC, so 37 is actualy 0x25 it’s just a matter of notation the value is the same.
July 18, 2011 at 1:54 am #2927right.. of course. I knew better ” title=”Smile” />
So I have the microwave XT panel updating modulators all using Lua now, I haven’t yet gotten to the knobs which get their messages from a sysex parameter change but if I have any questions setting up those arrays I’ll ask here.
Thanks for the help, I think I’m finally past the logjam of how to get started w/ Lua.. Only programming I really know well are things like MEL, scripting in After Effects, actionscripting, some javascript… Lua seems powerful and I’m really excited to be getting the hang of this. Unfortunately I’ll be putting it all away for about a month here in a day or so – getting married and sitting on a beach in Hawaii for two weeks! i can not wait. . both for the beach and to get back and dig right back into this stuff!!
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 18, 2011 at 8:47 am #2928Aloha ” title=”Smile” /> and a happy marriage/wedding.
July 18, 2011 at 4:05 pm #2929Thanks Atom, one quick one… lets say you want to display a modulator’s visible name in a ui label, since I am setting all the unique names to AbbrCamelCaseLabels for scripting purposes… instead of %n = %s %v what would I use in place of %n which displays a unique name?
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 18, 2011 at 4:59 pm #2930%N is the visible name (non unique)
%n is the modulator name (unique)July 18, 2011 at 6:34 pm #2931"msepsis":2giil2d5 wrote:Thanks Atom, one quick one… lets say you want to display a modulator’s visible name in a ui label, since I am setting all the unique names to AbbrCamelCaseLabels for scripting purposes… instead of %n = %s %v what would I use in place of %n which displays a unique name?[/quote:2giil2d5]Does LUA require the unique names to be in single word format, or does
[b:2giil2d5]getModulatorByName("filterResonance")[/b:2giil2d5] work just the same as
[b:2giil2d5]getModulatorByName("Filter Resonance")[/b:2giil2d5] if that’s what your unique name is?I’d really hate to have to go back and rename all of these
July 18, 2011 at 8:11 pm #2932it has to be the same as the unique name in the panel, doesn’t matter if it’s all spaces or something.
July 18, 2011 at 8:35 pm #2933Fantastic.
I’m reworking your midi example for the Blofeld. Without it, this would be going nowhere ” title=”Smile” />
With that said, a modulator name list/table would be VERY handy right about now. ” title=”Wink” />
July 18, 2011 at 9:35 pm #2934there is a nasty quick mock-up of a modulator list in latest build, you can see the button in the panel toolbar.
July 19, 2011 at 1:09 am #2935Ok, so regardless of the fact that the code below works, it’s still giving me a runtime error when I test with the bug icon in ctrlr’s Lua method editor.. what is the cause of the error? Atom this is basically your script from your Demo MIDI panel. That panel also fires a runtime error when tested, FYI.
[code:3tuzo200]
— Check length of incoming midiMessage, if 265 bytes then it’s a sysex dump
midiMessageReceived = function(midiMessage)
s = midiMessage:getSize()
if s == 265 then
out = panel:getModulatorByName("outputLabel")
out:getComponent():setPropertyString ("uiLabelText", midiMessage:toString())
console("received program data")assignValues(midiMessage)
end
end[/code:3tuzo200]
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 19, 2011 at 8:31 am #2936what is the error, the debug icon is a bit weird it should work but i saw it behaving weird (this icon creates a new LUA context and tries to run everything in that). It should give a bit more info on what’s happening, do you have the assignValues() methods defined too ?
July 19, 2011 at 5:35 pm #2937this example is ok for me.
what is the next step ?
do we need documentation to analyse and understand the midi dump result?July 19, 2011 at 5:47 pm #2938yest, without the knowledge about the sysex format that the device sends, you can’t do anything with it (perhaps maybe save it to a file as a backup).
All the information about the sysex format should be in the manual for the device.July 19, 2011 at 6:49 pm #2939i v’e found a little utility : evolview http://www.trevorg.net/evolver/ very usefull to understand the evolver program data dump.
but even with this kind of documentation it will be a very long and hard job. if it will possible to save program in a CTRLR format it will be not necessaryJuly 19, 2011 at 9:03 pm #2940"atom":damf92p7 wrote:what is the error, the debug icon is a bit weird it should work but i saw it behaving weird (this icon creates a new LUA context and tries to run everything in that). It should give a bit more info on what’s happening, do you have the assignValues() methods defined too ?[/quote:damf92p7]the error I get from the snipit I pasted above is the same error I get when testing your midiMessageRecieved script on your "DEMO – Midi" panel – "CALL FUNCTION EXCEPTION: lua runtime error"
I do have the assignValues() methods… a good number of them, almost one for every knob on my panel.. they do pass values to the knobs and it’s mostly working but I noticed this error when testing so i took out the assignValues() to test and identify where the error was coming from… it seems to be coming from what I pasted above, which again is the same error I get from your panel.. I guess I’ll ignore it, just annoying that there isn’t more info than that and it seems this button isn’t to be relied on for testing scripts. hmmm. I’ll come back to it.. I’m winding down my work on this panel till I come back to earth in a few weeks ” title=”Smile” />
thanks atom for all your work on this and helping out.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 19, 2011 at 9:10 pm #2941you can’t have multiple assignValues() methods you can have one, if you have multiple the last one compiled will only work. It’s a global lua context the names must be unique for methods and variables, you can define a variable in a method for one slider and access it in some other slider, it’s all one big memory segment. You need to think globaly in terms of the panel, no localy for just one modulator. It has to build like that otherwise it makes no sense at all.
July 19, 2011 at 9:24 pm #2942as for the complexity of the task…
well it’s not simple but it’s the creators job to figure out a way to make it simple. The perfect way would be for the manufacturer to supply XML documents for their devices in a well formatted standard way. A XML that describes all the parameters their min max values their types, the sysex dump format and all the MIDI stuff that happens, instead each manufacturer provides a different document for that. Each document is written in a different way, there is no standard, so it’s your job to translate that document to some language that Ctrlr will understand.
I gave an example that shows ONLY how to interact with the elements in the panel, how you will interact with the document that describes the sysex format is up to you. If you have some text representation of the format you can paste the whole thing and just parse it on the fly, you can design your panel in a way that will make this interaction easier.
In the end you need to figure out a way to get the information from the manufacturer docs into Ctrlr so that writing your LUA script will be easy.
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.