Expand description
The best spelling of a run of pitches: music21’s analysis.enharmonics.
Every pitch may be written as itself or as any common enharmonic with at most one sharp or flat. Each combination is scored by three penalties and the lowest score wins, the first of equals in the order the combinations are listed:
aug/dim (augmented + diminished steps + 1) * aug_dim penalty
+ alteration (sharps + flats + 1) * alteration penalty
+ mixture min(sharps, flats) * mixture penaltyA penalty that is off scores 1 rather than 0, as music21’s does.
Structs§
- Enharmonic
Rules - The three penalties a spelling is scored by: music21’s
EnharmonicScoreRulesand its subclasses. A penalty ofNoneor nought is off, and scores 1 whatever the spelling.
Functions§
- best_
choice - Which option of each position scores best under
rules, one index per position: the heart of music21’sbestPitches. Combinations are tried in the orderitertools.productlists them, and the first strictly lowest wins. A position with no options leaves nothing to choose. - best_
spelling - The best spelling of
pitchesunderrules: music21’sEnharmonicSimplifier.bestPitches. Octaves move with a respelling, soB#3may come back asC4. - spelling_
options - Every spelling each pitch may take: itself first, then its common
enharmonics with at most one sharp or flat. music21’s
EnharmonicSimplifier.getRepresentations.