Skip to main content

DiatonicInterval

Struct DiatonicInterval 

Source
pub struct DiatonicInterval { /* private fields */ }
Expand description

A quality and a generic interval together: M3, -P5, dd7.

Implementations§

Source§

impl DiatonicInterval

Source

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.

Source

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.

Source

pub fn from_name(name: &str) -> Result<Self>

Parses a diatonic interval from a name such as M3, -P5 or Major Third.

Source

pub fn specifier_abbreviation(&self) -> &'static str

The quality.

Source

pub fn specifier(&self) -> Specifier

The quality of the interval.

Source

pub fn generic(&self) -> &GenericInterval

The generic interval.

Source

pub fn name(&self) -> String

The short name without direction, M3, P5, dd7.

Source

pub fn nice_name(&self) -> String

The spelled-out name, Major Third.

Source

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.

Source

pub fn directed_nice_name(&self) -> String

The spelled-out name with the direction, Descending Major Third.

Source

pub fn simple_name(&self) -> String

The short name of the simple interval, so M10 is M3.

Source

pub fn semi_simple_name(&self) -> String

The short name of the semi-simple interval, so P15 is P8.

Source

pub fn simple_nice_name(&self) -> String

The spelled-out name of the simple interval.

Source

pub fn semi_simple_nice_name(&self) -> String

The spelled-out name of the semi-simple interval.

Source

pub fn directed_simple_name(&self) -> String

The short directed name of the simple interval, M-3 for a descending tenth.

Source

pub fn directed_semi_simple_name(&self) -> String

The short directed name of the semi-simple interval.

Source

pub fn directed_simple_nice_name(&self) -> String

The spelled-out directed name of the simple interval.

Source

pub fn directed_semi_simple_nice_name(&self) -> String

The spelled-out directed name of the semi-simple interval.

Source

pub fn specific_name(&self) -> String

The quality’s spelled-out name alone, Major.

Source

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.

Source

pub fn cents(&self) -> Result<FloatType>

The size in cents, signed, from the chromatic equivalent.

Source

pub fn mod7(&self) -> String

The name of the simple interval measured upward, so a descending major third is m6.

Source

pub fn mod7_inversion(&self) -> String

The name of the inversion of the simple interval: M3 becomes m6.

Source

pub fn is_step(&self) -> bool

Whether the interval is a second in either direction.

Source

pub fn is_diatonic_step(&self) -> bool

The same as Self::is_step.

Source

pub fn is_skip(&self) -> bool

Whether the interval is larger than a second.

Source

pub fn is_perfectable(&self) -> bool

Whether the generic interval takes perfect qualities.

Source

pub fn get_chromatic(&self) -> Result<ChromaticInterval>

The semitone count the quality and generic interval add up to.

Source

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.

Source

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

Source§

fn clone(&self) -> DiatonicInterval

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiatonicInterval

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DiatonicInterval

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for DiatonicInterval

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DiatonicInterval

Source§

impl PartialEq for DiatonicInterval

Source§

fn eq(&self, other: &Self) -> bool

Two diatonic intervals are equal when their generic value, specifier and direction agree, as in music21.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DiatonicInterval

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.