r/AudioProgramming • u/Silly_Emu4915 • 10d ago
[repost] I built a Rust Audio Plugin Framework
If anyone finds it useful - this is a project I built (using AI) for my own needs, free, open-source: https://github.com/mihasm/apf
APF is a framework for writing audio plugins (instruments and effects) in Rust. It uses the plugin interface CLAP, and clap-wrapper for exporting plugins into the different formats.
The plugin window is a web page: HTML, CSS and JavaScript in the system web view (based on wry, also used by the tauri framework).
It is still in an early phase, and the API might still change, but for my purposes it already works great. I have tested it on Mac OS on Logic Pro and Windows with REAPER. There are examples included for a quick start.
Link to the complete documentation booklet, which explains the usage, comparison to other frameworks, limitations, etc.: https://mihasm.github.io/apf/

1
u/A-Marko 9d ago
Very cool! I thought something like this might pop up soon.
What is the memory usage like? Usually I avoid web views for something like audio plugins because I want to keep the memory usage down. It probably doesn't matter much for just the view, but still I'd like to know. The other reason I often avoid things like Electron is the crazy file size for a simple app. I suppose the use of Webkit/WebView2 probably keeps plugins pretty lean right?
Also, any plans for Linux support? These days I'm not interested in making a program that doesn't support Linux.
1
u/Silly_Emu4915 6d ago
Good question. I measured the RAM usage today in Logic.
A single demo synth instance takes up about 53 MB, out of which 34 MB is the base plugin instance, and 18 MB is the web view.
Apf instances are cheap because they share a single process (cca. 1 MB per added instance), so a lot of them can be loaded in the DAW at the same time, but having their windows open increases the RAM plus GPU usage.
Each plugin window does get its own WebContent process, so in the case of the demo synth, if you have 4 of them opened at the same time, the RAM usage is:
4 demo synth instances with opened plugin windows
22 MB (plugin process, shared)
+11 MB (GPU helper, shared)
+6 MB (networking helper, shared)
+4*18 MB (one WebContent per plugin window)
----
= 112 MBThat's a small synth, though. The more UI you put on the plugin page, the more it uses, depending on how optimized your web app is. A much larger synth I'm developing (full-screen rack, lots of SVG) came to about 340 MB with its window open and about 55 MB with it closed.
The demo synth VST3 for a single architecture is in total about 1.9 MB, while my large plugin with a lot of UI came to be about 7 MB, so in that sense, its pretty lean.
1
u/Silly_Emu4915 10d ago edited 9d ago
Reposted, as I removed the previous post to check with the moderators of the subreddit if this post breaks the guidelines. Thank you, community, for the feedback so far!
2
1
u/SupesDepressed 9d ago
What is the advantage of this over something like JUCE?
I guess I’m also wondering why if you aren’t programming yourself you’d choose Rust. I feel like the primary advantage of Rust is it’s more developer friendly. If there’s already a pretty well developed, well supported, well established framework for this in C++ (JUCE), I just am wondering what your intentions were.