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
RUST · WASM · VST3 · CLAP · AU

ENGINE ARCHITECTURE

One Rust harmony engine is shared by the desktop, browser, VST3, CLAP, and Audio Unit builds. The implementation is available in /src/harmony.

◆ ◇ ◆ ◇ ◆VOICE-LEADING SOLVER
FOUR STYLE PRESETS · STRUCT-LEVEL WEIGHTS

VOICE-LEADING SCORING

The solver enumerates legal voice combinations, removes candidates that violate hard rules, and ranks the rest with configurable weights.

PALESTRINA

16th-century strict species

MotionMostly stepwise
VoicingTight
Common tonesHeld when possible
Contrary motionEncouraged
LIVE · CLICK A FRET
E2A2D3G3B3E43579121517192124
◆ ◇ ◆ ◇ ◆VOICE REGISTERS
SATB · FIXED MIDI RANGES

VOICE REGISTER CONSTRAINTS

Candidate notes are constrained to each voice's register before scoring. A centering weight selects the initial placement.

SOPRANOC4–C6
ALTOG3–E5
TENORC3–A4
BASSE2–E4
MIDI 36 — 84 · CENTER MARK = FIRST-CHORD PREFERENCE
◆ ◇ ◆ ◇ ◆PLUGIN HOST
CLAP · clack-host

CLAP INSTRUMENT HOST

The standalone app can load a CLAP instrument, route generated MIDI to it, and mix its audio output.

CLAP PLUGIN HOST · clack-host
SLOT 01 · INSTRUMENT
VITAL.clap
wavetable · 2 in · 2 out
HARMONY
→ MIDI →
PLUGIN
→ AUDIO →
OUT
CLAP ABI · SAFE WRAPPER · GUI, LOG, AUDIO-PORTS, NOTE-PORTSROUTING HARMONY → INSTRUMENT
◆ ◇ ◆ ◇ ◆THE STACK
CORE
Rust · no_std-friendly
/src/harmony, /src/dsp
DESKTOP
Tauri v2
native window · plugin host
BROWSER
WASM · Web Audio API
same core · no install
MIDI
midir · virtual ports
route into any DAW
AUDIO
cpal · CoreAudio/ASIO
lock-free ring buffers
PLUGINS
clack-host · CLAP
GUI, log, audio + note ports
AVAILABLE FORMATS

BROWSER, DESKTOP,
OR SOURCE.

Browser at app.contrapunk.com. macOS DMG from GitHub Releases. Build from source with cargo tauri dev.