Change plugin presets with Lua DSP script

1 reply [Last post]
noedig
User offline. Last seen 6 weeks 1 day ago. Offline
Joined: 2016-03-09
Posts:

In a quest to find a way to change a plugin preset by means of a MIDI message, I looked into doing this with a Lua script.

(Could not find a way to do this via already built-in functionality or OSC. Please let me know if this is actually possible.)

I managed to create a simple DSP script which changes a plugin's preset. However, I have the following limitations:
1.) You have to specify a specific track by index.
2.) You have to specify a specific plugin, also by index.
3.) You have to specify a plugin preset by label or URI.

For this to just work, I envision being able to insert my preset-change Lua plugin into a mixer strip, right before the plugin which preset you actually want to change. My Lua preset-change plugin would then pass through all MIDI, but on a program change event, would change the preset of the plugin right after it. In this way, when adding new tracks / plugins, the user doesn't have to change settings in the plugin when things get reordered. The plugin will simply just always try to change the preset of the plugin immediately after it.

HOWEVER, to achieve this, I'm currently missing the following functionality in Lua scripting:
a.) Get the current track and current position of the Lua plugin itself.
b.) Change a plugin's preset using an index, rather than name.

Is there a way to get a.) and b.), or to achieve reliable preset changing in some other way?

dth
User offline. Last seen 5 weeks 3 days ago. Offline
Joined: 2015-04-07
Posts:

noedig, If I understand correctly you would like to send MIDI CC messages to some plugin to change patches(presets) in the timeline.
If that is wrong please ignore the rest of this post...

Here is an example of the way I do it with Instrument plugins, physical synths, or rack effects. I'll use General MIDI synth as an example but I mostly use this method to control effects units within the timeline of a project.
1. Create a MIDI track with no instrument...
2. Under the tracks fader in the editor set it to Generic and General MIDI
(these pulldowns get populated with midnam .xml files but that's a different topic)
3. Add the general MIDI synth plugin to the track in the plugins section.
4. Add a MIDI region to the track.
5. Position the playhead where you want the change to take place and RT-BTN in the region -> trackname -> MIDI -> Insert Patch Change.

If everything is correct your preset or patch names should be too.