Lua Scripting Docs #710
Replies: 6 comments 4 replies
-
The docs are limited on purpose as the api (still) isn't final. I have one more wave of finalizing some of the basics: and also need to flesh out the scripting section in the manual. <-- one of the last items before a real 1.0 release. Things that need addressed:
The best docs for a DSP script right now are the examples. |
Beta Was this translation helpful? Give feedback.
-
Ahhh yeah. Also need to work in something to get Host time inside the script. Pretty close to having it finalized. |
Beta Was this translation helpful? Give feedback.
-
Just as a follow up, here is for example the list of functions in LogicPro's scripter (something I am quite experienced with), these are just the functions that query the host for some information which you can obtain from inside the equivleant of your process() callback https://support.apple.com/guide/logicpro/use-the-javascript-timinginfo-object-lgcee186be46/mac Essentially it's everything we need to know about the current process block, what is the start and end beat position, what is the current tempo, current meter and current looping info. Note that I wish Scripter had a way to report latency back to the host also for lookahead scripts, but it doesn't (hint hint) Scripter doesn't bother reporting sample rate, because it is instead providing the time as best position (fractional value). the assumption there is that sample rate is not needed for midi only scripts. Element will provide wave processing so maybe sample rate could be needed? Other scripters I have dabbled with only a small amount include BlueCatAudio's scripter which uses angel script and Lua ProtoPlug... You can see the ProtoPlug docs here for their host query functions which are similar to Scripter's but include WAV also. https://www.osar.fr/protoplug/api/modules/plugin.html so you can get sample rate, but also there is a lot of stuff about the start position of the buffer, at a very minimum the bar position related to the start of the buffer needs to be known along with the sample rate in order to calculate a musical beat position for every event relative to its bar position. Scripter makes it a little easier by actually putting the beat position automatically(optionally) into every midi event. so we don't have to do sample rate and timestamp calculations relative to some starting beat position in order to obtain the actual beat position of the note. But anyway sooner or later, for meaningful musical midi...that calculation needs to be made. I recently was investigating Loomer Architect also, which is quite interesting and might be biggest direct competitor to Element in its own way, also still in beta. Has different strengths and weaknesses and not open source, but in any case, I looked at his Lua API a bit..which is kind of weird and focused on his paradigm, but ultimately the midi timing is handled by one callback per midi tick at 960ppm, which is a little limiting but also pretty simple so you know exactly how and where in musical time you are recieving and scheduling midi events. And special considerations have to be made when the host is looping. anyway hope that makes sense. |
Beta Was this translation helpful? Give feedback.
-
Oh nice. Good reference. yeah I have some ideas, but always good to look at other systems. This is the time to work out details like this as the API isn't finished (in terms of function signatures etc etc), but needs to be before this 1.0. |
Beta Was this translation helpful? Give feedback.
-
Working ticket for API finals and suggestions: |
Beta Was this translation helpful? Give feedback.
-
quick question, how do I open the Lua script editor. I added a script node to a graph, but double clicking it opens a GUI panel with a gain knob...presumably there is some default gain script in there....but I can't find any way to actually open the script editor and change it. |
Beta Was this translation helpful? Give feedback.
-
I see that Lua Scripting Docs have been updated substantially and it looks like I may be able to start trying to do some midi scripts I have in mind using Element. I'm excited about the future prospect of also being able to create any simple GUI along with midi processing, so this is very cool!
One question, I could not find anywhere a summary of the various known callback functions, (ie such as prepare, process, etc). Does this exist anywhere?
Also I see the various el classes and their methods, all very useful, but I am curious about other helper functions that we may need, such as obtaining sample rate, or obtaining start and end sample of the current buffer (MidiPipe), tempo, isPlaying status, etc, etc..
Beta Was this translation helpful? Give feedback.
All reactions