pub struct RomanNumeral { /* private fields */ }Expand description
A parsed Roman numeral in a key.
Implementations§
Source§impl RomanNumeral
impl RomanNumeral
Sourcepub fn analyze(chord: &Chord, key: Key) -> Result<Option<Self>>
pub fn analyze(chord: &Chord, key: Key) -> Result<Option<Self>>
Performs functional Roman-numeral analysis in a key.
Sourcepub fn analyze_with_root(
chord: &Chord,
key: Key,
root: &Pitch,
) -> Result<Option<Self>>
pub fn analyze_with_root( chord: &Chord, key: Key, root: &Pitch, ) -> Result<Option<Self>>
Performs Roman-numeral analysis using an explicit harmonic root.
This is useful for pitch-class-set browser views where the caller has already chosen a transposition root and does not want inversion or root inference to pick a different chord member.
Source§impl RomanNumeral
impl RomanNumeral
Sourcepub fn to_chord(&self) -> Result<Chord>
pub fn to_chord(&self) -> Result<Chord>
The chord the numeral stands for, spelled where its key sounds.
This is music21’s _updatePitches, and it is a figured-bass reading
rather than a stack of intervals: the bass is the scale degree the
inversion figure puts there, every number of the column is that many
scale steps above it, and only then is the result respelled to the
quality the numeral’s case and symbols asked for. Reading it off the
scale is what lets a numeral mean something in a mode, and what makes
V7b5 alter one note rather than name a different chord.
Source§impl RomanNumeral
impl RomanNumeral
Sourcepub fn new(figure: impl Into<String>, key: Key) -> Result<Self>
pub fn new(figure: impl Into<String>, key: Key) -> Result<Self>
Parses a Roman numeral figure in a key.
Supports ordinary figures such as V7/V and augmented-sixth figures
such as It+6, Fr+6, Ger+6, and Sw+6.
Sourcepub fn with_minor_defaults(
figure: impl Into<String>,
key: Key,
sixth_minor: Minor67Default,
seventh_minor: Minor67Default,
) -> Result<Self>
pub fn with_minor_defaults( figure: impl Into<String>, key: Key, sixth_minor: Minor67Default, seventh_minor: Minor67Default, ) -> Result<Self>
The same, saying how the sixth and seventh degrees of a minor key are
to be read: music21’s sixthMinor and seventhMinor.
Sourcepub fn with_options(
figure: impl Into<String>,
key: Key,
sixth_minor: Minor67Default,
seventh_minor: Minor67Default,
case_matters: bool,
) -> Result<Self>
pub fn with_options( figure: impl Into<String>, key: Key, sixth_minor: Minor67Default, seventh_minor: Minor67Default, case_matters: bool, ) -> Result<Self>
The same again, saying whether the case of the numeral states the
chord’s quality: music21’s caseMatters.
Sourcepub fn over_scale(
figure: impl Into<String>,
key: Key,
scale: Option<Scale>,
sixth_minor: Minor67Default,
seventh_minor: Minor67Default,
case_matters: bool,
) -> Result<Self>
pub fn over_scale( figure: impl Into<String>, key: Key, scale: Option<Scale>, sixth_minor: Minor67Default, seventh_minor: Minor67Default, case_matters: bool, ) -> Result<Self>
The same again over a scale that is not a key: music21’s numerals
read against a ConcreteScale.
The key is still needed — a numeral reports one, and a secondary numeral establishes one — so pass the major key of the scale’s tonic, which is what music21 falls back on.
Sourcepub fn bracketed_alterations(&self) -> &[(i8, u8)]
pub fn bracketed_alterations(&self) -> &[(i8, u8)]
The alterations written in square brackets, as the semitones each moves its chord step by and the step it moves.
Sourcepub fn omitted_steps(&self) -> &[u8] ⓘ
pub fn omitted_steps(&self) -> &[u8] ⓘ
The chord steps the figure leaves out, as [no3].
Sourcepub fn added_steps(&self) -> &[(i8, u8)]
pub fn added_steps(&self) -> &[(i8, u8)]
The notes the figure puts in beside the chord, as [add4]: the
alteration in semitones and how far above the root each stands.
Sourcepub fn scale(&self) -> Option<&Scale>
pub fn scale(&self) -> Option<&Scale>
The scale the figure is read over, where it is not a key at all.
A numeral read this way spells its chord where the scale stands, so nothing downstream has to place it.
Sourcepub fn implied_quality(&self) -> ImpliedQuality
pub fn implied_quality(&self) -> ImpliedQuality
The quality the figure states, which is what the notes read off the scale are respelled to.
Sourcepub fn figure_numbers(&self) -> Vec<u8> ⓘ
pub fn figure_numbers(&self) -> Vec<u8> ⓘ
The numbers of the figured-bass column the figure’s digits stand for, written high to low and expanded out of music21’s shorthand.
Sourcepub fn case_matters(&self) -> bool
pub fn case_matters(&self) -> bool
Whether the case of the numeral states the chord’s quality.
Sourcepub fn sixth_minor(&self) -> Minor67Default
pub fn sixth_minor(&self) -> Minor67Default
How this numeral reads the sixth degree of a minor key.
Sourcepub fn seventh_minor(&self) -> Minor67Default
pub fn seventh_minor(&self) -> Minor67Default
How it reads the seventh.
Sourcepub fn figures_written(&self) -> &str
pub fn figures_written(&self) -> &str
Returns the original figure.
The digits written under the numeral, as music21’s figuresWritten:
the figure with the numeral, its accidental and its quality symbol
taken off it, and nothing expanded.
Sourcepub fn figures_notation(&self) -> &Notation
pub fn figures_notation(&self) -> &Notation
The figured-bass column the numeral’s digits stand for, expanded out
of the shorthand they were written in: music21’s figuresNotationObj.
Sourcepub fn figure(&self) -> &str
pub fn figure(&self) -> &str
The figure the numeral was written with, as given: music21’s figure.
Sourcepub fn written_accidental(&self) -> i8
pub fn written_accidental(&self) -> i8
Returns the chromatic alteration of the scale degree in semitones.
Negative values are flats and positive values are sharps, so bII
returns -1 and #iv returns 1.
Sourcepub fn accidental(&self) -> i8
pub fn accidental(&self) -> i8
The alteration the numeral reports, once the sixth and seventh degrees of a minor key have been read against the chord asked for.
Sourcepub fn roman_numeral(&self) -> String
pub fn roman_numeral(&self) -> String
The numeral with its front alteration and nothing else: music21’s
romanNumeral, so bII6 is bII and V65/V is V. An augmented
sixth answers its nationality, It, Fr, Ger or Sw.
Sourcepub fn roman_numeral_alone(&self) -> String
pub fn roman_numeral_alone(&self) -> String
The numeral with nothing written in front of it: music21’s
romanNumeralAlone, so bVII65/V is VII.
Sourcepub fn figure_and_key(&self) -> String
pub fn figure_and_key(&self) -> String
The figure and its key together: music21’s figureAndKey,
bII6 in a minor.
Sourcepub fn scale_degree_with_alteration(&self) -> (u8, i8)
pub fn scale_degree_with_alteration(&self) -> (u8, i8)
The scale degree with the alteration in front of it, as sharps
(positive) or flats (negative): music21’s scaleDegreeWithAlteration.
Sourcepub fn functionality_score(&self) -> u8
pub fn functionality_score(&self) -> u8
How strongly the figure implies its function, from music21’s
functionalityScores table: I is 100, V7 80, an unknown figure 0.
A secondary figure multiplies the scores of its halves.
An augmented sixth is looked up by music21’s spelling, It6 rather
than the It+6 this crate writes.
Sourcepub fn is_neapolitan(&self, require_first_inversion: bool) -> bool
pub fn is_neapolitan(&self, require_first_inversion: bool) -> bool
Whether this is a Neapolitan chord: a major triad on the flattened
second degree, in first inversion unless require_first_inversion is
off.
Sourcepub fn is_mixture(&self, evaluate_secondary: bool) -> Result<bool>
pub fn is_mixture(&self, evaluate_secondary: bool) -> Result<bool>
Whether the chord is borrowed from the parallel mode: music21’s
isMixture, so iv and bVI in a major key are mixture and IV in a
minor key is. With evaluate_secondary a secondary figure is judged by
the numeral after the slash.
Sourcepub fn transpose(&self, interval: &Interval) -> Result<Self>
pub fn transpose(&self, interval: &Interval) -> Result<Self>
The same figure in the key transposed by interval.
Sourcepub fn effective_key_of(&self) -> Result<Key>
pub fn effective_key_of(&self) -> Result<Key>
The key the figure is actually read in: the key it was given, or the
one a secondary numeral establishes — the V of V/V in G major is
read in D major.
Trait Implementations§
Source§impl Clone for RomanNumeral
impl Clone for RomanNumeral
Source§fn clone(&self) -> RomanNumeral
fn clone(&self) -> RomanNumeral
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RomanNumeral
impl Debug for RomanNumeral
Source§impl<'de> Deserialize<'de> for RomanNumeral
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RomanNumeral
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>,
Source§impl Display for RomanNumeral
impl Display for RomanNumeral
Auto Trait Implementations§
impl Freeze for RomanNumeral
impl RefUnwindSafe for RomanNumeral
impl Send for RomanNumeral
impl Sync for RomanNumeral
impl Unpin for RomanNumeral
impl UnsafeUnpin for RomanNumeral
impl UnwindSafe for RomanNumeral
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