Expand description
Walter Hewlett’s base-40 pitch numbers: music21’s musedata.base40.
Base 40 numbers every pitch from a double flat to a double sharp on each of the seven letters, forty to the octave, leaving a number unused between two letters a whole step apart. Its gift is that the distance between two numbers names the interval between the pitches, spelling and all: 23 is always a perfect fifth.
use music21::musedata::base40;
assert_eq!(base40::pitch_name(186), Some("G"));
assert_eq!(base40::from_pitch_name("F##", 4), Some(142));
assert_eq!(base40::delta_to_interval(-52).unwrap().directed_name(), "M-10");Structs§
- Base40
Error - Why a base-40 question has no answer, in music21’s words: what music21
raises as
Base40Exception.
Enums§
- Direction
- The way an enharmonic is looked for: a diminished second up or down.
Constants§
- EQUIVALENTS
- music21’s
base40Equivalent: the pitch name each number of an octave stands for, from 1 to 40, and the empty name for the five unused. - INTERVALS
- music21’s
base40IntervalTable: the simple interval each distance within an octave is. A distance missing here is no interval base 40 can say.
Functions§
- actual_
interval - music21’s
base40ActualInterval: the interval between the pitches two base-40 numbers are, worked out from the pitches rather than read from the distance. - delta_
to_ interval - music21’s
base40DeltaToInterval: the interval a distance between two base-40 numbers is, its octaves counted and its direction kept. - equivalent
- The pitch name a number of the octave (1 to 40) stands for, the empty
name for one unused, and
Nonefor a number outside the octave. - from_
pitch - music21’s
pitchToBase40: a pitch’s base-40 number. - from_
pitch_ name - The base-40 number of a pitch name in an octave, as music21’s
pitchToBase40numbers it: octave 1’s C double flat is 1. - interval
- music21’s
base40Interval: the interval between two base-40 numbers, read from their distance alone. - octave_
and_ number - The octave and the number within it music21’s
base40ToPitchreads a base-40 number as. music21 divides with a float and lets the octave setter drop the fraction, so the octave is the quotient cut toward nought, and the number within it is what is left after that many octaves. - pitch_
name - The pitch name a base-40 number stands for, in whatever octave:
Nonefor one of the unused numbers. - quick_
enharmonic_ string - music21’s
quickEnharmonicString: the lower spellings, then the higher. - quick_
enharmonics - music21’s
_quickEnharmonicString: the other spellings of a pitch name one way, each a diminished second from the last, until a letter comes round again or base 40 runs out of names.double_accidentalsfalse leaves the double sharps and flats out. - representation
- music21’s
base40Representation: the number of the octave a pitch name is, for the thirty-five names base 40 has. - to_
pitch - music21’s
base40ToPitch: the pitch a base-40 number is.