
Cantrips
Built-in mixer DSP: sampler, fader, pan, meters, compressor.
Cantrips is the component that provides the small set of processors every mixer needs. It is part of Signals & Sorcery, a coherent set of Rust audio building blocks for audio apps, plugins, players and DAWs.
| Repository | github.com/shiehn/cantrips-audio-dsp |
|---|---|
| License | MIT, free for commercial and closed-source use |
| Status | Planned |
| Layer | Sound and devices (how the layers stack) |
| Crates (planned names) | cantrips |
What it is
A DAW doesn't need a huge DSP library to work. It needs a handful of units that are correct, cheap, click-free and predictable, on every track. Cantrips is that handful:
- Sampler voice: plays a region of a sample with start offset, fades, looping and pitch, at sample-accurate positions.
- Clip player: plays an audio clip with fades and a short ramp on mute and stop, so nothing clicks.
- Fader: gain in decibels with smoothing, so automation never zippers.
- Pan: a documented constant-power pan law for mono and stereo sources.
- VCA and sum: gain groups and bus summing.
- Meter: peak and RMS with defined ballistics, feeding Aethergate's shared-memory meters.
- Latency: a delay line used by delay compensation.
- Compressor: a simple, transparent channel compressor with threshold, ratio, attack, release, knee and makeup.
Each unit is a plain Rust type with prepare, process and parameter methods, and each can also be a node in Leyline's graph.
Usage example
Illustrative sketch
Planned, not final. Taken from the README.
use cantrips::{Fader, Pan, PanLaw, Compressor};
let mut fader = Fader::new(48_000.0).smoothing_ms(10.0);
let mut pan = Pan::new(PanLaw::ConstantPower);
let mut comp = Compressor::new(48_000.0);
comp.set_threshold_db(-18.0);
comp.set_ratio(3.0);
// On the audio thread, per block:
fader.set_gain_db(-6.0); // smoothed over the next few milliseconds
comp.process(&mut left, &mut right);
fader.process(&mut left, &mut right);
pan.process(0.25, &mut left, &mut right);
Used standalone, these are functions on buffers. Used through Leyline, they are built-in nodes the graph compiler places for you.
How it fits in the ecosystem
Cantrips is in the sound and devices row. Dependencies point down, never up.
Below it: only Runecraft (repo), whose floating-point scopes keep denormals from costing a spike. The sampler and clip player read plain sample buffers, so they work with audio from Scriptorium (repo) or anywhere else without depending on it.
Above it:
- Leyline (repo) uses these units as its built-in nodes.
- Grimoire (repo) assembles mixer channels from them.
What it deliberately doesn't do: no synths, effects suites or creative DSP (that is what plugins through Summoner, and crates such as fundsp, are for), no time-stretch or pitch-shift engine, and no routing (where a signal goes is the graph's decision).
| Component | Repository | Role | Status |
|---|---|---|---|
| Runecraft | runecraft-audio-core | Shared contracts, realtime safety, process isolation and realtime-safe logging: the floor every other component stands on | In preparation |
| Orrery | orrery-musical-time | Tempo and meter, transports, bar, beat and sample maths, timed MIDI | In preparation |
| Summoner | summoner-plugin-host | Out-of-process VST3 and Audio Unit plugin hosting with crash isolation | In preparation |
| Aethergate | aethergate-audio-platform | Audio devices (cpal, CoreAudio, a fake device for tests) and shared-memory meters | Planned |
| Leyline | leyline-audio-graph | A realtime audio graph with delay compensation, and a compiler from an edit model to a graph | Planned |
| Cantrips | cantrips-audio-dsp | Built-in mixer DSP: sampler, fader, pan, meters, compressor | Planned |
| Scriptorium | scriptorium-audio-media | Decode and encode, a sample store, streaming voices, crash-safe recording | Planned |
| Tapestry | tapestry-session-model | Tracks, clips, lanes and scenes; edits with undo; a crash-safe project store | Planned |
| Procession | procession-timeline-engine | What plays in each block: regions, notes, automation, launches | Planned |
| Grimoire | grimoire-daw-engine | The assembled engine and its headless JSON-RPC protocol | Planned |
| Familiar | familiar-plugin-sdk | An SDK for plugins and panels that extend a Signals & Sorcery engine | Planned |
| Glyphwork | glyphwork-audio-ui | Audio UI widgets: meters, knobs, faders, waveforms | Planned |
Status
Planned. No code yet. The repository holds the design.
Pure Rust: macOS, Windows and Linux. A WebAssembly build for Web Audio worklets is a later exploration that fits this crate well. Each unit has a short written spec that its tests check, and gives the same output bit for bit, live or offline.
Links
- Repository: github.com/shiehn/cantrips-audio-dsp (README, LICENSE)
- Depends on: runecraft-audio-core
- Used by: leyline-audio-graph, grimoire-daw-engine
- All twelve components · For agents · llms.txt