synthie
A Rust synthesizer engine library with polyphonic voices, ADSR envelopes, state-variable filters, LFO modulation, and reverb.
Features
- Polyphonic voice engine with configurable channel count
- Five waveforms: Pulse, Sawtooth, Triangle, Noise, Pulse+Saw
- ADSR amplitude envelope with optional reverse (swell/duck) mode
- State-variable filter - Low-pass, Band-pass, and High-pass with cutoff, resonance, and drive
- LFO targeting pitch, pulse width, filter cutoff, or volume
- Reverb FX with room size and damping controls
- Multi-timbral channels via
ChannelNonewtypes - Drum machine beside the voice pools: kick, snare, hi-hats, crash, toms and clap
- Sample-accurate sequencing on any host via
SequencerandSequencedProcessor - Serde support via the
serdefeature (enabled by default)
Quick Start
use setup_audio;
use ;
See examples/ for full usage.
Bring Your Own Audio Backend
SynthProcessor has no I/O and renders into any interleaved f32 buffer, so
it can run inside kira, a game engine's stream, or an AudioWorklet. Pair it
with a Sequencer for events that land on the exact frame, whatever buffer
size the backend uses:
use *;
;
let mut synth = new;
let mut buf = vec!; // stereo, interleaved
synth.process_block; // call from the audio callback
Already using kira? Enable the kira feature
and play the synth as a kira sound instead, mixed, faded and paused like any
other:
use SynthSoundData;
use SongPlayer;
let mut synth = manager.play?;
synth.drum?;
synth.set_volume;
Game Music
synthie::pattern plays tracker-style songs written in a compact notation,
sample-accurately through the same Sequencer trait:
use ChannelNo;
use ;
// One row per eighth note at 152 bpm.
let song = new
.lane?
.lane?
.lane?;
let player = new; // hand to any host as a Sequencer
Chord cells play several notes from one lane on the lane's channel, e.g. a
power chord as E2+B2+E3, or as semitone offsets from the root, E2^07c!.
See the synthie::pattern docs for the full notation (notes, chords, holds,
note-offs, drum hits, chip arpeggios, patch changes).
Feature Flags
| Feature | Default | Description |
|---|---|---|
serde |
enabled | Serialize/Deserialize on all parameter types |
io |
enabled | cpal output stream (audio::engine) |
arp |
enabled | Built-in arpeggiator, and arpeggio cells in patterns |
kira |
disabled | Play the synth as a kira sound (synthie::kira); independent of io |
Terminal UI
The synth-tui crate provides a full ratatui-based terminal UI. See the repository root for screenshots.