Skip to main content

make_ornamental_accidentals

Function make_ornamental_accidentals 

Source
pub fn make_ornamental_accidentals(
    note: &mut Note,
    key: &KeySignature,
    options: &AccidentalDisplayOptions<'_>,
) -> Result<Vec<Pitch>>
Expand description

Decides whether each accidental this note’s ornaments imply is shown, and writes it onto the ornament: music21’s makeOrnamentalAccidentals.

The notes an ornament plays are read in key, decided as Ornament::update_accidental_display decides them – never simultaneous with anything and never tied, an ornamental note being neither – and what is decided is written back onto the ornament’s own accidental, which is where the MusicXML writer reads the mark from. The pitches decided are answered in music21’s order, so a caller can count them among the pitches already heard, as music21’s step adds them to pitchPast.

An ornament of a fixed size – a half-step trill, a whole-step mordent – carries no accidental of its own, so there is nowhere here to write the decision and the ornament is left as it stands. music21 keeps it on the pitch it resolved, which a value type does not hold.

§Errors

A general mordent that has not said which way it goes, whose notes cannot be worked out at all.