pub struct Harm { /* private fields */ }Expand description
A **harm annotation read: music21’s HarmParser.parse, whose answer is
a dictionary of these same parts.
Implementations§
Source§impl Harm
impl Harm
Sourcepub fn parse(token: &str) -> Option<Self>
pub fn parse(token: &str) -> Option<Self>
Reads a **harm token, or nothing where it is not one: music21’s
HarmParser.parse, which answers an empty dictionary there.
use music21_rs::humdrum::harm::Harm;
let read = Harm::parse("#IV7b").expect("a harm token");
assert_eq!(read.accidental(), "#");
assert_eq!(read.root(), "IV");
assert_eq!(read.intervals(), Some("7"));
assert_eq!(read.inversion(), Some('b'));
assert_eq!(read.roman_figure(), "#IV65");
assert_eq!(Harm::parse("VIII"), None);Sourcepub fn accidental(&self) -> &str
pub fn accidental(&self) -> &str
The accidental written in front of the degree: #, --, or nothing.
Sourcepub fn intervals(&self) -> Option<&str>
pub fn intervals(&self) -> Option<&str>
The last of the intervals written over the degree, as music21 keeps
them: 7 of V7, AA6 of VAA6, 9 of V79.
Sourcepub fn inversion(&self) -> Option<char>
pub fn inversion(&self) -> Option<char>
The inversion letter: b for the first inversion, c for the
second, d for the third.
Sourcepub fn alternative(&self) -> Option<&Harm>
pub fn alternative(&self) -> Option<&Harm>
The reading written in brackets beside this one, which the figure says nothing of.
Sourcepub fn secondary(&self) -> Option<&Harm>
pub fn secondary(&self) -> Option<&Harm>
The degree this one is read in, written after a slash.
Sourcepub fn implied(&self) -> bool
pub fn implied(&self) -> bool
Whether the annotator wrote the token in parentheses, meaning the harmony is implied rather than sounded.
Sourcepub fn roman_figure(&self) -> String
pub fn roman_figure(&self) -> String
The figure a RomanNumeral is built
from: music21’s convertHarmToRoman.
The inversion letter becomes the figured bass it stands for – a
seventh chord’s b is 65 and a triad’s is 6 – a German or
French sixth is read as a seventh chord whatever intervals were
written, and only the degrees of the secondary functions are
carried across, as music21 carries them.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Harm
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Harm
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 Harm
impl StructuralPartialEq for Harm
Auto Trait Implementations§
impl Freeze for Harm
impl RefUnwindSafe for Harm
impl Send for Harm
impl Sync for Harm
impl Unpin for Harm
impl UnsafeUnpin for Harm
impl UnwindSafe for Harm
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