The example ladder
Ten small plugins in the examples/ folder. Each is a complete plugin that builds into every
format, has a test that renders audio without a sound card and fails if process allocates
memory, and adds one idea to the one before. Read them in order.
| # | Example | Teaches |
|---|---|---|
| 01 | sine | the Plugin trait, export_plugin!, a note in and a sine out, events at their sample, one parameter |
| 02 | gain | an effect: audio in and out, a parameter, Smoother, decibels |
| 03 | params | every parameter kind, curves, units, groups; never rename a key, only append |
| 04 | envelope | Adsr, velocity, polyphony, voice stealing |
| 05 | modulation | an LFO, mod wheel, pitch bend, modulating without touching the parameter |
| 06 | filter | the state-variable filter, cutoff smoothing, denormals |
| 07 | gui | data-param bindings, a meter from process to the page, apf.poller, resizing |
| 08 | presets-and-state | factory and user presets, metadata, a Controller for non-parameter state |
| 09 | midi-and-learn | sustain pedal, MIDI learn, remote controls, host automation |
| 10 | synth | a compact complete synth that uses all of the above, and a look at the full demo synth |
Working with an example
cargo test -p example-01-sine # plays a note in memory
cargo xtask bundle example-01-sine --install # builds it and installs it for your host
Open the example’s src/lib.rs, change something, and run its test. The “Try it” list at the
end of each chapter has ideas. To hear a change in your host without restarting it, use
hot reload.
Each example’s tests/process.rs shows how the plugin is tested through the same interface a
host uses.