rack 0.1.0

A modern Rust library for hosting audio plugins
Documentation

Rack

A modern Rust library for hosting audio plugins

Crates.io Documentation License

Rack is a cross-platform library for discovering, loading, and processing audio through VST3, AudioUnit, CLAP, and other plugin formats in Rust applications.

Features

  • 🎵 AudioUnit support (macOS) - built-in
  • 🔌 VST3 support - coming soon
  • 🎛️ CLAP support - coming soon
  • 🎚️ Clean, safe API - no unsafe code in your application
  • 🔄 cpal integration - optional audio I/O helpers
  • 🚀 Zero-cost abstractions - trait-based design

Quick Start

Add to your Cargo.toml:

[dependencies]
rack = "0.1"

List available plugins

use rack::prelude::*;

fn main() -> Result<()> {
    let scanner = Scanner::new();
    let plugins = scanner.scan()?;
    
    for plugin in plugins {
        println!("{}", plugin);
    }
    
    Ok(())
}

Load and process audio

use rack::prelude::*;

fn main() -> Result<()> {
    let scanner = Scanner::new();
    let plugins = scanner.scan()?;
    
    // Load first plugin
    let mut plugin = scanner.load(&plugins[0])?;
    plugin.initialize(48000.0, 512)?;
    
    // Process audio
    let input = vec![0.0; 512];
    let mut output = vec![0.0; 512];
    plugin.process(&input, &mut output)?;
    
    Ok(())
}

With cpal for audio I/O

Enable the cpal feature:

[dependencies]
rack = { version = "0.1", features = ["cpal"] }
cpal = "0.15"

See examples/simple_host.rs for a complete example.

Platform Support

Platform AudioUnit VST3 CLAP LV2
macOS 🚧 🚧
Windows 🚧 🚧
Linux 🚧 🚧 🚧
  • ✅ Supported
  • 🚧 Planned
  • ❌ Not applicable

Examples

Run the examples:

# List all available plugins
cargo run --example list_plugins

# Simple host with audio playback (requires cpal feature)
cargo run --example simple_host --features cpal

Architecture

Rack uses a trait-based design for maximum flexibility:

pub trait PluginScanner {
    type Plugin: PluginInstance;
    fn scan(&self) -> Result<Vec<PluginInfo>>;
    fn load(&self, info: &PluginInfo) -> Result<Self::Plugin>;
}

pub trait PluginInstance: Send {
    fn initialize(&mut self, sample_rate: f64, max_block_size: usize) -> Result<()>;
    fn process(&mut self, input: &[f32], output: &mut [f32]) -> Result<()>;
    fn get_parameter(&self, index: usize) -> Result<f32>;
    fn set_parameter(&mut self, index: usize, value: f32) -> Result<()>;
    // ... more methods
}

This allows different plugin formats to implement the same interface, making your code portable across formats.

Roadmap

  • AudioUnit scanning (macOS)
  • AudioUnit loading and instantiation
  • AudioUnit audio processing
  • AudioUnit parameter handling
  • VST3 support (cross-platform)
  • CLAP support (cross-platform)
  • LV2 support (Linux)
  • GUI hosting
  • Preset management
  • MIDI support

Contributing

Contributions are welcome! This is an early-stage project and there's lots to do.

Areas where help is needed:

  • AudioUnit implementation (FFI work)
  • VST3 backend
  • CLAP backend
  • Documentation
  • Examples
  • Testing

License

Licensed under either of:

at your option.

Acknowledgments

Why "Rack"?

The name is inspired by modular synthesizer racks and VCV Rack - the idea of a framework where you can plug in different modules (plugins) and wire them together. Plus, it was available on crates.io! 🎉