Update LV2 control port from MIDI


I am working on a plugin to tune setBFree using MIDI.
Everything is working well except the back notifications.

Basically setBFree can be controller using MIDI, and can notify back the state of the synthesizer using MIDI. For example you can ask to apply a preset, and it will answer to location of each drawbars, and other stuffs. It’s fine. That’s a common design.

But i am stuck with the notifications, and i have no idea what to do with. It looks like that is no way to update programmatically a LV2 control port. Then no way to update the GUI. Is that right? Sounds crazy to me.

I just found https://github.com/drobilla/lv2/tree/master/plugins/eg-params.lv2 but it is not really what i want. Or is there a tutorial or an explaining how to use “Parameters” within the Mod GUI?

Or if somebody knows a plugin which can display MIDI input, there is maybe the recipe inside.


We do not support the LV2 parameter API yet, so it is not possible to get notified of control/parameter changes.
But LV2 control outputs work, as long as you define them as monitoredOutputs in the modgui.
See http://moddevices.com/ns/modgui/#MonitoredOutput

We want to have some file handling support next year, and this involves supporting LV2 parameter API.
So this is something we will be working on soon.
Not many plugins use this new API, since it is well, newer, and more complex compared to simple control ports.
But LV2 does not allow a plugin to change its own inputs ports (they are read-only), so the simplicity has a heavy trade-off.

Thanks for the answer.

Do you have an example of plugin using that monitoredOutput? I dont know it is what i am searching for cause still, it is only about the web GUI right? The Mod Duo X LCD will not be updated. Anyway, it’s better than nothing.

Still i don’t really understand this lake in the LV2 specification.

Pretty much any plugin that has dynamic text or elements right now will be using monitoredOutputs.
stepseq and tinygain are the most common ones.

for example the tinygain, it declares the following:

modgui:monitoredOutputs [ lv2:symbol "level" ] , [ lv2:symbol "mute" ] ;
modgui:javascript <modgui/script-tinygain.js> ;

The JS code is at

Whenever the control outputs “level” or “mute” change, the MOD GUI receives an event in the javascript code. This event is what makes the text change dynamically.

Later on, the JS side of things will be able to pass arbitrary messages to DSP side (via lv2 “atom”) and vice-versa. This is relevant to the new parameter API as it is a way to push for example strings in a parameter (lv2 parameters can be more than just numbers, they can be strings, filepaths or even binary blobs)

You mean the limitation? It is because the core structure was taken from LADSPA, and the limitation was there.
LV2 authors now regret doing that…

I was not aware of the output control ports.

Then i could use the output port changes to tune input ports of the GUI with javascript? Is that the idea?

It will be really verbose, but it could work. I will maybe try, just for fun.

  • I create 2 ports Ain/Aout
  • I emit a MIDIout to request a preset
  • I receive MIDI notification to update A to 2
  • I update Aout to 2
  • Witch trig the JS
  • The JS could tune the Ain control to 2
  • Then Ain finally have the value expected

Is it easy to set value to a port in JS? I mean do you provide an API?

No. You cannot, under any circumstances, have the DSP of your plugin change the value of their its input ports.
Using a GUI as a wrapper around this is not only very ugly, but seriously asking for trouble. (things won’t work if the GUI is not open, for example).

I know, but i don’t have much chooses.

If the GUI is displayed i really want it to be synchronized. If the GUI is closed, in the Mod context, that’s no matter.

If you make an LV2 plugin using the parameter API, and targeting hosts like Carla (v2.1/git), jalv, Ingen or Ardour where this API supported, you will have a great plugin for when MOD supports such feature.

If you need it right now, yeah I can see how it is not nice.
But the more plugins we have using the new API, the more pressure will be on our side (and all LV2 hosts) to implement it.
Precisely because barely any plugins at all use it, that host support is also poor…

1 Like

You convince me. Let’s try to do useful things… which make me sad :slight_smile:

I still have to understand that parameters, cause right now it’s not obvious. This eg_params is i hope a good entry. ANd you are right i can anyway try it with another host. I also want to create a widget to display MIDI input, if it does not yet exists. Here i can do some stuff with output ports+javascript :slight_smile:

Making useful things is useful :slight_smile:

The eg_params.lv2 is not the best example, I often suggest this one instead https://github.com/x42/property_example.lv2