Rust中的跨平台音频和MIDI插件开发框架
Build audio plugins in Rust. VST3, CLAP, AU v2, AU v3 (macOS + iOS), AAX (Pro Tools), and standalone from a single Rust codebase. Dead simple developer experience: in 5 minutes, you can load your own plugin in a DAW and test your custom DSP, MIDI, and GUI.
# Install the CLI (one-time)
cargo install cargo-truce
# Scaffold a new plugin
cargo truce new my-plugin
cd my-plugin
# Run the plugin standalone — no DAW needed
cargo truce run
# Build and install
cargo truce install --clap
cargo truce install --vst3
# Open your DAW, scan for plugins, load "MyPlugin"Every
cargo trucecommand builds in release mode by default; pass--debugfor fast-compile iteration.
Other formats:
cargo truce install # formats in your plugin's default features
cargo truce install --vst3 # VST3
cargo truce install --au3 # AU v3 (macOS, requires Xcode)
cargo truce install --ios # AU v3 on the booted iOS Simulator
cargo truce install --ios-device # AU v3 on a tethered iPhone / iPad
cargo truce install --aax # AAX (requires AAX SDK)
cargo truce install --vst2 # VST2
cargo truce install --lv2 # LV2
cargo truce validate # auval + pluginval + clap-validator on installed pluginsBuild without installing:
…Scaffolded plugins default to CLAP + VST3 + standalone. VST2, AU, and AAX are
opt-in per plugin via Cargo.toml features. On Windows, cargo truce install must be run from an Administrator command prompt (plugin
directories are system-wide).
Drop a presets/ directory of .preset TOML files next to your crate and
cargo truce install ships them to every format's native preset system —
CLAP preset-discovery, the AU factory list in Logic, .vstpreset, LV2
pset:Preset. cargo truce preset is the authoring toolbox on top:
cargo truce preset list # every preset across factory / user / pack scopes
cargo truce preset pull # harvest presets you saved in your DAW into the library
cargo truce preset convert in.aupreset out.vstpreset # re-envelope between any two formats
cargo truce preset init # stamp uuids into hand-authored .preset filesYour DAW's own "Save Preset" is the authoring frontend: dial in a sound,
save it in the host, then pull converts it into a .preset — uuid-stable,
so re-pulling the same name updates in place instead of duplicating. The
standalone host (cargo truce run) also has a native Presets menu for
browsing and saving. Full reference at
truce.audio/docs/guide/presets.
A suite of example plugins ship in-tree to cover the basics — gain, EQ, synth, transpose, arpeggio, tremolo, plus four gain variants showing the egui / iced / Slint / Vizia backends. See truce.audio/docs/examples for the full table with screenshots.
reiss-mcpherson-effects, a companion repo porting the audio-effect implementations from Reiss & McPherson's Audio Effects: Theory, Implementation and Application to truce.
truce-analyzer, a real-time spectrum analyzer with diff overlay for debugging/reverse-engineering plugins.
…Switch the import to
truce::prelude64::*to writef64DSP instead —param.read()returnsf64, the audio buffer isf64, and the format wrapper widens/narrows at the block boundary. Sameimpl PluginLogicheader on both precisions.
By platform:
| Format | macOS | Windows | Linux | iOS |
|---|---|---|---|---|
| CLAP | Yes | Yes | Yes | — |
| VST3 | Yes | Yes | Yes | — |
| VST2 | Yes | Yes | Yes | — |
| LV2 | Yes | Yes | Yes | — |
| AU v2 | Yes | — | — | — |
| AU v3 | Yes | — | — | Yes |
| AAX | Yes | Yes | — | — |
AU is Apple-only by design — v2 is the legacy macOS-only component,
v3 ships on both macOS (.appex extension) and iOS (.appex inside
a container .app for AUM, GarageBand, Logic Pro for iPad, Cubasis,
BeatMaker 3, Loopy Pro). LV2 is the native Linux format and also
builds on macOS and Windows — supports audio, MIDI, state, and UI
(X11UI on Linux, CocoaUI on macOS, WindowsUI on Windows). AAX
requires the Avid AAX SDK and PACE/iLok signing for retail Pro Tools
releases. VST2 is opt-in on all platforms. iOS only hosts AU v3 by
platform contract; every other format is unviable there.
prelude64; the host's native 64-bit audio wire is taken directly on VST3, VST2, and CLAP, widen/narrow elsewherecargo truce preset converts between formats and pulls presets saved in your DAW back into the library.resizable(true).min_size(_).max_size(_) on any backend, round-tripped through CLAP gui_set_size, VST3 IPlugView::onSize, AU view-frame change, and LV2 ui:resize#[derive(Params)] + #[param(...)] with linear/log/skewed/reversed ranges, linear/exp/log smoothing, units, and sample-accurate automation by defaultBackgroundTask; each task type picks concurrent or serialized (one-slot) execution. AudioTap streams samples off the audio thread for analyzers and meters, drop-on-full so a stall never desyncs channelstruce::plugin! — one macro generates all format exports + GUI + state serializationcargo truce — scaffold, build, install, validate, and package; doctor reports environment health, and package produces signed distributable installers (.pkg with notarization on macOS; Inno Setup .exe with Authenticode on Windows)process(), and the audio thread never waits on another thread. Every path across the boundary is lock-free: params use atomic storage, meters ride wait-free atomic slots, state loads arrive on an SPSC queue drained between blocks, and a host state save reads a snapshot the audio thread publishes each block, so saving never touches the running pluginmigrate_state hook accepts pre-truce or other-framework state blobs, so a ported plugin keeps loading its old sessions and presetscargo truce validate runs auval, pluginval, and clap-validator in one commandFull docs live at truce.audio — install guide, first-plugin walkthrough, params / processing / GUI / audio testing / presets / shipping / hot-reload reference, per-format gotchas (CLAP, VST3, VST2, LV2, AU, AAX), and current status.
rustup update).xcode-select --install). Full Xcode for AU v3 + iOS.x86_64-pc-windows-msvc
toolchain is required.xcrun simctl boot ...)
for --ios, or a paired & trusted device + Apple Developer team ID
and .mobileprovision for --ios-device.truce drew inspiration from nih-plug by Robbert van der Helm — the trailblazing Rust audio plugin framework whose API design, thread-safe parameter model, and overall shape informed countless decisions here.
truce is licensed under The Truce License, Version 1.0
(LICENSE, SPDX LicenseRef-TruceLicense-1.0), a dual
Apache-2.0 / MIT permissive grant
with one narrow rider.
For plug-in authors it is effectively just MIT / Apache-2.0. Build, ship, and sell plug-ins, plug-in suites, and internal SDKs under either license - no fees, no splash screen, no revenue cap, no email needed. Most users never need to read past this paragraph.
Contributions are inbound = outbound under the Truce License unless you explicitly state otherwise.
You need a Framework License, granted by permission, only to redistribute truce as a commercial framework to other developers, or to run it as a commercial service that provides its framework capabilities to other developers - anything sold, subscription-gated, dual-licensed commercially, or bundled into a paid offering. Free, OSI-licensed framework projects on top of truce are exempt. Plug-in authors and internal-SDK use are unaffected.
See LICENSE Section 2 for the precise boundary, the
exemption criteria, and the request procedure.
Built a plugin with truce? You are welcome to add a "Built with Truce" badge to your project's README or site. It is optional - nothing requires it - but it helps others find the framework, and we appreciate it. Grab light, stacked, and mini variants plus copy-paste snippets at truce.audio/docs/reference/badges.
暂无开放 Issues,或尚未同步最近议题。