- Notifications
You must be signed in to change notification settings - Fork171
Rust VST3 and CLAP plugin framework and plugins - because everything is better when you do it yourself
License
robbert-vdh/nih-plug
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NIH-plug is an API-agnostic audio plugin framework written in Rust, as well as asmall collection of plugins. The idea is to have a stateful yet simple pluginAPI that gets rid of as much unnecessary ceremony wherever possible, while alsokeeping the amount of magic to minimum and making it easy to experiment withdifferent approaches to things. See thecurrent featuressection for more information on the project's current status.
Check out thedocumentation, or usethecookiecutter template toquickly get started with NIH-plug.
Check each plugin's readme file for more details on what the plugin actuallydoes. You can download the development binaries for Linux, Windows and macOSfrom theautomatedbuildspage. Or if you're not signed in on GitHub, then you can also find the latestnightly buildhere. Youmay need todisable Gatekeeper on macOS to be able to usethe plugins.
Scroll down for more information on the underlying plugin framework.
- Buffr Glitch is the plugin for you if you enjoythe sound of a CD player skipping This plugin is essentially a MIDI triggeredbuffer repeat plugin. When you play a note, the plugin will sample the periodcorresponding to that note's frequency and use that as a single waveformcycle. This can end up sounding like an in-tune glitch when used sparingly, orlike a weird synthesizer when used less subtly.
- Crisp adds a bright crispy top end to any low bass sound.Inspired by Polarity'sFake Distortion video.
- Crossover is as boring as it sounds. It cleanlysplits the signal into two to five bands using a variety of algorithms. Thosebands are then sent to auxiliary outputs so they can be accessed and processedindividually. Meant as an alternative to Bitwig's Multiband FX devices butwith cleaner crossovers and a linear-phase option.
- Diopser is a totally original phase rotation plugin.Useful for oomphing up kickdrums and basses, transforming synths into theirevil phase-y cousin, and making everything sound like a cheap Sci-Fi laserbeam.
- Loudness War Winner does what it says onthe tin. Have you ever wanted to show off your dominance by winning theloudness war? Neither have I. Dissatisfaction guaranteed.
- Puberty Simulator is that patent pending OneWeird Plugin that simulates the male voice change during puberty! If it wasnot already obvious from that sentence, this plugin is a joke, but it mightactually be useful (or at least interesting) in some situations. This pluginpitches the signal down an octave, but it also has the side effect of causingthings to sound like a cracking voice or to make them sound slightly out oftune.
- Safety Limiter is a simple tool to prevent eardamage. As soon as there is a peak above 0 dBFS or the specified threshold,the plugin will cut over to playing SOS in Morse code, gradually fading outagain when the input returns back to safe levels. Made for personal use duringplugin development and intense sound design sessions, but maybe you'll find ituseful too!
- Soft Vacuum is a straightforward port ofAirwindows'Hard Vacuum pluginwith parameter smoothing and up to 16x linear-phase oversampling, because Iliked the distortion and just wished it had oversampling. All credit goes toChris from Airwindows. I just wanted to share this in case anyone else findsit useful.
- Spectral Compressor can squash anythinginto pink noise, apply simultaneous upwards and downwards compressor todynamically match the sidechain signal's spectrum and morph one sound intoanother, and lots more. Have you ever wondered what a 16384 band OTT wouldsound like? Neither have I.
- Supports both VST3 andCLAP by simplyadding the corresponding
nih_export_<api>!(Foo)
macro to your plugin'slibrary. - Standalone binaries can be made by calling
nih_export_standalone(Foo)
fromyourmain()
function. Standalones come with a CLI for configuration and fullJACK audio, MIDI, and transport support. - Rich declarative parameter system without any boilerplate.
- Define parameters for your plugin by adding
FloatParam
,IntParam
,BoolParam
, andEnumParam<T>
fields to your parameter struct, assignstable IDs to them with the#[id = "foobar"]
, and a#[derive(Params)]
does all of the boring work for you. - Parameters can have complex value distributions and the parameter objectscome with built-in smoothers and callbacks.
- Use simple enums deriving the
Enum
trait with theEnumParam<T>
parametertype for parameters that allow the user to choose between multiple discreteoptions. That way you can use regular Rust pattern matching when workingwith these values without having to do any conversions yourself. - Store additional non-parameter state for your plugin by adding any fieldthat can be serialized withSerde to your plugin's
Params
object and annotating them with#[persist = "key"]
. - Optional support for state migrations, for handling breaking changes inplugin parameters.
- Group your parameters into logical groups by nesting
Params
objects usingthe#[nested(group = "...")]
attribute. - The
#[nested]
attribute also enables you to use multiple copies of thesame parameter, either as regular object fields or through arrays. - When needed, you can also provide your own implementation for the
Params
trait to enable compile time generated parameters and other bespokefunctionality.
- Define parameters for your plugin by adding
- Stateful. Behaves mostly like JUCE, just without all of the boilerplate.
- Comes with a simple yet powerful way to asynchronously run background tasksfrom a plugin that's both type-safe and realtime-safe.
- Does not make any assumptions on how you want to process audio, but does comewith utilities and adapters to help with common access patterns.
- Efficiently iterate over an audio buffer either per-sample per-channel,per-block per-channel, or even per-block per-sample-per-channel with theoption to manually index the buffer or get access to a channel slice at anytime.
- Easily leverage per-channel SIMD using the SIMD adapters on the buffer andblock iterators.
- Comes with bring-your-own-FFT adapters for common (inverse) short-timeFourier Transform operations. More to come.
- Optional sample accurate automation support for VST3 and CLAP that can beenabled by setting the
Plugin::SAMPLE_ACCURATE_AUTOMATION
constant totrue
. - Optional support for compressing the human readable JSON state files usingZstandard.
- Comes with adapters for popular Rust GUI frameworks as well as some basicwidgets for them that integrate with NIH-plug's parameter system. Currentlythere's support foregui,iced andVIZIA.
- A simple and safe API for state saving and restoring from the editor isprovided by the framework if you want to do your own internal presetmanagement.
- Full support for receiving and outputting both modern polyphonic noteexpression events as well as MIDI CCs, channel pressure, and pitch bend forCLAP and VST3.
- MIDI SysEx is also supported. Plugins can define their own structs or sumtypes to wrap around those messages so they don't need to interact with rawbyte buffers in the process function.
- Support for flexible dynamic buffer configurations, including variable numbersof input and output ports.
- First-class support several more exotic CLAP features:
- Both monophonic and polyphonic parameter modulation are supported.
- Plugins can declaratively define pages of remote controls that DAWs can bindto hardware controllers.
- A plugin bundler accessible through the
cargo xtask bundle <package> <build_arguments>
command that automaticallydetects which plugin targets your plugin exposes and creates the correctplugin bundles for your target operating system and architecture, withcross-compilation support. The cargo subcommand can easily be added toyourown projectas an alias orgloballyas a regular cargo subcommand. - Tested on Linux and Windows, with limited testing on macOS. Windows supporthas mostly been tested through Wine withyabridge.
- See the
Plugin
trait's documentation for an incomplete listof the functionality that has currently not yet been implemented.
NIH-plug works with the latest stable Rust compiler.
After installingRust, you can compile any of the pluginsin theplugins
directory in the following way, replacinggain
with the nameof the plugin:
cargo xtask bundle gain --release
NIH-plug can currently export VST3 andCLAP plugins. Exporting a specific pluginformat for a plugin is as simple as calling thenih_export_<format>!(Foo);
macro. Thecargo xtask bundle
command will detect which plugin formats yourplugin supports and create the appropriate bundles accordingly, even when crosscompiling.
The best way to get an idea for what the API looks like is to look at theexamples.
- gain is a simple smoothed gain plugin that showsoff a couple other parts of the API, like support for storing arbitraryserializable state.
- gain-gui is the same plugin as gain, but with a GUI to control theparameter and a digital peak meter. Comes in three exciting flavors:egui,iced, andVIZIA.
- midi_inverter takes note/MIDI events andflips around the note, channel, expression, pressure, and CC values. Thisexample demonstrates how to receive and output those events.
- poly_mod_synth is a simple polyphonicsynthesizer with support for polyphonic modulation in supported CLAP hosts.This demonstrates how polyphonic modulation can be used in NIH-plug.
- sine is a simple test tone generator plugin withfrequency smoothing that can also make use of MIDI input instead of generatinga static signal based on the plugin's parameters.
- stft shows off some of NIH-plug's other optionalhigher level helper features, such as an adapter to process audio with ashort-term Fourier transform using the overlap-add method, all using thecompositional
Buffer
interfaces. - sysex is a simple example of how to send andreceive SysEx messages by defining custom message types.
The framework, its libraries, and the example plugins inplugins/examples/
areall licensed under theISC license. However,theVST3 bindings used bynih_export_vst3!()
are licensed under the GPLv3 license. This means thatunless you replace these bindings with your own bindings made from scratch, anyVST3 plugins built with NIH-plug need to be able to comply with the terms of theGPLv3 license.
The other plugins in theplugins/
directory may be licensed under the GPLv3license. Check the plugin'sCargo.toml
file for more information.
About
Rust VST3 and CLAP plugin framework and plugins - because everything is better when you do it yourself