Lua Implementation

Been busy with other things recently so not paid much attention to the Lua implemention

Can I use Lua to dynamically alter the contents of a list based on another control?

A common example would be a LFO sync setting where the rate could be hz number or some note/beat value depending on whether the LFO is internally or externally sync’d to clock

Or on the Novation Peak where for a wavetable to be used as an oscillator shape you have to first set the oscillator type to a different value. In that instance you would only want the wavetable control to display if the oscillator control had its type set to one specific value

At the moment I’m using two rate controls on a synth preset to represet this which is a bit messy but wondered whether this is something that Lua can handle

1 Like

I think you get the drift of it allright, both cases seem to be the exact aim of LUA in the Electra One.

1 Like

Cool - I’ll have to look more into it. I’ve got a few presets that would benefit from a bit of programmabilitiy

1 Like

Just been reading through the documentation and this looks really good. One of my bug bears with various manufacturers midi implementations is that they sometimes overload a CC or NRPN so if the value of a completely different CC is one thing it does a specific function but if it is another then it does a completely different one (Novation seem to do this a lot).

Looks like this will allow me to craft a preset that deals with those sort of issues - which will make the preset a lot slicker

Before I start diving in. Does anyone know if you’ve attached a lua function to fire when a value of a control is changed - will that function fire when the preset is first loaded with a default value, or does it only fire then the control is first altered? Also within a controls epr json can you specify if it is initially hidden?

The Lua extension is basically a response to number of questions or features requests that were mentioned here on the forum and on the Development list. The declarative JSON is perfect for setting up the preset data but expressing things that have more “dynamic” nature is difficult or extremely verbose. My gradma always told me that one line of Lua is worth a thousand lines of JSON :slight_smile:

This is, for example, one of typical situations when Lua can make things possible and easy. Another example - I think @RobinC mentioned that elsewhere - is changing the list values according to the value of another control. It does not end, however, with “spicing up” the presets only. The timer and transport libraries allow developing of stuff that goes far from synth presets. For example, I have developed a neat arpeggiator already.

Now, you might wonder why I keep this firmware in beta. Simply because I do not want to roll it out and make some substatial change to the Lua API shortly after that. Something that would invalidate work of many users. I do believe that we are getting close though.

At this very moment, the Lua functions are not fired at the preset load but I am working on it. It must be there to ensure a consistent starting point. The visibility attribute has been added to the JSON already. The beta editor allows you to set the inital visibility of any control.

I am open to any suggestions, if the Lua is implemented properly, it will turn Electra into a very powerful controller.

2 Likes