pub enum Mode {
Chromatic,
Ionian,
Dorian,
Phrygian,
Lydian,
Mixolydian,
Aeolian,
Locrian,
}Expand description
The scale a pattern’s pitch controls walk in.
Chromatic is “off”: every semitone is available and the diatonic chord types have no degree to derive a quality from, so they collapse to major and major seventh.
Variants§
Implementations§
Source§impl Mode
impl Mode
pub const ALL: [Mode; 8]
pub const fn label(self) -> &'static str
pub const fn index(self) -> u8
pub fn from_index(index: u8) -> Self
pub fn stepped(self, delta: i32) -> Self
Sourcepub const fn rotation(self) -> Option<usize>
pub const fn rotation(self) -> Option<usize>
How far into the major scale this mode starts. None for Chromatic,
which is not a rotation of anything.
Sourcepub fn scale(self) -> Option<[i32; 7]>
pub fn scale(self) -> Option<[i32; 7]>
Semitones above the tonic for each degree of this mode, ascending.
None for Chromatic, which is not a scale — every semitone is a
degree, and asking which one a note is on has no answer.
Sourcepub fn degree_of(self, note: u8, tonic: u8) -> Option<usize>
pub fn degree_of(self, note: u8, tonic: u8) -> Option<usize>
Which degree of this mode note sits on, given a tonic pitch class.
None when the note is not in the scale — a borrowed note, which is a
feature rather than a mistake, and which the diatonic chord types have
no quality for.
Sourcepub fn walk(self, note: u8, tonic: u8, steps: i32) -> u8
pub fn walk(self, note: u8, tonic: u8, steps: i32) -> u8
The note steps degrees away from note in this mode.
Under Chromatic this is a semitone walk. In a mode it is a scale walk: the pitch control moves by degrees, so holding the key sweeps through the key rather than through every semitone in it. A note that is not in the scale — one that was set before the mode was, or borrowed on purpose — snaps onto the scale on the first press rather than staying off it forever.