How to Automate lv2 Parameters: a useful workaround (Linux)

Write guides and how-tos about LMMS for other members.
Hi folks,
I love certain Lv2 instruments and effects, like OBXD and the IR reverb. However, one cannot directly automate their parameters in LMMS, making them somewhat lifeless. Below, I describe an effective workaround to automate parameters from LMMS to Carla and lv2 parameters
What you gain: automatically change lv2 parameters, sending messages from lmms via velocity. Discrete changes only (not smooth vector changes)
What you sacrifice: a single midi note, some time, maybe some frivilous processing
What you need: carla-lmms, carla-git, Note2CC.lv2 (https://x42.github.io/midifilter.lv2/ht ... etocc.html), all in Kxstudio Repos

Instrument set-up (i.e., what you normally do with Carla)
1) in LMMS, load a Carla-Patchbay instrument, add midi notes to the instruments piano roll as you normally would
2) open Carla-Patchbay, click "add plugins" to load your favourite instrument. I tried it with the Cabbage-lv2 additive syntheszier.
3) Setup all the Carla Patchbay connections as you normally would: i.e., in the Patchbay tab, connect the 'Midi-out:events-out' to the 'events-in' of your instrument; connect the 'audio-out' of your instrument to the 'Audio-Output' box ,etc. Make sure you are successfully generating sound and controlling the instrument from LMMS.
4) Select a midi-note to use for Automation-via-velocity. No need to do anything now, just find a low note (like midi-note 1) that is too low for audible sound. In this example I choose midi-note 1. Consider adding a notch-filter or low-pass filter in your carla-patchbay chain to further ensure that it doesn't generate any sound. (A better, but more elaborate solution is to additionally use MIDI Key-Range FIlter and Midi Channel Map to ensure that midi-note 1 is remapped to produce no sound, only send CC/automation messages, but the follow will work to demonstrate the idea).

Lv2 Automation
1) In Carla-Patchbay, click 'Add Plugins' and search and add Note2cc.
2) in the Carla Patchbay tab, ensure that the 'Midi Output: events-out' is connected to Note2cc:event-in'. Likewise, connect 'Note2cc:events-out' to the 'events-in' of the instrument you want to automate.
3) in the Carla 'Rack' tab, click on the WRENCH ICON of your instrument to load the Parameter Editor (not the instruments' GUI)
4) in the 'Edit' Tab (bottom of the Parameter Editor), make sure "Send Control Changes" is CHECKED. If this option is greyed out, you cannot do automation. Mentally note and remember of the 'Midi-Control-Channel'
4) in the Parameter Editor, locate the slider/controls for the parameter you want to automate i.e., click among the bottom tabs in the Parameter Editor until you find your parameter. For the Cabbage Additive synth example, I wish to automate the parameter 'Partials' which is the third parameter in the tab "Parameters (1)"
5) For the target parameter, change the "(none)" dropdown option to "cc#2" (or whatever control value you want; its only a concern if you are simultaneously using an external midi-hardware controller and must reserve cc#2 for other purposes). You will use this cc value in step 7 below
6) Close the Instrument's Parameter Editor
7) Open the Parameter Editor for Note2CC (i.e., click the WRENCH icon in Carla Rack tab), and click on the bottom tab labelled "Parameters (1)". Set the follow parameters:
"Filter Channel" slider to 1, (none), ch 1;
"Operation Mode" slider to 0, (none), ch1;
"CC Parameter" slider to 2, (none), ch1; important step, make sure the slider value equals the cc# value from step 5 above
"Active Key (midi-note)" slide to 1 note, (none), ch1; important step, you will use this midi note below in step 8.
Exit the Note2CC parameter Editor
8 ) Almost done! Back in LMMS, open the piano-roll of your Carla-Patchbay instrument, and add notes on midi-note 1. At the bottom of the piano-roll, adjust the velocity of midi-note 1 to increase or decrease the target-parameter's value. High velocity = high parameter value, etc. TIP: make the note as short as possible, like 1/64, so that it triggers the new parameter value but doesn't consume a lot of DSP power. The parameter value will sustain until the next midi-note 1 is triggered to change it.
9) Verify its working: run the piano roll in loop-mode and watch whether the parameter value slider is indeed going up and down as desired.

Hope that is useful. Consider exporting the Carla-Patchbay to a .carxp file so that you can use the setup as a template in the future. If anyone has an easier method, please let us know.

If you find this useful, I can elaborate on the use of MIDI Key-Range FIlter and Midi Channel Map to ensure that midi-note 1 is remapped to produce no sound, only send CC/automation messages.
I know this post is very old, but it's a very useful workaround and I'm not being able to reproduce it.

Right now I'm trying to automate Surge using this tutorial, and I followed those steps:

- Added a Carla Patchbay instrument, with a simple 4 chord progression. I added 1/4th notes at the beginning of each chord with velocity alternating from 0 to 200%. I chose C1 as a note, which is the equivalent to MIDI note 24.

- Added Surge and Note2cc to the Patchbay, connected them as in the picture below:
Patchbay.png
Patchbay.png (25.79 KiB) Viewed 7788 times
- Opened the Edit menu on Surge (wrench icon). MIDI Control Channel is 1 by default. I'm assuming that's the channel through which the notes from LMMS piano roll are being sent. Send Control Changes is ticked by default. I went to parameters, where the first 8 are Surge's knobs that are already set to control some settings in the synthesizer. The first one in my case controls the low-pass cutoff. I clicked on the 3 dots on its right and set "MIDI Control" to 16. "MIDI Channel" is left at 1 (default).

- Opened the Edit menu on Note2cc (wrench icon). MIDI Control Channel is also 1 by default. Send Control Changes is also ticked by default. Went to parameters and Filter Channel is set to 1 (I also tried 0, which is supposed to filter any channel, but it also didn't work). Operation Mode is set to 0 (Fixed parameter mode, CC-value = velocity). CC Parameter is set to 16 (the MIDI Control channel from Surge's parameter to be controlled). Active Key was set to 24.

When I play the track at LMMS though, nothing happens to the value from the parameter at Surge. I'm know broadly what is supposed to happen (Note2cc should filter the MIDI channel sent by the piano roll, and use the velocity from the selected key to generate another MIDI signal at a particular channel, which is going to be set to control the parameter at the synthesizer), but I'm a little lost when it comes to the meaning of some things, for example, what is the meaning of the "MIDI Channel" value of a parameter? Wasn't it supposed to just have a MIDI Control channel? Also, which channel is the piano roll using at LMMS to send the notes to Carla Patchbay? Because of those doubts I might be making a small mistake on the setup.

Has anybody been successful trying to automate Carla Rack instruments that way? What did I do wrong?

Thanks in advance!
I had never seen this topic before.

While googling on how to automate Carla in LMMS, few weeks back, I did find this:

https://github.com/LMMS/lmms/pull/4571

I have no idea if the work around of the topic started should work.

Maybe somebody else might know ?
Gps wrote:
Sat Apr 18, 2020 2:00 pm
I had never seen this topic before.

While googling on how to automate Carla in LMMS, few weeks back, I did find this:

https://github.com/LMMS/lmms/pull/4571

I have no idea if the work around of the topic started should work.

Maybe somebody else might know ?
EDIT:
I celebrated too soon. I figured out how to make it work using Carla-Patchbay as a standalone and routing the MIDI from LMMS to it, but I'm still failing to reproduce it using Carla-Patchbay inside LMMS (plugin mode). I'll keep you posted if I figure it out, maybe later I'll make a step by step to do the automation on the standalone version with the MIDI routing. Thinking maybe there's an issue with Note2CC on the plugin-mode of Carla-Patchbay, but I'm not sure..

I think I figured out what was wrong! Took me some debugging and research, but I could automate a parameter in Surge using the method here. I'm doing it all over again to see if it works and taking screenshots of every step so I can post it here and improve this topic for future reference!

The pull request you linked sounds very interesting! Because even with the workaround on this topic it's still a bit of a hassle having to automate parameters using a note's velocity. It's very limited and makes it very time consuming, so having a built-in interface with Carla Rack parameters would be awesome. Problem is from what I read it still depends on some updates on Carla, and it will probably take a while before we see it on the stable distribution.
Well, I decided to post how to achieve the automation on the standalone Carla-Patchbay, just as a starting point. Maybe we call all figure out how to make it work on the Carla LMMS Instrument. I opened an issue on Carla's github, because I suspect it could be something with the Note2CC not behaving properly on the plugin-mode.

So here's my steps (divided in more than one post because of attachment limits):
  • Open LMMS. Add a track with a silent instrument (can use Sf2 player). Make your chord progression/melody.
  • Choose a note to use as an automation signal. In my case I used C1 (MIDI note 24), choose one that you'll not use in the song and can easily cut out later. Put a note every time you need to change the automated parameter using the velocity as a value. Use velocity = 1 when you want a zero value, because notes with velocity = 0 are not sent through MIDI messages (from what I found out through debugging).
    VelocityKey.png
    VelocityKey.png (7.9 KiB) Viewed 7720 times
  • Enable MIDI output routing clicking on the track gear, then MIDI > Output > Midi Through: Midi Through Port. That will send the MIDI messages to a port where Carla-Patchbay can read from.
    MIDIRouting1.png
    MIDIRouting1.png (29.48 KiB) Viewed 7720 times
  • Open Carla-Patchbay standalone. On the upper menu bar, go to Canvas > Show External. Connect the LMMS MIDI port on the Readable MIDI Ports to Carla MIDI input.
    MIDIRouting2.png
    MIDIRouting2.png (12.86 KiB) Viewed 7720 times
  • Go back to the internal patchbay clicking on Canvas > Show Internal. Add the Note2CC plugin and the plugin you want to automate (in my example Surge). Connect them to the MIDI input and Audio output.

    Image
Continued in the next post...
  • Go to the plugin you want to automate and open the Edit window. On the Edit tab, I left everything at default.
    SurgeControlChannel.png
    SurgeControlChannel.png (77.81 KiB) Viewed 7716 times
  • On the parameters tab, find the parameter you want to automate. In this case it's labeled "C3". Click on the 3 dots on the right, then MIDI Control, and finally select a control number. I had an issue with the numbers selected on this menu don't match the actual selected control number. For example, 16 [0x10] General Purpose 1 actually maps to MIDI Control 22. So after selecting, click again on the 3 dots and see what is written at the top. As you can see, I mapped "C3" to MIDI Control 22 at channel 1. Also, you can set the minimum and maximum values the automated parameter will take.
    MappedParameter.png
    MappedParameter.png (48.16 KiB) Viewed 7716 times
  • Now go to the Note2CC Edit window, on parameters. You'll have 4 parameters to set: Filter Channel, Operation Mode, CC Parameter and Active Key (midi-note). At Filter Channel you can set either 0 or 1 (0 will filter any channel, 1 will filter channel 1 which is the channel LMMS is sending the MIDI output through). Operation Mode should be set to 0, which will take the value from the note velocity and send it to a fixed CC parameter (more details here). CC Parameter should be set to the control number you mapped the automated parameter to on the previous step. In this example 22. Finally, Active-Key should be set to the midi-note number of the note you're using to automate the track. In this example 24 (the midi-note number of C1).
    StandAloneMode.png
    StandAloneMode.png (22.02 KiB) Viewed 7716 times
  • After that step, when you play the track at LMMS you should hear the parameter being automated by the note's velocity.
That's all I could figure out by myself so far. If anyone manages to make it work on the LMMS instrument instead of the standalone Carla please let me know. I'm struggling to figure out why repeating those same steps under the LMMS Carla plugin doesn't work.