7 releases (4 breaking)

0.4.0 Mar 15, 2023
0.3.0 Feb 27, 2022
0.2.1 Nov 18, 2020
0.2.0 Nov 25, 2019
0.0.1 Jan 3, 2018

#83 in Audio

Download history 291/week @ 2024-02-26 324/week @ 2024-03-04 353/week @ 2024-03-11 379/week @ 2024-03-18 545/week @ 2024-03-25 434/week @ 2024-04-01 302/week @ 2024-04-08 338/week @ 2024-04-15 435/week @ 2024-04-22 356/week @ 2024-04-29 336/week @ 2024-05-06 381/week @ 2024-05-13 315/week @ 2024-05-20 385/week @ 2024-05-27 336/week @ 2024-06-03 327/week @ 2024-06-10

1,417 downloads per month
Used in 92 crates (13 directly)

MIT license

180KB
3K SLoC

vst-rs

crates.io dependency status Discord Chat Discourse topics

Notice: vst-rs is deprecated.

This crate is no longer actively developed or maintained. VST 2 has been officially discontinued and it is no longer possible to acquire a license to distribute VST 2 products. It is highly recommended that you make use of other libraries for developing audio plugins and plugin hosts in Rust.

If you're looking for a high-level, multi-format framework for developing plugins in Rust, consider using NIH-plug or baseplug. If you're looking for bindings to specific plugin APIs, consider using vst3-sys, clap-sys, lv2(-sys), or auv2-sys. If, despite the above warnings, you still have a need to use the VST 2 API from Rust, consider using vst2-sys or generating bindings from the original VST 2 SDK using bindgen.

vst-rs is a library for creating VST2 plugins in the Rust programming language.

This library is a work in progress, and as such it does not yet implement all functionality. It can create basic VST plugins without an editor interface.

Note: If you are upgrading from a version prior to 0.2.0, you will need to update your plugin code to be compatible with the new, thread-safe plugin API. See the transfer_and_smooth example for a guide on how to port your plugin.

Library Documentation

Documentation for released versions can be found here.

Development documentation (current master branch) can be found here.

Crate

This crate is available on crates.io. If you prefer the bleeding-edge, you can also include the crate directly from the official Github repository.

# get from crates.io.
vst = "0.3"
# get directly from Github.  This might be unstable!
vst = { git = "https://github.com/rustaudio/vst-rs" }

Usage

To create a plugin, simply create a type which implements the Plugin trait. Then call the plugin_main macro, which will export the necessary functions and handle dealing with the rest of the API.

Example Plugin

A simple plugin that bears no functionality. The provided Cargo.toml has a crate-type directive which builds a dynamic library, usable by any VST host.

src/lib.rs

#[macro_use]
extern crate vst;

use vst::prelude::*;

struct BasicPlugin;

impl Plugin for BasicPlugin {
    fn new(_host: HostCallback) -> Self {
        BasicPlugin
    }

    fn get_info(&self) -> Info {
        Info {
            name: "Basic Plugin".to_string(),
            unique_id: 1357, // Used by hosts to differentiate between plugins.
            ..Default::default()
        }
    }
}

plugin_main!(BasicPlugin); // Important!

Cargo.toml

[package]
name = "basic_vst"
version = "0.0.1"
authors = ["Author <author@example.com>"]

[dependencies]
vst = { git = "https://github.com/rustaudio/vst-rs" }

[lib]
name = "basicvst"
crate-type = ["cdylib"]

Packaging on OS X

On OS X VST plugins are packaged inside loadable bundles. To package your VST as a loadable bundle you may use the osx_vst_bundler.sh script this library provides. 

Example: 

./osx_vst_bundler.sh Plugin target/release/plugin.dylib
Creates a Plugin.vst bundle

Special Thanks

Marko Mijalkovic for initiating this project

Dependencies

~1.5–2.1MB
~45K SLoC