Skip to content

harmonia 0.1.0

Latest

Choose a tag to compare

@sogh sogh released this 26 Apr 20:34

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_heptatonic for diatonic letter spelling

Catalogue

  • ScaleKind + Scale — 16 scales (modes, pentatonics, harmonic/melodic minor, symmetric)
  • ChordQuality + Chord — 12 qualities (6 triads + 6 sevenths)

Analysis

  • Key with diatonic chord templates
  • RomanNumeral — typed numeral with alteration, degree, quality, and secondary-of
  • detect_key — score a progression against every major key
  • suggest_scales_for_bracket — rank scales over a chord transition
  • suggest_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) — derives Serialize/Deserialize on every public data type.

Quality

  • 111 unit tests, 17 serde integration tests, 5 README example tests, 11 doctests
  • cargo clippy -D warnings clean with and without the serde feature
  • MSRV: Rust 1.88 (for let-chains)

Origin

Ported from the JavaScript theory layer of fretboard-explorer.