| Crates.io | rack |
| lib.rs | rack |
| version | 0.4.8 |
| created_at | 2025-10-22 08:31:46.117573+00 |
| updated_at | 2025-11-15 08:27:28.800833+00 |
| description | A modern Rust library for hosting audio plugins |
| homepage | |
| repository | https://github.com/sinkingsugar/rack |
| max_upload_size | |
| id | 1895317 |
| size | 502,035 |
A modern Rust library for hosting audio plugins
Status: AudioUnit support is production-ready on macOS (Phases 1-8 complete, thoroughly tested). VST3 support is working on macOS, untested on Windows/Linux (no CI yet). iOS and visionOS are supported but untested. The API is stabilizing. CLAP support is planned.
Rack is a cross-platform library for discovering, loading, and processing audio through VST3, AudioUnit, CLAP, and other plugin formats in Rust applications.
Add to your Cargo.toml:
[dependencies]
rack = "0.3"
use rack::prelude::*;
fn main() -> Result<()> {
let scanner = Scanner::new()?;
let plugins = scanner.scan()?;
for plugin in plugins {
println!("{}", plugin);
}
Ok(())
}
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 with planar buffers (zero-copy)
let left_in = vec![0.0f32; 512];
let right_in = vec![0.0f32; 512];
let mut left_out = vec![0.0f32; 512];
let mut right_out = vec![0.0f32; 512];
plugin.process(
&[&left_in, &right_in],
&mut [&mut left_out, &mut right_out],
512
)?;
Ok(())
}
See examples/simple_synth.rs for a complete MIDI synthesis example.
| Platform | AudioUnit | VST3 | CLAP | LV2 | Notes |
|---|---|---|---|---|---|
| macOS | โ | ๐งช | ๐ง | โ | AudioUnit production-ready, VST3 tested & working |
| iOS | ๐งช | โ | โ | โ | AudioUnit compiles, untested |
| visionOS | ๐งช | โ | โ | โ | AudioUnit compiles, untested |
| Windows | โ | ๐งช | ๐ง | โ | VST3 compiles, untested (no CI) |
| Linux | โ | ๐งช | ๐ง | ๐งช | VST3 compiles, untested (no CI) |
Platform-Specific Notes:
Run the examples:
# List all available plugins (AudioUnit on macOS, VST3 on Windows/Linux)
cargo run --example list_plugins
# List VST3 plugins specifically
cargo run --example list_vst3_plugins
# Process audio with VST3
cargo run --example vst3_processor
# Control parameters
cargo run --example control_parameters
# MIDI synthesis
cargo run --example simple_synth
# Browse and load presets
cargo run --example preset_browser
# Plugin GUI (AudioUnit on macOS - shows native plugin UI)
cargo run --example plugin_gui
# Real-time audio host with CPAL (requires 'cpal' feature)
cargo run --example cpal_host --features cpal
use rack::prelude::*;
fn main() -> Result<()> {
let scanner = Scanner::new()?;
let plugins = scanner.scan()?;
let mut plugin = scanner.load(&plugins[0])?;
plugin.initialize(48000.0, 512)?;
// Create GUI asynchronously
plugin.create_gui(|result| {
match result {
Ok(gui) => {
gui.show_window(Some("My Plugin"))?;
// GUI is now visible!
}
Err(e) => eprintln!("GUI creation failed: {}", e),
}
Ok(())
});
// Keep program running...
Ok(())
}
See examples/plugin_gui.rs for a complete GUI example.
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 reset(&mut self) -> Result<()>;
fn process(&mut self, inputs: &[&[f32]], outputs: &mut [&mut [f32]], num_frames: usize) -> 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.
Contributions are welcome!
Production-Ready:
Experimental (compiles, needs testing):
High Priority - Help Needed:
Lower Priority:
Licensed under either of:
at your option.
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! ๐