pub struct Harte { /* private fields */ }Expand description
A chord read from a Harte label, with the Chord it sounds.
The chord’s pitches stand in degree order above the root in octave 4,
the bass an octave lower where it is not the root, and the root and bass
are fixed on the chord as the label names them. A label of N or X is
no chord at all: it has no root and an empty chord.
Two labels are equal when they sound the same chord: the same root, the
same degrees once the shorthand is unwrapped, and the same bass. C:maj
equals C:(3,5).
Implementations§
Source§impl Harte
impl Harte
Sourcepub fn into_chord(self) -> Chord
pub fn into_chord(self) -> Chord
The chord, handed over.
Sourcepub fn bass_degree(&self) -> Option<&str>
pub fn bass_degree(&self) -> Option<&str>
The bass as a degree above the root, 1 when none was written;
harte-library’s get_bass.
Sourcepub fn shorthand(&self) -> Option<&str>
pub fn shorthand(&self) -> Option<&str>
The shorthand, where the label carries one; harte-library’s
get_shorthand.
Sourcepub fn degrees(&self) -> Option<&[String]>
pub fn degrees(&self) -> Option<&[String]>
The degrees written in parentheses, *3 included, or None when
there were none; harte-library’s get_degrees.
Sourcepub fn unwrap_shorthand(&self) -> Option<&[String]>
pub fn unwrap_shorthand(&self) -> Option<&[String]>
Every degree the chord sounds, the shorthand’s and the written ones
together with the root and the bass, in order; harte-library’s
unwrap_shorthand, which answers the written degrees alone for a
label with no shorthand and nothing for one with neither.
Sourcepub fn sounding_degrees(&self) -> &[String]
pub fn sounding_degrees(&self) -> &[String]
Every degree the chord sounds, the root and the bass among them, in order; empty for no chord.
Sourcepub fn bass_is_root(&self) -> bool
pub fn bass_is_root(&self) -> bool
Whether the bass is the root.
Sourcepub fn contains_shorthand(&self) -> bool
pub fn contains_shorthand(&self) -> bool
Whether the label carries a shorthand.
Sourcepub fn midi_pitches(&self) -> Vec<IntegerType> ⓘ
pub fn midi_pitches(&self) -> Vec<IntegerType> ⓘ
The MIDI numbers of the pitches, lowest first.
Sourcepub fn multi_hot_encoding(&self, transpose: bool) -> [u8; 12]
pub fn multi_hot_encoding(&self, transpose: bool) -> [u8; 12]
Which of the twelve pitch classes the chord sounds, one flag each,
counted from C, or from the root with transpose.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Harte
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Harte
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>,
Auto Trait Implementations§
impl Freeze for Harte
impl RefUnwindSafe for Harte
impl Send for Harte
impl Sync for Harte
impl Unpin for Harte
impl UnsafeUnpin for Harte
impl UnwindSafe for Harte
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