pub struct Interval { /* private fields */ }Expand description
A directed musical interval with diatonic spelling and chromatic size.
Implementations§
Source§impl Interval
impl Interval
Sourcepub fn from_name(name: impl Into<String>) -> Result<Self>
pub fn from_name(name: impl Into<String>) -> Result<Self>
Parses an interval name such as "M3", "P5", or "-m6".
Sourcepub fn from_semitones(semitones: IntegerType) -> Result<Self>
pub fn from_semitones(semitones: IntegerType) -> Result<Self>
Creates an implicit diatonic interval from a chromatic semitone count.
Sourcepub fn between_pitches(start: &Pitch, end: &Pitch) -> Result<Self>
pub fn between_pitches(start: &Pitch, end: &Pitch) -> Result<Self>
Returns the directed interval from start to end.
Sourcepub fn between_notes(start: &Note, end: &Note) -> Result<Self>
pub fn between_notes(start: &Note, end: &Note) -> Result<Self>
Returns the directed interval from start to end.
Sourcepub fn semitones(&self) -> IntegerType
pub fn semitones(&self) -> IntegerType
Returns the directed chromatic size in semitones.
Sourcepub fn direction(&self) -> IntervalDirection
pub fn direction(&self) -> IntervalDirection
Returns the directed interval direction.
Sourcepub fn generic_number(&self) -> IntegerType
pub fn generic_number(&self) -> IntegerType
Returns the simple or compound generic interval number.
Sourcepub fn is_implicit_diatonic(&self) -> bool
pub fn is_implicit_diatonic(&self) -> bool
Returns true when the interval was inferred from semitones only.
Sourcepub fn pythagorean_ratio(&self) -> Result<FractionType>
pub fn pythagorean_ratio(&self) -> Result<FractionType>
Returns the Pythagorean tuning ratio for this interval.
The ratio is expressed as a rational fraction built from pure fifths, matching the helper music21 uses for enharmonic scoring.
Sourcepub fn transpose_pitch(&self, pitch: &Pitch) -> Result<Pitch>
pub fn transpose_pitch(&self, pitch: &Pitch) -> Result<Pitch>
Transposes a pitch by this interval.
Sourcepub fn transpose_note(&self, note: &Note) -> Result<Note>
pub fn transpose_note(&self, note: &Note) -> Result<Note>
Transposes a note by this interval.
Sourcepub fn transpose_pitch_in_place(&self, pitch: &mut Pitch) -> Result<()>
pub fn transpose_pitch_in_place(&self, pitch: &mut Pitch) -> Result<()>
Transposes a pitch in place by this interval.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interval
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnsafeUnpin for Interval
impl UnwindSafe for Interval
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,
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