pub struct Microtone { /* private fields */ }Expand description
A microtonal pitch adjustment measured in cents, optionally shifted by a
harmonic like Python music21’s music21.pitch.Microtone.
Implementations§
Source§impl Microtone
impl Microtone
Sourcepub fn new(specifier: impl Into<MicrotoneSpecifier>) -> Result<Self>
pub fn new(specifier: impl Into<MicrotoneSpecifier>) -> Result<Self>
Creates a microtone with no harmonic shift.
Sourcepub fn with_harmonic_shift(
specifier: impl Into<MicrotoneSpecifier>,
harmonic_shift: IntegerType,
) -> Result<Self>
pub fn with_harmonic_shift( specifier: impl Into<MicrotoneSpecifier>, harmonic_shift: IntegerType, ) -> Result<Self>
Creates a microtone with an explicit harmonic shift.
Sourcepub fn alter(&self) -> FloatType
pub fn alter(&self) -> FloatType
Returns the microtone in accidental alter units, where 100 cents is 1.0.
Sourcepub fn cents(&self) -> FloatType
pub fn cents(&self) -> FloatType
Returns the total cent displacement, including harmonic shift.
Sourcepub fn cent_shift(&self) -> FloatType
pub fn cent_shift(&self) -> FloatType
Returns the direct cent shift before harmonic adjustment.
Sourcepub fn set_cent_shift(&mut self, cents: FloatType)
pub fn set_cent_shift(&mut self, cents: FloatType)
Sets the direct cent shift before harmonic adjustment.
Sourcepub fn harmonic_shift(&self) -> IntegerType
pub fn harmonic_shift(&self) -> IntegerType
Returns the harmonic shift.
Sourcepub fn set_harmonic_shift(&mut self, harmonic_shift: IntegerType)
pub fn set_harmonic_shift(&mut self, harmonic_shift: IntegerType)
Sets the harmonic shift.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Microtone
impl<'de> Deserialize<'de> for Microtone
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Microtone> for MicrotoneSpecifier
impl From<Microtone> for MicrotoneSpecifier
Auto Trait Implementations§
impl Freeze for Microtone
impl RefUnwindSafe for Microtone
impl Send for Microtone
impl Sync for Microtone
impl Unpin for Microtone
impl UnsafeUnpin for Microtone
impl UnwindSafe for Microtone
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
Mutably borrows from an owned value. Read more
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>
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 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>
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