SEVEN HARMONY MODES
PassThrough. Diatonic Thirds. Diatonic Fourths. Random Below. Random Below (No 2nds). Contrary Motion. Strict Counterpoint. Each is a file in src/harmony/modes.rs — two are stateful, five are pure.
let harmony = Engine.new(Palestrina); fn detect_pitch(buf) -> Note
const MAX_VOICES: usize = 4;
voice_leading.reject_parallels() struct GuitarInput { onset }
engine.harmonize(note, scale) fn detect_pitch( buf: &[f32] ) -> Option<Note>
let voices =
counterpoint::
generate(line, mode); if interval == Fifth
&& motion == Parallel
{ reject() } #[inline(always)] fn onset( frame: &Frame ) -> bool
block_size: 128 sample_rate: 48_000 latency_ms: 7.2
// Palestrina // counterpoint // rules.rs
Native. Offline. Sub-10ms pluck-to-note on M-series Macs. MIT-licensed. Your audio never leaves your machine.
Same Rust core compiled to WebAssembly. No install, no signup. Grant mic access, plug in MIDI, play.
Native CoreAudio pipeline, ~40% lower latency than browser. Apple Silicon, ~18 MB, MIT.
Pre-built binaries only for Mac today. Windows / Linux: clone the repo and cargo tauri dev. It takes 90 seconds.
PassThrough. Diatonic Thirds. Diatonic Fourths. Random Below. Random Below (No 2nds). Contrary Motion. Strict Counterpoint. Each is a file in src/harmony/modes.rs — two are stateful, five are pure.
Ten families: diatonic, harmonic minor, melodic minor, harmonic major, double harmonic, pentatonic, blues/bebop, symmetric, world, Barry Harris. Modal interchange with a tunable borrowing range.
McLeod + single-cycle pitch detection on 128-sample buffers (~2.7ms). Onset detection, pitch voting, auto-calibration, string/fret ID. Sub-10ms pluck-to-note on M-series Macs.
Cartesian-product placements across Soprano / Alto / Tenor / Bass registers. Rejects parallel 5ths and 8ves, prevents voice crossings, scores spacing, common tones, contrary motion.
Timing jitter, velocity variation, swing on offbeats, duration extension. BeatClock tracks tempo and time signature. Per-note records match Note-Off to Note-On.
A full CLAP plugin host via clack-host. Route harmony straight into your favorite instrument inside Contrapunk — no DAW required. macOS, Windows, Linux.
Same Rust core compiled to WebAssembly at app.contrapunk.com. No install, no signup, no email. WebMIDI out for DAWs and hardware.
Counterpoint rules are centuries of shared human knowledge. The code that applies them is MIT — fork it, ship it, use it in research, sell it.