pub struct EnharmonicRules { /* private fields */ }Expand description
The three penalties a spelling is scored by: music21’s
EnharmonicScoreRules and its subclasses. A penalty of None or nought
is off, and scores 1 whatever the spelling.
Implementations§
Source§impl EnharmonicRules
impl EnharmonicRules
Sourcepub const CHORDAL: Self
pub const CHORDAL: Self
music21’s ChordEnharmonicScoreRules: mixing sharps and flats costs
two for each of the rarer kind.
Sourcepub fn new(
alteration: Option<IntegerType>,
aug_dim: Option<IntegerType>,
mixture: Option<IntegerType>,
) -> Self
pub fn new( alteration: Option<IntegerType>, aug_dim: Option<IntegerType>, mixture: Option<IntegerType>, ) -> Self
Rules with the penalties given: what each sharp or flat costs, each augmented or diminished step, and each accidental of the rarer kind.
Sourcepub fn alteration_penalty(self) -> Option<IntegerType>
pub fn alteration_penalty(self) -> Option<IntegerType>
What each sharp or flat costs, if anything.
Sourcepub fn aug_dim_penalty(self) -> Option<IntegerType>
pub fn aug_dim_penalty(self) -> Option<IntegerType>
What each augmented or diminished step costs, if anything.
Sourcepub fn mixture_penalty(self) -> Option<IntegerType>
pub fn mixture_penalty(self) -> Option<IntegerType>
What each accidental of the rarer kind costs, if anything.
Sourcepub fn alteration_score(self, spelling: &[Pitch]) -> IntegerType
pub fn alteration_score(self, spelling: &[Pitch]) -> IntegerType
music21’s getAlterationScore: one more than the sharps and flats in
spelling, times the alteration penalty.
Sourcepub fn mixture_score(self, spelling: &[Pitch]) -> IntegerType
pub fn mixture_score(self, spelling: &[Pitch]) -> IntegerType
music21’s getMixSharpFlatsScore: the count of the rarer of sharps
and flats in spelling, times the mixture penalty.
Sourcepub fn aug_dim_score(self, spelling: &[Pitch]) -> Result<IntegerType>
pub fn aug_dim_score(self, spelling: &[Pitch]) -> Result<IntegerType>
music21’s getAugDimScore: one more than the augmented and
diminished steps between neighbours in spelling, times the
aug/dim penalty. E- G# is one, an augmented third.
§Errors
A neighbour spelled with an accidental base 40 has no place for, such as a triple sharp or a microtone’s step.
Trait Implementations§
Source§impl Clone for EnharmonicRules
impl Clone for EnharmonicRules
impl Copy for EnharmonicRules
Source§impl Debug for EnharmonicRules
impl Debug for EnharmonicRules
Source§impl Default for EnharmonicRules
impl Default for EnharmonicRules
Source§impl<'de> Deserialize<'de> for EnharmonicRules
Available on crate feature serde only.
impl<'de> Deserialize<'de> for EnharmonicRules
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 EnharmonicRules
Source§impl Hash for EnharmonicRules
impl Hash for EnharmonicRules
Source§impl PartialEq for EnharmonicRules
impl PartialEq for EnharmonicRules
Source§impl Serialize for EnharmonicRules
Available on crate feature serde only.
impl Serialize for EnharmonicRules
serde only.impl StructuralPartialEq for EnharmonicRules
Auto Trait Implementations§
impl Freeze for EnharmonicRules
impl RefUnwindSafe for EnharmonicRules
impl Send for EnharmonicRules
impl Sync for EnharmonicRules
impl Unpin for EnharmonicRules
impl UnsafeUnpin for EnharmonicRules
impl UnwindSafe for EnharmonicRules
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