Skip to main content

Module pitch

Module pitch 

Source
Expand description

Pitch construction, spelling and pitch-space helpers.

Structs§

Accidental
Symbolic and numerical accidental information for a pitch.
AccidentalDisplayOptions
The context music21’s updateAccidentalDisplay reads: the pitches that came before, in this measure and the previous one, the other pitches sounding at the same time, the key signature’s altered pitches, and the cautionary-accidental switches, with music21’s defaults.
Microtone
A microtonal pitch adjustment measured in cents, optionally shifted by a harmonic like Python music21’s music21.pitch.Microtone.
Pitch
A musical pitch with spelling, octave, accidental and optional microtone.
PitchClass
A normalized pitch-class value.
PitchOptions
Builder options for constructing a Pitch.

Enums§

AccidentalAttribute
One part of an Accidental, for Accidental::set_attribute_independently. music21 names the part with a string and raises on any other name; here the three writable parts are the only ones that can be spelled.
AccidentalSpecifier
Input accepted by Accidental::new and Accidental::set.
MicrotoneSpecifier
Input accepted by Microtone::new and Microtone::with_harmonic_shift.
PitchClassSpecifier
Input accepted by PitchClass::new and pitch-class builders.
PitchName
Input accepted as a pitch name or pitch-space number.

Constants§

CHROMATIC_PITCH_CLASS_NAMES
Canonical pitch names for chromatic pitch classes.

Functions§

convert_pitch_class_to_str
music21’s convertPitchClassToStr: an integer pitch class as one character, A for ten and B for eleven, reduced modulo twelve first.
dissonance_score
How awkward a set of pitches reads together: music21’s _dissonanceScore with all three of its terms on. It averages a penalty for accidentals beyond one sharp or flat, a penalty growing with the denominator of each pair’s Pythagorean ratio, and a reward for every third and sixth, so that C E G scores below C F- G.
pitch_class_name
Returns a canonical pitch name for a chromatic pitch class.
simplify_multiple_enharmonics
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.

Type Aliases§

CriterionFunction
A scoring function for simplify_multiple_enharmonics: lower is a simpler spelling.