Skip to main content

simplify_multiple_enharmonics

Function simplify_multiple_enharmonics 

Source
pub fn simplify_multiple_enharmonics(
    pitches: &[Pitch],
    criterion: Option<CriterionFunction>,
    key_context: Option<KeySignature>,
) -> Result<Vec<Pitch>>
Expand description

Respells a set of pitches so that they read as simply as possible together: music21’s simplifyMultipleEnharmonics. The first pitch is kept as written and each of the others may be swapped for a common enharmonic; the spelling chosen is the one the criterion scores lowest, by default dissonance_score. Up to four pitches are searched exhaustively, more are settled greedily one at a time, as upstream does. With a key signature the tonic of its major key is placed first as an anchor and removed again afterwards.