Skip to main content

lrp_combination

Function lrp_combination 

Source
pub fn lrp_combination(
    chord: &Chord,
    transforms: &[Transform],
    order: ChainOrder,
    respell: Respell,
) -> Result<Chord>
Expand description

Where a chain of transformations ends: music21’s LRP_combinations. No transformations at all leave chord as it was.

use music21_rs::{Chord, Pitch, analysis::neoriemannian::*};

let c_major = Chord::new("C4 E4 G4")?;
let lp = Transform::parse_chain("LP")?;
let ended = lrp_combination(&c_major, &lp, ChainOrder::LeftToRight, Respell::Keep)?;
assert_eq!(ended.pitches().iter().map(Pitch::name_with_octave).collect::<Vec<_>>(), ["B3", "E4", "G#4"]);

§Errors

A chord that is not a major or minor triad.