Sending program change when selecting Electra presets

Is this possible? I want to select a preset on the Electra and have it call up a corresponding preset in Mainstage (or anything else).

Simply being able to trigger a simple Lua script upon patch select would certainly do it. I can readily figure out the Lua syntax, I just want to be able to choose an Electra Preset and have the corresponding program number sent to my laptop. Seems like it would be a common use case.

A one extra button push workaround would be for all of my Electra presets have a pad to send patch change in the upper left. So switch presets, and then send the program change. I also set up a preset specifically to send patch changes, via either pads or a list, but that seems unnecessarily unweildy.

Something like this should work:

function preset.onLoad()
    midi.sendProgramChange (port, channel, programNumber)

Replace port with either PORT_1 or PORT_2, and replace the other two parameters with the correct numbers.


Thanks. I was just coming on here to say I came up with that after reading through the Lua extensions. (Sure you did, Phil) No, really:)

1 Like

Alas, not working for me. I can invoke that and send it to the Electra to change Electra patches, but upon Electra patch change from the touch screen it does not fire off the midi program change to my computer. I am not defining a device, but I wouldn’t think that would be necessary.
In parallel to those efforts, I’m setting up the top two rows with all pads sending programs 0-10 on the first eleven buttons, and the 12th is a list where I can just scroll through presets beyond the first 11. It will be common to every patch in this bank, but then the middle and bottom 4 rows will be labelled/designated for the specific preset. That should cover me for now.
What I was trying to do seems very doable, and I will troubleshoot it. I code as my dayjob, and though not Lua experienced, the docs are clear enough and the syntax seems intuitive.

Are you by any chance connected to the Electra Control USB device in mainstage? That one ends up being PORT_CTRL instead.

I believe I am. That might be it! Will check first thing in the AM. Great tip!

1 Like

The CTRL port is used by the editor itself, so if you are doing something in the editor, other programs might not have access to that port, unless your OS allows this.

In the editor, there is a MIDI CONSOLE. You can find it in the same spot as the Lua editor. In that console, select the first E1 MIDI port, then change your preset. If you don’t see your message there then select the second E1 MIDI port as well.

If you still don’t see the message then post a link to a present where this problem occurs and I can try it on my E1.

I have an E1 mk2 and I can test on the latest stable or beta firmware.

Which firmware are you running?

Revisiting a bit, but I have been sidetracked. I have a good working prototype for my Mainstage use case using one preset, with some pads for selecting my primary Mainstage patches, and a list where I can scroll through all. The bottom 2 sets of rows are for controlling parameters.
I am still interested in why preset.onLoad() will not always fire the patch change to Mainstage. The thing is, the code works, but it works exactly once after booting. It is like the port is getting hung. This behavior is the same using CTRL or PORT1. Will get back around before troubleshooting.
At this point all that getting this to work would buy me is labeling the controls. But I still wish to figure it out.
FWIW - the pads and fader that sends patch changes to Mainstage are all using PORT1 and that works seemlessly.

One thing i ended up doing for a preset was to put a “Sync” button on the main page. The idea is that once everything is up and connected, the user presses Sync and then the preset tries to communicate with the target hardware.

When I try to automate that initial handshake, I always ran into problems with timing or the hw was on a wrong menu and wasn’t listening, or any other of a myriad of reasons.

Sure it would be great to have everything ‘just work’, but this was a much more reliable approach and resulted in less troubleshooting.

1 Like