Difference between revisions of "Base 40"
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
− | The base-40 system | + | |
+ | The base-40 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 base-40 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 base-40 chroma, placing C pitch classes at position 2: | ||
Line 233: | 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 base-40 is implemented in C++ for the [http://www.verovio.org verovio] Transposer class: [https://github.com/rism-ch/verovio/blob/develop-transpose/src/transposition.cpp transpose.cpp], [https://github.com/rism-ch/verovio/blob/develop-transpose/include/vrv/transposition.h transpose.h]. | ||
=Exercises= | =Exercises= | ||
[[image:base40exercise.svg|700px|center]] | [[image:base40exercise.svg|700px|center]] |
Latest revision as of 23:54, 24 December 2019
The base-40 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 base-40 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 base-40 chroma, placing C pitch classes at position 2:
|
|
|
|
|
|
|
The "base-40" 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 pitch-class:
pitch = octave * 40 + chroma G4 = 4 * 40 + 25 = 160 + 25 = 185
Alternatively, G4 can be calculated by adding 3 half-steps (major seconds) and one minor second to C4 (represented as the number 162 in base-40):
G4 = C4 + 3 * M2 + m2 = 162 + 3 * 6 + 5 = 162 + 23 = 185
Note that base-40 pitch representations preserve chromatic alterations of diatonic pitch-classes (up to double sharps/flats). Therefore F♯4 (180) is not in the same as the base-40 pitch G♭4 (184).
Intervals
A useful property of the base-40 system is that the difference between pitch numbers in the base-40 system represent one-to-one mappings with diatonic intervals with chromatic alterations:
|
|
|
|
|
|
|
As an example, consider the interval between E4 (174) and C4 (162) which is 174-162 = 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 base-40 system. Try subtracting values and comparing the results to numbers in the base-40 interval-class table above.
Transposition
Transposition of notes within the base-40 system is simple: just add a constant interval to the base-40 pitch numbers. Below is an example that transposes the music up a major second. In the base-40 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 higher-order 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 Base-40 Number-line Representation of Musical Pitch Notation, Walter Hewlet, Musikometrika 4 (1992), 1-14.
- http://extra.humdrum.org/man/notearray/#base40
- http://extra.humdrum.org/man/transpose
- A generalized version of base-40 is implemented in C++ for the verovio Transposer class: transpose.cpp, transpose.h.