#[non_exhaustive]pub enum ScaleType {
Show 20 variants
Major,
Minor,
Dorian,
Phrygian,
Lydian,
Mixolydian,
Locrian,
Hypodorian,
Hypophrygian,
Hypolydian,
Hypomixolydian,
Hypolocrian,
Hypoaeolian,
HarmonicMinor,
MelodicMinor,
Chromatic,
WholeTone,
Octatonic,
RagAsawari,
RagMarwa,
}Expand description
A named scale from music21’s scale module.
Ordered as music21 defines them: the seven church modes, their plagal counterparts, the altered minors, then the symmetrical and non-Western scales.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Major
Major (Ionian).
Minor
Natural minor (Aeolian).
Dorian
Dorian mode.
Phrygian
Phrygian mode.
Lydian
Lydian mode.
Mixolydian
Mixolydian mode.
Locrian
Locrian mode.
Hypodorian
Hypodorian mode. Shares Dorian’s pitches; the ambitus differs.
Hypophrygian
Hypophrygian mode. Shares Phrygian’s pitches.
Hypolydian
Hypolydian mode. Shares Lydian’s pitches.
Hypomixolydian
Hypomixolydian mode. Shares Mixolydian’s pitches.
Hypolocrian
Hypolocrian mode. Shares Locrian’s pitches.
Hypoaeolian
Hypoaeolian mode. Shares natural minor’s pitches.
HarmonicMinor
Harmonic minor, with a raised seventh.
MelodicMinor
Ascending melodic minor.
Chromatic
Twelve-tone chromatic scale.
WholeTone
Six-tone whole-tone scale.
Octatonic
Eight-tone octatonic scale, alternating tone and semitone.
RagAsawari
Rag Asawari, as a five-tone ascending scale.
RagMarwa
Rag Marwa, as a seven-step ascending scale.
Not monotonic: music21’s ascending network dips back down a major second from the sixth degree before rising a minor third to the octave, so the realized pitches repeat a note and briefly descend.
Implementations§
Source§impl ScaleType
impl ScaleType
Sourcepub fn music21_name(self) -> &'static str
pub fn music21_name(self) -> &'static str
Returns the music21 class name for this scale.
Sourcepub fn music21_descriptive_name(self) -> &'static str
pub fn music21_descriptive_name(self) -> &'static str
The words music21 puts after the tonic when it names a scale:
"C major", "C harmonic minor", "C Rag Asawari".
The capitalisation is upstream’s and is not consistent — the modes are lower case, the others are not — which is why this is a table rather than something derived from the class name.
Sourcepub fn from_music21_name(name: &str) -> Option<Self>
pub fn from_music21_name(name: &str) -> Option<Self>
The scale type music21 calls by this class name, such as
"MajorScale".
Sourcepub fn tonic_degree(self) -> usize
pub fn tonic_degree(self) -> usize
Which degree of the realized scale is its final: music21’s
tonicDegree.
A plagal mode — the six that music21 prefixes Hypo — runs from a
fourth below its final to a fifth above it, so the note the music
comes to rest on is its fourth degree and not its first. Every other
scale here starts on its own tonic.
Sourcepub fn dominant_degree(self) -> usize
pub fn dominant_degree(self) -> usize
Which degree is the reciting tone: music21’s dominantDegree.
A fifth above the final in the authentic modes. The plagal ones took theirs a third above the authentic dominant and then moved it off any B, which is why hypophrygian and hypomixolydian differ from the rest.
Sourcepub fn realization_steps(self) -> Vec<&'static str>
pub fn realization_steps(self) -> Vec<&'static str>
The steps walked from the pitch the scale is realized from, which for a plagal mode is not its final.
steps is the collection written from the final, which is
how every one of these scales is named. A plagal mode is realized
from a fourth below that, so its walk starts three steps earlier in
the same cycle — the rotation that puts the final at the degree
Self::tonic_degree names.
Sourcepub fn beyond_terminus(self) -> Option<&'static str>
pub fn beyond_terminus(self) -> Option<&'static str>
The step a scale carries on past its own octave, where it has one.
Rag Marwa is the only one here: its network keeps going a semitone
above the terminus, so the collection realized from C closes on the
octave and then sounds the D- above it. music21 calls it “a pitch
beyond the terminus” and gives it whenever the realization is not
bounded by a range.
Sourcepub fn descending_form(self) -> Option<Self>
pub fn descending_form(self) -> Option<Self>
The collection this scale uses coming down, where that is not the one it uses going up.
The melodic minor is the familiar case — it raises its sixth and
seventh degrees ascending and lets them fall descending, which is the
natural minor — and Rag Asawari’s avaroha is that same collection.
Every other scale here descends through the notes it ascends
through, and answers None.
Sourcepub fn ascending_degrees(self) -> Option<&'static [u8]>
pub fn ascending_degrees(self) -> Option<&'static [u8]>
The degrees the notes of this scale’s ascent stand on, where they are not simply counted off one to a note.
Rag Asawari’s aroha leaves out the third and the seventh, so its five notes stand on the first, second, fourth, fifth and sixth degrees. It has no third going up at all — which is what music21 answers when asked for one — and its fourth degree is its third note.
Sourcepub fn descending_steps(self) -> Option<&'static [&'static str]>
pub fn descending_steps(self) -> Option<&'static [&'static str]>
The steps this scale is walked by coming down, where coming down is not simply the ascending pattern read backwards and no other named scale is that pattern.
Rag Marwa’s avarohana is the one: from its tonic it rises a semitone
to the flat second above the octave and falls from there, which is
music21’s network edge from the high terminus upward before anything
descends. Written as a rising list from the tonic it closes by falling
back onto it, so the flat second is both the second degree and the
seventh — which is what music21 answers when asked which degree a
D- is coming down.
Sourcepub fn is_plagal(self) -> bool
pub fn is_plagal(self) -> bool
Whether this is a plagal mode, whose range sits below its final.
Sourcepub fn degree_count(self) -> usize
pub fn degree_count(self) -> usize
Returns the number of distinct degrees in one octave.
Source§impl ScaleType
impl ScaleType
Sourcepub fn derive_ranked(
self,
pitches: &[Pitch],
limit: Option<usize>,
) -> Result<Vec<(usize, Scale)>>
pub fn derive_ranked( self, pitches: &[Pitch], limit: Option<usize>, ) -> Result<Vec<(usize, Scale)>>
Ranks every candidate tonic by how many of pitches fall in this
scale type built on it, best first, as music21’s deriveRanked does.
Pitches are compared by pitch class and duplicates count separately.
Sourcepub fn derive_ranked_by(
self,
pitches: &[Pitch],
limit: Option<usize>,
comparison: DegreeComparison,
) -> Result<Vec<(usize, Scale)>>
pub fn derive_ranked_by( self, pitches: &[Pitch], limit: Option<usize>, comparison: DegreeComparison, ) -> Result<Vec<(usize, Scale)>>
The same, saying how a pitch is matched against a scale degree.
By pitch class an E# is in C major, since the scale has an F; by
name it is not. music21 offers both, and its deriveRanked defaults
to the first.
Trait Implementations§
impl Copy for ScaleType
Source§impl<'de> Deserialize<'de> for ScaleType
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ScaleType
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ScaleType
impl StructuralPartialEq for ScaleType
Auto Trait Implementations§
impl Freeze for ScaleType
impl RefUnwindSafe for ScaleType
impl Send for ScaleType
impl Sync for ScaleType
impl Unpin for ScaleType
impl UnsafeUnpin for ScaleType
impl UnwindSafe for ScaleType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more