vst3-host
A safe Rust library for hosting VST3 plugins: discover them, load them, play audio through
them, control parameters, send MIDI, and isolate crashes — without writing any unsafe
code yourself. All VST3 COM interaction is contained behind a safe API.
use ;
Features
- Discovery — scan standard locations; read plugin metadata; export a full report as JSON
(
PluginReport). - Audio — a bundled CPAL backend drives a plugin to the default output (or bring your own
backend), with two paths: the easy mutex-based
playand a lock-freeplay_realtime(RealtimePluginRunner) that takes no lock on the audio thread. - Parameters — list, read, set (applied to the audio processor), and format them as the plugin itself displays them.
- MIDI — send notes, CC, pitch bend, aftertouch; capture MIDI the plugin emits
(
take_output_midi). Per-note expression / MPE vianote_on/send_note_expression(NoteId,NoteExpressionType), in-process only. - State — save/restore a plugin's state (
save_state/load_state), in-process or isolated. - Crash isolation — optionally run a plugin in a separate process (
process-isolation), with typedError::PluginCrashed+Plugin::recover(). - Native editors — open a plugin's own GUI in a standalone window, or embed it in your
egui app (
EmbeddedEditor, macOS). Windows/Linux window code compiles but isn't yet runtime-verified.
Examples
Discover and inspect installed plugins. discover_plugins scans the standard VST3
locations and returns metadata without loading any DSP:
use simple;
Read, format, and set parameters. Parameters are normalized to 0.0..=1.0;
format_parameter renders the plugin's own display string (e.g. "8.2 kHz"):
use simple;
Save and restore a plugin's state (its own serialized preset/patch blob):
use simple;
Contain crashes with process isolation. Run the plugin in a child process; a crash
surfaces as Error::PluginCrashed instead of killing your app, and recover() respawns
and reloads it:
use ;
Real-time, lock-free playback. play_realtime hands the plugin to the audio thread and
sends control over a lock-free SPSC ring, so the callback never blocks on your thread:
use ;
Putting it all together
A complete offline workflow: configure an isolated host, discover an instrument, tweak a parameter, snapshot its state, render a held note while measuring the peak, recover if the plugin's process crashes, capture any emitted MIDI, then restore the original state.
use ;
Feature flags
| Flag | Default | Enables |
|---|---|---|
cpal-backend |
yes | The bundled CPAL backend and simple::play / Vst3Host::play. |
process-isolation |
yes | Out-of-process hosting + the vst3-host-helper binary. |
egui-widgets |
no | EmbeddedEditor — embed a plugin editor in an egui/eframe window (macOS). |
[]
= "0.4"
Status & known limitations
The core is working and exercised against real plugins on macOS. What to be aware of:
- The default
playaudio path is correctness-first (it locks on the audio callback). For a lock-free path useplay_realtime/RealtimePluginRunner; even that isn't a fully RT-audited (zero-allocation) engine yet. - Process isolation is opt-in (
Vst3Host::builder().with_process_isolation(true)); crashes surface asError::PluginCrashedandPlugin::recover()reloads, but there is no GUI-across-the-boundary yet. MidiEvent::ProgramChangeis unsupported (VST3 routes programs throughIUnitInfo).- Windows/Linux build and test in CI but aren't interactively exercised (no plugin run or editor opened) — macOS is the exercised platform.
Building from source
No VST3 SDK or extra setup is required. The vst3 dependency (0.3) ships pre-generated
bindings, so building is just:
The only build-time native dependency is libclang, used by cpal's coreaudio-sys
(macOS) and alsa-sys (Linux); on Linux you also need the ALSA and libxcb dev headers
(libasound2-dev, libxcb1-dev, libxcb-util-dev).
Documentation
Full guides (tutorials, how-to, reference, explanation) are in the
docs/ directory of the
repository. API reference is on docs.rs.
License
MIT — see LICENSE.