#music #music-theory #harmony #melody #chord


Foundational elements of western classical harmony, and tools to analyze them

4 releases

0.2.0 May 9, 2021
0.1.2 Apr 11, 2021
0.1.1 Apr 4, 2021
0.1.0 Apr 4, 2021

#102 in Audio

28 downloads per month

MIT license

759 lines


Persichetti is a crate that provides primitives for reasoning about harmonic concepts in western classical and contemporary music. It is named after Vincent Persichetti, composer and author of 20th Century Harmony. Some of the concepts in that book are realized here.


Name an interval, given the two notes that make it up

let b_flat = note!("Bb")?;
let g_sharp = note!("G#")?;
assert_eq!(Interval::new(Sixth, Augmented(1))?, Interval::from_notes(&b_flat, &g_sharp));

Add intervals together

let major_second = Interval::new(Second, Major)?;
let perfect_fourth = Interval::from_str("p4")?;
assert_eq!(Interval::new(Fifth, Perfect)?, major_second + perfect_fourth);

Combine notes and intervals

let f_sharp = note!("f#")?;
let major_third = ivl!("M3")?;
assert_eq!(note!("a#")?, f_sharp + major_third);

Other tools include:

  • Inverting intervals
  • Scientific pitch and MIDI note conversion
  • Generating serial tone matrixes

Work-in-progress tools include:

  • Chord identification
  • Extended / jazz harmony
  • Neo-Remannian transformations (PLR / NSH)
  • Slonimsky melodic sequences (Infrapulation, Interpolation, Ultrapolation)
  • Modes of limited transposition


~68K SLoC