4 releases (2 breaking)
0.3.1 | Aug 10, 2022 |
---|---|
0.3.0 | May 5, 2022 |
0.2.0 | Apr 28, 2022 |
0.1.0 | Apr 25, 2022 |
#693 in Audio
47 downloads per month
Used in 2 crates
43KB
1K
SLoC
Music theory library with midi, notes, chords, scales, and more
use music_note::{midi, Chord, Pitch};
let chord = Chord::from_midi(
midi!(C, 4),
[midi!(E, 3), midi!(G, 3), midi!(C, 4)]
);
assert_eq!(chord.to_string(), "C/E");
let pitches = [Pitch::E, Pitch::G, Pitch::C];
assert!(chord.into_iter().eq(pitches));
lib.rs
:
Music theory library with midi, notes, chords, scales, and more
Examples
Create a C Major (1st inversion) chord and iterate over its notes.
use music_note::{midi, Chord, Pitch};
// C/E
let chord = Chord::from_midi(
midi!(C, 4),
[midi!(E, 3), midi!(G, 3), midi!(C, 4)]
);
assert_eq!(chord.to_string(), "C/E");
let pitches = [Pitch::E, Pitch::G, Pitch::C];
assert!(chord.into_iter().eq(pitches));
Create a C Major scale and iterate over its notes.
use music_note::{midi, Note, Scale};
// C major
let scale = Scale::major(midi!(C, 4));
assert!(scale.eq([
midi!(C, 4),
midi!(D, 4),
midi!(E, 4),
midi!(F, 4),
midi!(G, 4),
midi!(A, 4),
midi!(B, 4),
]));
Dependencies
~150KB