Musical temperament has a long history stretching back to the "meantone" system of the Renaissance and Baroque eras, along with the 12-note equal temperament documented in both Chinese and European history. Late in the 20th century, a new way of thinking about musical temperament was discovered, based on the writings and discussions of musicians and mathematicians such as Graham Breed, Paul Erlich, Dave Keenan, Joe Monzo, Gene Ward Smith, Erv Wilson, and many others. Although some of the mathematical ideas involved may at first seem too abstract and theoretical to be of much use, the results of this method can reduce the bewildering array of possible microtonal scales to a more manageable set of neat and orderly tuning systems.

By definition, a temperament is a system of altering (or "tempering") the size of musical intervals, resulting in a deviation away from the pure rational intervals of just intonation. In a tuning based on a *regular* temperament, each interval of just intonation (or "JI" as it is commonly abbreviated) is altered by the same amount wherever it appears. Such a tuning can be represented as a series of numbers which approximate each of the prime factors of an interval (2, 3, 5, 7, and so on). The approximation of any rational interval can be calculated by combining the approximations of the prime factors (which are typically specified in cents). For instance, quarter-comma meantone is a regular tuning which can be represented with a vector of approximated prime intervals: <1200.00, 1896.58, 2786.31]. This notation specifies that the prime factor 2 is approximated by 1200.00 cents (which happens to be an exact octave), 3 is approximated by 1896.58 cents (which is a quarter comma flat from the just tuning of 1901.96 cents), and 5 is approximated by 2786.31 cents (the same as the just interval 5:1). If you want to calculate the size of the quarter-comma meantone approximation to another interval, such as 9:5, all you need to do is factor the interval and add or subtract the prime approximations: 9:5 works out to 3^{2} · 5^{-1}, so take 2 times the approximation of 3 and subtract the approximation of 5. The result is (1896.58 · 2) - 2786.31, or around 1006.84 cents.

Other meantone tunings have different tuning maps. For example, 1/5-comma meantone (common in the Baroque era) can be represented with the vector <1200.00, 1897.65, 2790.61]. Here, both the 3:1 and 5:1 are approximated by tempered intervals; the 3:1 is 1/5 of a comma flat, and the 5:1 is 1/5 of a comma sharp. The octave also may be tempered; a variety of meantone which is called TOP meantone has the mapping <1201.70, 1899.26, 2790.26]. The one thing these meantone tunings have in common is that they all *temper out* (reduce to unison) the syntonic comma, 81:80 (2^{-4} · 3^{4} · 5^{-1}). In other words, these tunings are all instances of what we can describe as a regular system of *meantone temperament*.

One way to think about a regular temperament is as a system of tuning that tempers out one or more commas. A convenient way to refer to a comma, or any rational interval, is as a vector of prime factor exponents. In this notation, 81:80 would be written as [-4, 4, -1>. If you multiply each element of the tuning vector by the corresponding element of the comma vector, and add the results, the result will be zero (allowing for roundoff error).

An alternative way to think of a regular temperament, which may be more useful for constructing musical scales, is to represent each note of the temperament as a combination of one or more multiples of a *generator* (a repeated interval of the temperament, from which all the notes of the temperament can be derived). Equal temperaments have a single generator, the size of a single step of the temperament. The vector notation is also used for this kind of mapping. For example, the usual 5-limit interpretation of 12-note equal temperament (12-ET), the "nearest prime mapping" as it is called, can be represented as <12, 19, 28], where 12 is the number of steps to approximate 2:1, 19 is the number of steps to approximate 3:1, and 28 is the number of steps to approximate 5:1. Note the direction of the brackets (the opposite of the notation for prime exponent vectors as shown above). The corresponding mapping for 19-ET is <19, 30, 44]. These are referred to as "rank one" temperaments because they are built from a single size of interval. Temperaments such as meantone, on the other hand, are "rank two" temperaments, which are built from two different sizes of interval. Traditionally, one of these (called the period) is an octave or a fraction of an octave, and the other (called the generator) is an interval smaller than the period. In the case of meantone, where the generator can be defined as the meantone approximation of a perfect fourth (4:3), this results in the mapping <1, 2, 4] for the octave and <0, -1, -4] for the fourth. This means that an approximate 2:1 interval is just an octave, an approximate 3:1 is 2 octaves up and 1 fourth down, and an approximate 5:1 is 4 octaves up and 4 fourths down.

Although these two representations of a temperament may seem to be unrelated, there is actually an interesting connection between the two that also provides a convenient label for identifying a temperament. The mappings <1, 2, 4] and <0, -1, -4] (in the case of this particular mapping of meantone temperament) can be combined by a mathematical operation called a "wedge product", then normalized by factoring out the greatest common divisor, resulting in a *wedgie* (short for "wedge invariant"). The wedgie formed by wedging these meantone vectors (or any pair of vectors that represents a meantone temperament mapping) is <<1, 4, 4]]. The notation for this kind of wedgie has two sets of brackets, representing a combination of two generator mappings. It is apparent that this <<1, 4, 4]] is related to the prime exponent vector notation of the meantone comma 81:80, which is [-4, 4, -1>. In fact, any 5-limit comma can be converted to a wedgie by reversing it and flipping the sign on the middle number (this operation is called taking the *complement*), and then normalizing. The wedgie turns out to be useful in other ways, but for now the thing to remember is that this sequence of numbers uniquely identifies this particular temperament. You get the same result from any pair of generator mappings that tempers out 81:80.

It can also be useful to take the wedge product of two commas, resulting in a "bicomma". For example, take the commas 81:80 and 128:125, notated as prime exponent vectors: [-4, 4, -1> and [7, 0, -3>. Taking the wedge product gives the result [[-28, 19, -12>>. The normalized complement of this bicomma is the mapping <12, 19, 28], which is the mapping for 12-note equal temperament (12-ET), as mentioned above. Similarly, wedging [-4, 4, -1> with [-10, -1, 5> (3125:3072, the "magic comma") results in [[44, -30, 19>>, which is the complement of the mapping for 19-ET.

The wedge product is more thoroughly explained on Gene Ward Smith's page The Wedge Product, but that explanation is more general than what we really need most of the time. In many of the typical cases that are useful for temperament theory, calculating wedge products is actually not very difficult. Here is an example in the C programming language for wedging two mappings of the same size (mapsize), placing the result in the "wedgie" array.

wedgiesize = 0; for (i = 0; i < mapsize - 1; i++) { for (j = i + 1; j < mapsize; j++) { wedgie[wedgiesize] = map1[i] * map2[j] - map2[i] * map1[j]; wedgiesize++; } }

The system of meantone temperament has historically been associated with the diatonic and pentatonic scales. In fact, the standard system of musical notation, with notes A - G, modified by sharps and flats, makes the most sense when interpreted in terms of meantone temperament. In meantone, G♯ is a major third above E, and A♭ is a major third below C; these notations represent the same pitch in 12-note equal temperament, but they are distinct in meantone tuning. Although standard notation is based on the 7-note diatonic scale, it would also be possible to use a 5-note pentatonic scale or a 12-note chromatic scale to notate meantone. If we omit the notes B and F, we could notate a chain of fourths as E♭ A♭ D♭ G♭ C♭ E A D G C E♯ A♯ D♯ G♯ C♯ (keeping in mind that the "sharps" and "flats" would mean something different in this notation, compared with standard notation). The thing that is special about the 5, 7, and 12-note meantone scales is that they have exactly two sizes of steps; in fact, two sizes of every interval smaller than an octave. Scales with this property are called "distributionally even"; related terms include "moments of symmetry" (MOS) and "Myhill's property". Distributionally even (or DE) scales are as significant in working with rank-two regular temperaments as periodicity blocks are to just intonation. In fact, these two concepts are related; if you "detemper" a DE scale (replacing each note with one of the JI pitches that it approximates), you end up with a periodicity block. For this reason, it can be useful to study temperaments even if your eventual goal is to use JI, in order to find convenient periodicity blocks.

Temperaments with 7-limit approximations typically have four elements in their generator mappings and prime exponent vectors, representing the prime factors 2, 3, 5, and 7. (There are a few which omit one of these factors, such as tempered versions of the Bohlen-Pierce scale, which has no octaves and omits prime factor 2.) Wedgies are convenient for representing 7-limit temperaments of rank two; bicommas can also be used, but the 2-mapping wedgie form is most typically seen. Meantone again provides a convenient example; the most common 7-limit extension of meantone has the generator mapping <1, 2, 4, 7] (periods), <0, -1, -4, -10] (generators). (In standard notation, this means that the seventh harmonic is approximated by an augmented sixth; a 4:5:6:7 tetrad on C would be written C E G A♯.) Wedging these gives a result with 6 elements: <<1, 4, 10, 4, 13, 12]]. It may be helpful for understanding to arrange these numbers in a triangular form:

(3) (5) (7) (2) 1 4 10 (3) 4 13 (5) 12

Each number in a wedgie formed from two mappings corresponds with a combination of two prime factors: the first one is a combination of 2 and 3, the second one a combination of 2 and 5, and so on. Since the elements of a wedgie are derived from the generator mapping, it is possible to go the other way and derive a generator mapping from a wedgie. These and other more advanced operations will be explained later. Keep in mind that you can also wedge two 7-limit commas; since 7-limit temperaments have one more dimension than 5-limit temperaments, the result in this case is also a rank two temperament. For instance, wedging the two 7-limit meantone commas [-5, 2, 2, -1> (225/224) and [1, 2, -3, 1> (126/125) results in this bicomma: [[-12, 13, -4, -10, 4, -1>>. As you might have guessed, you can go from the bicomma to the 2-mapping wedgie by taking the complement, which in this case involves reversing the order of the elements and negating the second and fifth elements, and then normalizing. Since temperaments are occasionally seen in this bicomma form, it can be useful to know how to convert between the two representations.

With 7-limit regular temperaments, for the first time there is a possibility of deriving a temperament from three independent generators. An example of such a temperament is "starling temperament", which can be defined using generators of a minor third, a major third, and an octave to approximate 7-limit intervals, tempering out the comma 126/125. One specific tuning of starling temperament, TOP starling, approximates the primes as <1199.01, 1900.39, 2788.61, 3366.05]. It should be possible to represent this temperament by wedging the three vectors in the generator mapping (and in fact it is). Here, 7/1 is approximated as 125/18.

<1, 1, 2, 3] (octaves) <0, 1, 1, 1] (major thirds) <0, 1, 0, -2] (minor thirds) result: <<<1, 3, 2, -1]]]

However, it is more usual to simply refer to a rank three 7-limit temperament by the comma that it tempers out (in this case, 126/125 or [1, 2, -3, 1>).