uuun is a small Moog-style subtractive synth controlled by MIDI with four MIDI channels with eight voices each. It's a learning project.
You need Rust, a MIDI input, and an audio output device.
cargo run
cargo run -- 1The optional number selects a MIDI input port and available ports are printed at startup. MIDI channels 1-4 are accepted; the rest are ignored.
cargo run
Compiling uuun v0.3.0 (/Users/eiri/Code/github.com/eiri/uuun)
Finished `dev` profile [optimized + debuginfo] target(s) in 0.69s
Running `target/debug/uuun`
Available MIDI input ports:
[0] KeyStep Pro
[1] MiniFuse 4
Connecting to MIDI port [0]: KeyStep Pro
synthesizer running. Press Ctrl-C to quit.Tested on macOS with CoreAudio and CoreMIDI.
| CC | Control |
|---|---|
| 5 | Glide time |
| 64 | Sustain |
| 71, 74 | Filter resonance, cutoff |
| 72, 73, 75, 79 | Amp release, attack, decay, sustain |
| 76, 77 | LFO rate, depth |
| 85, 86 | Filter key tracking, envelope amount |
| 102-105 | Filter attack, decay, sustain, release |
| 106-109 | Oscillator 1-3 and noise levels |
| 120 | Stop sound immediately |
| 121 | Reset controllers |
| 123 | Release all notes |
Each channel has eight voices. Glide begins when a voice is reused; its first note starts immediately.
If notes get stuck, send CC 120 or restart the synth.
The synth uses the default output device. It asks for a 256-frame buffer and falls back to the device default. Signed, unsigned, and floating-point PCM formats are supported; DSD is not.
The binary and the callback benchmark use the uuun library in the same package. Synth handles events and renders mono audio without devices. AudioCallback drains the event queue and control mailboxes, then converts that audio for the device. CPAL and midir handle audio output and MIDI input.
Each channel owns its patch, pitch bend, and pressure. Voices borrow these values during each render call. Patch::startup() selects the startup sound. Patch::default() selects a distinct single-oscillator sound.
make test
make lint
make benchmark
make buildBased on gregory.