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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! Music theory library with midi, notes, chords, scales, and more
//!
//! ## Feature flags
//!
//! Staff uses a set of [feature flags] to reduce the amount of compiled code. It
//! is possible to just enable certain features over others. By default, staff
//! does not enable any features but allows one to enable a subset for their use
//! case. Below is a list of the available feature flags. You may also notice
//! above each function, struct and trait there is listed one or more feature flags
//! that are required for that item to be used. If you are new to staff it is
//! recommended that you use the `full` feature flag which will enable all public APIs.
//! Beware though that this will pull in many extra dependencies that you may not
//! need.
//!
//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
//!
//! - `full`: Enables all features listed below.
//! - `std`: Enables std, otherwise this crate will use `#![no_std]`
//! - `parse` Enables the `staff::parse` module.
//! - `fretboard` Enables the `staff::fretboard` module.
//! - `render` Enables the `staff::render` module.
//!
//! # Examples
//!
//! Create a C Major (1st inversion) chord and iterate over its notes.
//! ```
//! use staff::{midi, Chord, Pitch};
//!
//! // C/E
//! let notes = [midi!(E, 3), midi!(G, 3), midi!(C, 4)];
//! let chord = Chord::from_midi(midi!(C, 4), notes).unwrap();
//!
//! assert_eq!(chord.to_string(), "C/E");
//!
//! assert!(chord.into_iter().eq(notes));
//! ```
//!
//! Create a C Major scale and iterate over its notes.
//! ```
//! use staff::{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),
//! ]));
//! ```
pub use Chord;
pub use Format;
pub use Interval;
pub use crate Key;
pub use Natural;
pub use Note;
pub use Pitch;
pub use Scale;
pub use Set;
/// ```
/// use staff::{midi, Pitch};
/// use staff::midi::Octave;
///
/// let midi = midi!(C, 4);
///
/// assert_eq!(midi.pitch(), Pitch::C);
/// assert_eq!(midi.octave(), Octave::FOUR);
/// ```