Difference between revisions of "Base 40"
Line 237:  Line 237:  
* http://extra.humdrum.org/man/notearray/#base40  * http://extra.humdrum.org/man/notearray/#base40  
* http://extra.humdrum.org/man/transpose  * http://extra.humdrum.org/man/transpose  
+  * A generalized version of base40 is implemented in C++ for the [http://www.verovio.org verovio] Transposer class: [https://github.com/rismch/verovio/blob/developtranspose/src/transposition.cpp transpose.cpp], [https://github.com/rismch/verovio/blob/developtranspose/include/vrv/transposition.h transpose.h].  
=Exercises=  =Exercises=  
[[image:base40exercise.svg700pxcenter]]  [[image:base40exercise.svg700pxcenter]] 
Latest revision as of 23:54, 24 December 2019
The base40 system represents pitches as integers, and it is a method of representing pitch that allows intervals to be calculated as the difference between any two pitch integers. It can be used to encoding diatonic pitches names with chromatic alterations up to double sharps or flats. In particular, this allows a simple algorithm to transpose music by adding a transposition interval to the starting pitches to calculate the transposed pitch.
The base40 pitch space can be built up from the property that a minor second is a difference of 5 between two pitch numbers, and major seconds are a difference of 6. The C chroma value is set to the value 2 rather than 0 so that the octave values for C♭ and C♭♭ remain in the same octave as C♮ just above these pitches when using division by the base to extract the octave number. Here is a complete table of the base40 chroma, placing C pitch classes at position 2:







The "base40" name for the system refers to the property that an octave is represented by the integer 40. C4 is 162 while C5 is 162+40=202. To extract the octave number from a pitch value, just divide by 40. To extract the chroma from the pitch value, subtract the octave times 40.
octave = value / 40 chroma = value  octave * 40
To calculate an absolute pitch such as G4 (The G above middle C), multiply the octave by 40 and add the chroma value for the G pitchclass:
pitch = octave * 40 + chroma G4 = 4 * 40 + 25 = 160 + 25 = 185
Alternatively, G4 can be calculated by adding 3 halfsteps (major seconds) and one minor second to C4 (represented as the number 162 in base40):
G4 = C4 + 3 * M2 + m2 = 162 + 3 * 6 + 5 = 162 + 23 = 185
Note that base40 pitch representations preserve chromatic alterations of diatonic pitchclasses (up to double sharps/flats). Therefore F♯4 (180) is not in the same as the base40 pitch G♭4 (184).
Intervals
A useful property of the base40 system is that the difference between pitch numbers in the base40 system represent onetoone mappings with diatonic intervals with chromatic alterations:







As an example, consider the interval between E4 (174) and C4 (162) which is 174162 = 12, representing a major third according to the table shown above. All intervals can be constructed by observing that major seconds are 6 and minor seconds are 5, so note that a major third, consisting of two major seconds, is 6 + 6 = 12. Below is an example segment of music with the pitches labeled in the base40 system. Try subtracting values and comparing the results to numbers in the base40 intervalclass table above.
Transposition
Transposition of notes within the base40 system is simple: just add a constant interval to the base40 pitch numbers. Below is an example that transposes the music up a major second. In the base40 system, a major second is represented by the integer 6, so add 6 to all of the pitch numbers in the original music to transpose them up a major second.
Generalization
There are other higherorder bases that can be used to handle accidentals beyond double sharps and flats. Here is the equation to calculate the base according to the maximum number of sharp/flats on a note:
base = 7 * (2 * max + 1) + 5
For example, when max=2, then base=40. When max=3, then base=54. Another convent base is when max=42 and base=600.
References
 A Base40 Numberline Representation of Musical Pitch Notation, Walter Hewlet, Musikometrika 4 (1992), 114.
 http://extra.humdrum.org/man/notearray/#base40
 http://extra.humdrum.org/man/transpose
 A generalized version of base40 is implemented in C++ for the verovio Transposer class: transpose.cpp, transpose.h.