Skip to content

Repository files navigation

vst3-host

Crates.io Docs.rs CI License

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.

use vst3_host::{simple, midi::MidiChannel};

fn main() -> vst3_host::Result<()> {
    // Load a synth and start it playing through the default audio device.
    let plugin = simple::load_plugin("/Library/Audio/Plug-Ins/VST3/Dexed.vst3")?;
    let audio = simple::play(plugin)?;

    // Play middle C (MIDI note 60) for one second.
    audio.lock().send_midi_note(60, 100, MidiChannel::Ch1)?;
    std::thread::sleep(std::time::Duration::from_secs(1));
    Ok(())
}

What it does

  • Discovery — find installed VST3 plugins and read their metadata.
  • Audio — a bundled CPAL backend drives a plugin to your speakers; or plug in your own backend. Host effects on live audio input, or render offline to a WAV file.
  • Parameters — list, read, set, and format parameters as the plugin itself displays them, with sample-accurate automation (set_parameter_at).
  • MIDI — notes, control changes, pitch bend, and aftertouch, with sample-accurate scheduling; per-note expression / MPE (note_on / send_note_expression).
  • State & presets — save/restore a plugin's own state, and read/write .vstpreset files.
  • Metering — peak/RMS levels with ready-made UI ballistics (PeakMeter, RmsWindow).
  • Crash isolation — run a plugin in a separate process so a crash can't take down your app; crashes surface as Error::PluginCrashed and Plugin::recover() reloads it.
  • Native plugin editors — open a plugin's own GUI in a standalone window, or embed it in your egui app (EmbeddedEditor, macOS).

All VST3 COM interaction is contained behind a safe API. The public surface has no unsafe.

Status

The core is working and exercised against real plugins on macOS. Known limitations — see Platform support and each guide: the default audio path is correctness-first (a lock-free play_realtime path also exists, though neither is a fully RT-audited engine yet), process isolation is opt-in, and editor embedding into egui (EmbeddedEditor) works on macOS — the Windows/Linux window code compiles but isn't yet runtime-verified.

Install

[dependencies]
vst3-host = "0.4"

No VST3 SDK or extra setup is required — the vst3 dependency ships pre-generated bindings. Building from source is just:

git clone https://github.com/HelgeSverre/rust-vst3-host.git
cd rust-vst3-host
cargo build --release

(libclang must be installed for cpal's bindgen-based audio deps on macOS/Linux.)

Documentation

Start with the documentation index. It's organized by what you're doing:

Workspace layout

  • vst3-host/ — the library.
  • vst3-inspector/ — a GUI app (egui) built entirely on the library's public API; a worked example of consuming it.

Common tasks are wrapped in a justfile: just build, just test, just play, just lint.

License

MIT — see LICENSE.

About

A safe Rust library for hosting VST3 plugins — discover, load, play audio, automate parameters, send/receive MIDI, and isolate plugin crashes, with zero unsafe in the public API.

Topics

Resources

Stars

29 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages