July 9, 2011 at 11:55 am #371
I commited them yesterday but my sleeping pills didn’t allow me to write anything after the commit (it was 4am)
You will find 3 example panels here: https://ctrlrv4.svn.sourceforge.net/svn … rlrv4/Doc/ they show a small fraction of what can be done, all LUA is edited from a method property for each element (modulator/panel), those look like this:
So for the example panels have a look at the properties of components and see witch one has an assigned method, click the editor button on the property to see the actual LUA code that makes the magic happen. For now there are just two callbacks (there is a lot more planned) one when a modulator value changes, and one when MIDI is received on the panel (those two enable sending/catching/parsing SysEx dumps as programs witch is what i was aiming for in the first LUA release).
So check that out, compare that to the API Docs to see what method does what, there is the LUA console that you can experiment with.July 10, 2011 at 7:58 pm #2875fozzieParticipant
- Topics: 1
- Replies: 24
- Total: 25
Nice, thank you once again for all the coolness ” title=”Smile” />
I have taken a look at the LUA midi-receive panel example and kind of get the idea, but I’m not really familiar with the object oriented side of programming and corresponding syntax. Would anyone be willing to write an example on how (a) received value(s) could be assigned to one specific modulator that is present in the panel? That would help me in understanding LUA syntaxis. I would like to work on parsing a complex incoming sysex to update the MWXT panel without needing a midiox-script, but am not sure where/how to begin… I don’t mean to be demanding anything here, it would just be cool if someone could help, otherwise it will probably just take me a little longer to figure things out, which is no problem either.July 10, 2011 at 8:00 pm #2876
sure i’ll do an example assigning values from program dumps.July 10, 2011 at 10:25 pm #2877
I played a bit with these examples this weekend and am getting really excited. They weren’t working on the mac build you had up but I see there is a new nightly osx build I’ll have to check out.
I’ve already started my list of little tricks I want to script up in Lua and am starting to wrap my brain around what I’ll need to do.
the added bonus is that Lua can be applied… anywhere. I’m feeling like learning Lua is like taking a math class in elementary school!
Thanks a lot for these examples atom.July 11, 2011 at 2:24 am #2878FilchParticipant
- Topics: 22
- Replies: 173
- Total: 195
Same here. I was going over the examples and at first I was feeling overwhelmed, but after more studying I could see what was what. I just need to learn the syntax and get comfortable.July 11, 2011 at 9:35 am #2879
One important thing to add to the API Docs, are the IDs that are used all across Ctrlr to indicate properties, most of the time you will be doing a set/get on a property to do anything in lua.
Here is a list of all IDs with descriptions and Human Readable names as they appear in Ctrlr (it’s a c++ include file, but it’s a one-line-one-id thing)
https://ctrlrv4.svn.sourceforge.net/svn … CtrlrIDs.hJuly 11, 2011 at 4:11 pm #2880
thanks Atom. I haven’t been able to get anything useful out of the midi example – I noticed you updated that example a bit after I downloaded it again last night – is that midi example supposed to be functioning? The dump request sysex string is something generic, doesnt work with my synths, but doing a sysex dump from the synth does nothing to that midi example either. What am I missing?July 11, 2011 at 4:55 pm #2881
That example is for DSI Mopho only, every device has a unique request program sysex (or at least a bit different), so it will work only with a Mopho, but it’s an example it should illustrate how things happen and where.July 11, 2011 at 6:57 pm #2882
right. i definitely understand every synth has a different dump request string. ” title=”Smile” />
even if the panel is a demo for a synth I don’t have….
I see a requestProgram Lua script attached to the request program button that puts together a f0 01 25 05 xx xx f7 message. Fully aware that this bit is pure example and requires the morpho. but this is the only functionality I see scripted into the panel.
I see the midiMessageReceived code, what is this attached to? I was expecting it to be attached to output label, but nothing seems to be attached to that field. Like I said, I initiated a dump from my synth (not the panel as obviously that’s different code) and expected some input into the outputLabel field but got nothing. . .
None of the knobs have ccs assigned to them, I’d imagine the idea is that you do a dump request, the outputLabel updates w/ the long format sysex message, then the knobs update but how does this function if the knobs aren’t even assigned to controllers?
So far all i can tell this panel is good for is putting together a dump request from a morpho for the bank/program you select on the panel, what else can I learn from this demo panel? I don’t need to know how to put together a dump request. I already have that coded.
thanks!July 11, 2011 at 7:13 pm #2883
the midiMessageReceived is attached to the panel to the incomming midi event, it’s fired for every MIDI Message comming into the panel.July 11, 2011 at 7:42 pm #2884netchoseParticipant
- Topics: 15
- Replies: 70
- Total: 85
i’ve beginning to learn LUA. the color change panel is exactly what i need.
it seem very powerful !
thanks a lotJuly 11, 2011 at 7:47 pm #2885
there is a load of examples on the net, i think the most i found is in WoW (World of Warcraft) cause LUA is inside there, but a lot of programs use LUA for scripting.July 12, 2011 at 1:19 am #2886
thanks atom for your efforts. I see now the [i:3gx4h84x]panel [/i:3gx4h84x]is assigned the midiMessageReceived call.
pardon me for being so persistent… but I am not fully understanding the extent of the demonstrated functionality of your demo midi panel. I’m not just speaking for myself here, either
Suppose I have morpho connected… when I hit that "request program", does the ctrlr panel’s demo knobs and combo box update with all of the settings of the bank/program selected?
[b:3gx4h84x]How does that occur if all of the knobs on that panel are set to MIDI message type "NONE" ??[/b:3gx4h84x] is there something further behind the scenes that I’m not seeing?
thanks a lot!July 12, 2011 at 8:05 am #2887
no you send a request (actualy at some point the Program Manager will be doing that), you catch the response with the data (usualy some big sysex message), you interpret that message (read the bytes, toggle some bits, decompress, unpack whatever it takes to get the actual numeric values for your modulators), once you got those values you assign them to modulators in the panel, this can be automated in many ways (you can have an array of modulator name->index where the index will be some kind of pointer to a value in the sysex dump, so that when you assign the values you don’t need to access each modulator directly). There are hundreds of possibilites here. But that’s how this will work in general
SysEx program request
Receive dump data
Parse dump data
Assign values to modulatorsJuly 12, 2011 at 3:48 pm #2888
Imho it would make most sense to allow the modulator’s assigned CC or sysex param change short string be the pointer so you don’t need to duplicate work naming a modulator when it’s already in essence "named" by the value it sends..July 12, 2011 at 4:53 pm #2889
i don’t get it, what property would you like to index modulators by ?July 12, 2011 at 11:27 pm #2890
rewind a bit…
You said: "…you catch the response with the data (usualy some big sysex message), you interpret that message (read the bytes, toggle some bits, decompress, unpack whatever it takes to get the actual numeric values for your modulators), once you got those values you assign them to modulators in the panel…"
"whatever it takes to get the actual numeric values for your modulators" … The modulators already are indexed by the parameters the modulators send, right? The knob that sends CC13 should inversely be receiving something that looks like CC13 and some sort of value, which is contained within that "usually some big sysex message"… why make more work by requiring some giant array be defined (if your panel has a lot of modulators) when the modulators already are indexed and defined by what parameter they send. .. IE just like if i move my CC13 FM amount knob on my ctrlr panel the parameter is sent to the synth: if i move my [b:1bjircqb][i:1bjircqb]synth’s[/i:1bjircqb][/b:1bjircqb] FM ammt knob, my [b:1bjircqb][i:1bjircqb]panel’s[/i:1bjircqb][/b:1bjircqb] FM ammt knob moves. So you see the modulator already IS indexed…
so why not in that "read the bytes, toggle some bits, decompress, unpack" stage, the long sysex string gets parsed into either a string of cc parameter changes and/or short sysex messages? This is precisely how Fozzie’s midiox script works with my microwaveXT panel. It’s really elegant, contrary to fozzie’s claims that he doesn’t have much programming experience.
typing this on my laptop in blinding sunlight outdoors, I’ve done the best I can to re-read this post and make it as clear as possible.. hopefully this makes sense.July 12, 2011 at 11:41 pm #2891
…maybe this all helps to shed light on why I’m confused about how your example panel updates any of the knobs as none of the knobs are "indexed" (as in none of them are set up to send any parameters!!? ” title=”Smile” /> Obviously the point of a ctrlr panel is to control synth parameters so the modulators would need either a cc or a sysex parameter assigned to it.. None of the modulators in your Demo-MIDI panel do, hence my confusion.
You didn’t answer the question above regarding the example panel: assuming I have a morpho connected: DO the modulators update after the "request dump" button is pressed?
Thanks atom.July 13, 2011 at 8:16 am #2892
no the mopho does not yet update, since i had some more serious bugs to fix, i’ll try to finish that asap.
As for the indexing i can do more accessor methods for now we have 2 getModulatorByName() and getModulatorByIndex(), but i will add getModulatorByMidiMessage() getModulatorByComponentType() and so on. Those two available now are the basic primitives.July 13, 2011 at 8:05 pm #2893fozzieParticipant
- Topics: 1
- Replies: 24
- Total: 25
Maybe I can join in the confusion ” title=”Wink” />
Msepsis, I think what atom means by the indexing of the modulators to get proper values assigned to them is in essence the same activity I have done with my Midiox script, you use the position / index of a value in the long sysex message to link that to the proper controller. I’m guessing you can set that up in combination with assigning short cc or sysex messages to the knobs (as is the case in the MWXT panel). Whether you then parse the long sysex into the short messages or make some array to redirect/parse the long sysex-derived values to the correct knobs using an array or table is about the same amount of work. If this whole scripting is independent from the short sysex / cc message functionality that is already present, you can still turn a knob on your synth and also have your panel update directly.
What is not clear to me yet is how you can take/parse values out of a midi message and assign that to one of the modulators to update its value, but I guess that is what we should use the getModulatorByName() and getModulatorByIndex() methods for? Is that right atom?
- The forum ‘Programming’ is closed to new topics and replies.