pub enum Transform {
L,
P,
R,
}Expand description
One of the three neo-Riemannian transformations.
Variants§
L
Leading-tone exchange: a major root falls a semitone, a minor fifth rises one. C major becomes E minor.
P
Parallel: the third moves a semitone. C major becomes C minor.
R
Relative: a major fifth rises a tone, a minor root falls one. C major becomes A minor.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn from_symbol(symbol: char) -> Result<Self>
pub fn from_symbol(symbol: char) -> Result<Self>
Sourcepub fn parse_chain(symbols: &str) -> Result<Vec<Self>>
pub fn parse_chain(symbols: &str) -> Result<Vec<Self>>
The transformations a string of letters names, in the order written.
§Errors
A letter other than L, P or R.
Sourcepub fn apply(self, chord: &Chord) -> Result<Chord>
pub fn apply(self, chord: &Chord) -> Result<Chord>
music21’s L, P and R: chord transformed, every other pitch
kept where it was. The result’s spelling is no longer inferred, and
it keeps chord’s duration.
use music21_rs::{Chord, Pitch, analysis::neoriemannian::Transform};
let c_major = Chord::new("C4 E4 G4")?;
let e_minor = Transform::L.apply(&c_major)?;
assert_eq!(e_minor.pitches().iter().map(Pitch::name_with_octave).collect::<Vec<_>>(), ["B3", "E4", "G4"]);§Errors
A chord that is not a major or minor triad.
Trait Implementations§
impl Copy for Transform
Source§impl<'de> Deserialize<'de> for Transform
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Transform
Available on crate feature
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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,
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> ⓘ
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