Repository navigation
First public release of harmonia — instrument-agnostic music theory primitives in Rust.
📦 crates.io: https://crates.io/crates/harmonia
📚 docs.rs: https://docs.rs/harmonia/0.1.0
What's in
Foundation
PitchClass,Interval,Note(Letter+Accidental)spell_heptatonicfor diatonic letter spelling
Catalogue
ScaleKind+Scale— 16 scales (modes, pentatonics, harmonic/melodic minor, symmetric)ChordQuality+Chord— 12 qualities (6 triads + 6 sevenths)
Analysis
Keywith diatonic chord templatesRomanNumeral— typed numeral with alteration, degree, quality, and secondary-ofdetect_key— score a progression against every major keysuggest_scales_for_bracket— rank scales over a chord transitionsuggest_next_chords— context-aware chord recommender across six categories (diatonic, resolution, borrowed, secondary, relative, chromatic)
Every public data type implements FromStr, Display, PartialEq, and Hash.
Crate features
serde(off by default) — derivesSerialize/Deserializeon every public data type.
Quality
- 111 unit tests, 17 serde integration tests, 5 README example tests, 11 doctests
cargo clippy -D warningsclean with and without theserdefeature- MSRV: Rust 1.88 (for let-chains)
Origin
Ported from the JavaScript theory layer of fretboard-explorer.