pub struct DiatonicInterval { /* private fields */ }Expand description
A quality and a generic interval together: M3, -P5, dd7.
Implementations§
Source§impl DiatonicInterval
impl DiatonicInterval
Sourcepub fn new(specifier: Specifier, generic: &GenericInterval) -> Self
pub fn new(specifier: Specifier, generic: &GenericInterval) -> Self
Pairs a quality with a generic interval without checking that the
pair exists; see Self::try_new for the checked form.
Sourcepub fn try_new(specifier: Specifier, generic: GenericInterval) -> Result<Self>
pub fn try_new(specifier: Specifier, generic: GenericInterval) -> Result<Self>
Pairs a quality with a generic interval, rejecting the combinations music21 rejects: major and minor on a perfectable interval, perfect on the others, and a descending perfect unison.
Sourcepub fn from_name(name: &str) -> Result<Self>
pub fn from_name(name: &str) -> Result<Self>
Parses a diatonic interval from a name such as M3, -P5 or
Major Third.
Sourcepub fn specifier_abbreviation(&self) -> &'static str
pub fn specifier_abbreviation(&self) -> &'static str
The quality.
Sourcepub fn generic(&self) -> &GenericInterval
pub fn generic(&self) -> &GenericInterval
The generic interval.
Sourcepub fn directed_name(&self) -> String
pub fn directed_name(&self) -> String
The short name with the direction, M-3 for a descending third,
which is where music21 puts the hyphen.
Sourcepub fn directed_nice_name(&self) -> String
pub fn directed_nice_name(&self) -> String
The spelled-out name with the direction, Descending Major Third.
Sourcepub fn simple_name(&self) -> String
pub fn simple_name(&self) -> String
The short name of the simple interval, so M10 is M3.
Sourcepub fn semi_simple_name(&self) -> String
pub fn semi_simple_name(&self) -> String
The short name of the semi-simple interval, so P15 is P8.
Sourcepub fn simple_nice_name(&self) -> String
pub fn simple_nice_name(&self) -> String
The spelled-out name of the simple interval.
Sourcepub fn semi_simple_nice_name(&self) -> String
pub fn semi_simple_nice_name(&self) -> String
The spelled-out name of the semi-simple interval.
Sourcepub fn directed_simple_name(&self) -> String
pub fn directed_simple_name(&self) -> String
The short directed name of the simple interval, M-3 for a
descending tenth.
Sourcepub fn directed_semi_simple_name(&self) -> String
pub fn directed_semi_simple_name(&self) -> String
The short directed name of the semi-simple interval.
Sourcepub fn directed_simple_nice_name(&self) -> String
pub fn directed_simple_nice_name(&self) -> String
The spelled-out directed name of the simple interval.
Sourcepub fn directed_semi_simple_nice_name(&self) -> String
pub fn directed_semi_simple_nice_name(&self) -> String
The spelled-out directed name of the semi-simple interval.
Sourcepub fn specific_name(&self) -> String
pub fn specific_name(&self) -> String
The quality’s spelled-out name alone, Major.
Sourcepub fn direction(&self) -> Direction
pub fn direction(&self) -> Direction
Ascending, descending, or oblique. A unison takes its direction from the quality: an augmented unison ascends and a diminished one descends, as music21 reads them.
Sourcepub fn cents(&self) -> Result<FloatType>
pub fn cents(&self) -> Result<FloatType>
The size in cents, signed, from the chromatic equivalent.
Sourcepub fn mod7(&self) -> String
pub fn mod7(&self) -> String
The name of the simple interval measured upward, so a descending
major third is m6.
Sourcepub fn mod7_inversion(&self) -> String
pub fn mod7_inversion(&self) -> String
The name of the inversion of the simple interval: M3 becomes m6.
Sourcepub fn is_diatonic_step(&self) -> bool
pub fn is_diatonic_step(&self) -> bool
The same as Self::is_step.
Sourcepub fn is_perfectable(&self) -> bool
pub fn is_perfectable(&self) -> bool
Whether the generic interval takes perfect qualities.
Sourcepub fn get_chromatic(&self) -> Result<ChromaticInterval>
pub fn get_chromatic(&self) -> Result<ChromaticInterval>
The semitone count the quality and generic interval add up to.
Sourcepub fn reverse(&self) -> Self
pub fn reverse(&self) -> Self
The same interval in the other direction. A unison keeps its generic value and inverts its quality instead, since an augmented unison downward is a diminished one.
Sourcepub fn transpose_pitch(&self, pitch: &Pitch) -> Result<Pitch>
pub fn transpose_pitch(&self, pitch: &Pitch) -> Result<Pitch>
Moves a pitch by the interval, spelling the result by the quality.
Trait Implementations§
Source§impl Clone for DiatonicInterval
impl Clone for DiatonicInterval
Source§fn clone(&self) -> DiatonicInterval
fn clone(&self) -> DiatonicInterval
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 DiatonicInterval
impl Debug for DiatonicInterval
Source§impl<'de> Deserialize<'de> for DiatonicInterval
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DiatonicInterval
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 DiatonicInterval
impl Display for DiatonicInterval
impl Eq for DiatonicInterval
Source§impl PartialEq for DiatonicInterval
impl PartialEq for DiatonicInterval
Auto Trait Implementations§
impl Freeze for DiatonicInterval
impl RefUnwindSafe for DiatonicInterval
impl Send for DiatonicInterval
impl Sync for DiatonicInterval
impl Unpin for DiatonicInterval
impl UnsafeUnpin for DiatonicInterval
impl UnwindSafe for DiatonicInterval
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