Rust Audio

Need advice to make LV2 plugin in rust

Hello, i’m interested by doing some LV2 plugin with rust but i don’t know where to start. I see several crates for it on, but i don’t know which one to use and what LV2 feature they have:

  • lv2: it has an example, but the autors say he isn’t sur of what he did
  • lv2_raw: seems to be the closest to the C version of LV2 , but no examples to start with
  • lv2rs: i found examples for this one but this crate i deprecated.

I also found rust-lv2 on github. Seems actively maintained, but no examples to start with. (i tried this one, and i failed to understand what to do)

Finally, it’s possible to deal with FFI: Good to learn stuff and never stuck by missing feature, but it’s probably long and the most error prone.

So what’s your advices ?

Hi @Yruama_Lairba, welcome on this forum!

I would go for the rust-lv2 crate on GitHub. I wouldn’t go for FFI: I’m afraid you would end-up re-implementing something like rust-lv2.

As for examples, that’s indeed missing. You can try to follow the book for C and “translate” that to Rust. I expect the names to be similar enough to enable you to find out what the Rust equivalent is. Also, I think others would be interested in this, so you can publish it. If you have questions along the way, you can post these on this forum.

You can also open an issue for rust-lv2 and ask to add examples and wait for these to be written. Sometimes waiting for libraries is the best strategy :slight_smile:

In this forum topic, @Michael-F-Bryan posted an interesting blog post about how Michael approached a particular problem. The interesting thing about this post is that in the first steps, no real-time “framework” (like LV2) is used, so you can already work on part of your plugin while you wait for LV2 to have more documentation. This approach may or may not suit you, depending on what you had in mind.

Good luck with your plugin! Feel free to post more questions when you have them.

Hey, nice to know that you’re interested! You should definitely use rust-lv2. lv2 and lv2-raw won’t help you much and lv2rs is a prototype of mine that lead to the development of rust-lv2. It is still in development, but a lot of the important and useful stuff is already implemented. But please note that this project is still in development and a lot of things may break.

As for the book: I’ve already started to translate it! It’s currently hosted on and I already requested that it should move to the RustAudio group.

Happy coding!

I general, i agree with you for FFI, most of thing may already implemented else better than i would done. But i fear that someday, i will need a LV2 feature missing in the framework.

I already tried to use rust-lv2 crate by following the book for C. Unfortunately, some function have different name or signature, so i failed.

Thank you, it’s exactly what i was searching for. I may look at it later because i need to refresh my rust skills, i have some difficulties with referencing, coercion and borrowing.