Lv2 - 101

Hi all,
I’ve a fair bit of dev under my belt (30+ years of C/C++/etc) but am struggling to engage with building LV2 plugins for my Dwarf (Tho I have a number of ideas about what I’d like to create)

Can you suggest any LV2 development for idiots style resources to help ease me into it?

3 Likes

This isn’t a great recommendation (because it isn’t LV2-specific), but I started with DPF. And by “started”, I mean that I haven’t actually finished building anything yet. What I have done is used the docker container of mod-plugin-builder to manually build and deploy existing plugins to get familiar with the environment. I guess I’m a slow work in progress :slight_smile: I had a list of resources on LV2, but I don’t think I saved it.

1 Like

BMusic has some video tutorials on how to make LV2 plugins from scratch: BMusic - YouTube

But I’d also recommend looking into DPF and the plugins that use it to get started.

2 Likes

Not ideal (I know… ), but my strategy would be to ask ChatGPT for a working example and then modify it to suit your needs.

I spent some months for creating some compilable seeing other lv2 projects. I recommend you to see my GitHub project. I tried to make the most organized that my patience enabled.

The source code can be compiled using Docker. I used this way because my machine has some problem with the LV2 dev libraries. But you can use the makefile for compiling without docker if you want.

5 Likes

I feel your pain here. I am not that much of a c++ developer, except for doing arduino powered stuff, like a midi flute, and the learning curve for plugins was quite steep, somewhat like this picture.

image

I’ve found the youtube playlist below to be somewhat of use for me, while torturing because of the annoying background music.

By the moment when I created a plugin capable of playing midi files with midifile library I was exhausted as hell and switched to other hobbies, to cut losses for my self esteem.

For the second attempt I’ve taken DPF library quite recently, and it’s feels more simple to start, so it might be feasible to try it, depending on you task - as DPF is more limited than the plain lv2, as soon as it tries to be able to generate plugins in different formats, and functionality that it can provide is a roughly an intersection between capabilities of all these formats (for example even if you build a lv2 plugin with DPF - it would not provide multiple MIDI outputs, even if lv2 is capable of that - because non-lv2 format plugins cannot not do the same). At least that’s how I understood it:
image

It feels quite solid, for example sending and receiving MIDI messages is much more straightforward than dealing with lv2 low level atom messages forging. Also you had not to deal with a burden of writing TTL turtle files initially to get a working plugin.

However I have no clue how to debug the damn thing - lv2 has a way to send debug printouts to the host, and DPF seems not to provide access to this function.

(Probably debugging with printouts is a noob approach, but I am unlikely to be able to use gdb against a plugin, running in a realtime within context of the host app, on top of a stripped down embedded box)

There was a long FalkTX video introducing DPF -

Quite valuable bonus for DPF is that it’s developer is a part of the MOD team, and has a presence on this forum.


In both cases processing audio seems to be similar - you will have to implement a method within a class ( or in case of pure C lv2 it also could be also just a function), that receives a buffer of usually 128 or 256 audio amplitude data frames, you do something with them and return then back by writing into output buffer modified as you will. If you are only going for audio processing - it seems to me that it would be possible to port your processing code between DPF and plain LV2 quite in a straightforward way, as conception is the same.

Differences would be more noticeable for parameter ports and midi stuff.

To compare you can have a look into simple amp plugins implemented both with DPF and plain LV2:

7 Likes