1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! A library to easily explore music theory principles.
//!
//! # Examples
//!
//! ```
//! use klib::core::chord::*;
//! use klib::core::known_chord::KnownChord;
//! use klib::core::modifier::Degree;
//! use klib::core::note::*;
//!
//! // Check to see what _kind_ of chord this is.
//! assert_eq!(
//! Chord::new(C).augmented().seven().known_chord(),
//! KnownChord::AugmentedDominant(Degree::Seven)
//! );
//! ```
//!
//! ```
//! use klib::core::base::Parsable;
//! use klib::core::chord::*;
//! use klib::core::note::*;
//!
//! // Parse a chord from a string, and inspect the scale.
//! assert_eq!(
//! Chord::parse("Cm7b5").unwrap().scale(),
//! vec![C, DFlat, EFlat, F, GFlat, AFlat, BFlat]
//! );
//! ```
//!
//! ```
//! use klib::core::chord::*;
//! use klib::core::note::*;
//!
//! // From a note, create a chord, and look at the chord tones.
//! assert_eq!(
//! C.into_chord().augmented().major7().chord(),
//! vec![C, E, GSharp, B]
//! );
//! ```
//!
//! # Scales and Modes
//!
//! ```
//! use klib::core::base::HasName;
//! use klib::core::mode::*;
//! use klib::core::mode_kind::*;
//! use klib::core::note::*;
//! use klib::core::scale::*;
//! use klib::core::scale_kind::*;
//!
//! // Create a D Dorian mode
//! let mode = Mode::new(D, ModeKind::Dorian);
//! assert_eq!(mode.name(), "D dorian");
//!
//! // Create an A harmonic minor scale
//! let scale = Scale::new(A, ScaleKind::HarmonicMinor);
//! assert_eq!(scale.name(), "A harmonic minor");
//! ```
//!
//! # Notation (Unified Parsing)
//!
//! ```
//! use klib::core::base::Parsable;
//! use klib::core::notation::Notation;
//!
//! // Automatically detects and parses scales, modes, or chords
//! let scale = Notation::parse("C major pentatonic").unwrap();
//! assert!(scale.is_scale());
//!
//! let mode = Notation::parse("D dorian").unwrap();
//! assert!(mode.is_mode());
//!
//! let chord = Notation::parse("Cmaj7").unwrap();
//! assert!(chord.is_chord());
//! ```
pub use rodio;