# TOP tuning

In **TOP tuning**, the acronym TOP stands for both **T**enney **OP**timal and **T**empered **O**ctaves **P**lease. The latter refers to the fact that the optimal scaling is applied to all of the prime dimensions, including the octave 2/1. The TOP tuning concept was first suggested and named by Paul Erlich.

For any tuning T, we may define the absolute proportional error APE(T) of T as the supremum (maximum) of the absolute proportional errors of all q belonging to the domain of T. A TOP tuning for a regular temperament is a tuning supporting the temperament (i.e., one which sends commas of the temperament to 0) with minimal APE. This minimal proportional error is called the TOP error.

## Contents

## Proportional error

A *tuning* for a regular temperament is defined by a vector T in Tenney tuning space whose entries are the sizes of the intervals, in cents, which the n generators of the regular temperament (often the first n primes) are mapped to. T is denoted by a bra vector, and if M is a monzo then [math]\langle T | M \rangle[/math] is the size, in cents, of the interval defined by M in the tuning T. If k is the rational number which M represents, then we may also write this quantity as T(k).

For example, if M is [-4 4 -1⟩ then k = 81/80 (a syntonic comma). If T is ⟨1200 1900 2800] (a multiple of 12edo) then [math]\langle T | M \rangle[/math] = -4800 + 7600 - 2800 = 0. Thus, while cents(k) = 21.506290, T(k) = 0 (i.e., the tuning tempers away the syntonic comma).

Given a tuning T and any rational number q in the domain of T, the *signed error* of T on q is defined as Err(q) = T(q) - cents(q). The *absolute error* Arr(q) = |Err(q)| is the absolute value of the signed error.

The terms *proportional error* and *absolute proportional error* take into account the Benedetti height or Tenney height of q. If q is expressed as a fraction n/d in lowest terms, then Benedetti height is nd and the Tenney height is log₂(nd). The *proportional error* is defined as 0 when q equals 1 and otherwise PE(q) = Err(q)/cents(nd) = Err(q)/1200log₂(nd). The *absolute proportional error* is the absolute value of the proportional error. Note that the same logarithmic measure - cents, expressed as 1200log₂ - is being used in both numerator and denominator, so a logarithm with any other base would yield the same result. Thus, the definition is not in fact based on cents, which are used simply for convenience.

Note that 1200log₂(nd) may be regarded as the shortest possible distance traversed in harmonic space while realising the interval q as a sequence of elementary steps of the form 1:p, where the p are prime factors of q. Each such step traverses 1200log₂(p). Therefore, the rate at which error accumulates during this traversal is the total error divided by the total distance. The units of measure vanish.

These quantities are often collectively referred to as *Tenney-weighted error*.

## Maximal error semigroups

For a tuning T and absolute proportional error E = APE(T), consider the set S of all rational q>0 such that PE(q) = E. If a and b are elements of S, then PE(ab) = E. (In the product ab both errors and Tenney heights add; there can be no cancellation of prime factors since that would imply PE(ab) > E, contra hypothesis.) Hence S is a semigroup under multiplcation, with the structure of a finitely generated free abelian semigroup. A minimal set of generators consists of a finite set of primes or the inverses of primes, where one or the other is chosen so they are tuned sharply, which entails that PE(q)>0 in each case. This is the *sharp semigroup*; inverting the elements of S leads to a mirror image flat semigroup. This has the consequence that the tuning of S is defined entirely by the tuning of the primes in the sharp semigroup S or in the corresponding flat semigroup. From this we may conclude that E is the minimal weighted L-inf error and TOP tuning may also be defined as the minimal weighted L-inf error tuning.

For any regular temperament, we may define an *intrinsic prime* to be a prime dividing the numerator or denominator of some comma that vanishes in the temperament. If the set of intrinsic primes generates the group on which the temperament is defined, we may call the temperament an *intrinsic temperament*. If the temperament is defined on a group generated by primes, then a prime which is not intrinsic is *extrinsic*. Consider a TOP tuning of an intrinsic temperament. As with any regular temperament there is a group of commas, the kernel, of rank n-k, where n is the dimension of the temperament and k is the rank of the temperament; n-k is the corank of the temperament. Since the TOP tuning minimizes the maximum sharp error, the rank of the sharp semigroup needs to be as large as possible, and this rank is k+1. If the set of sharp semigroup generators is {s₀, s₁, ...,sₖ} then {PE(s₀) - PE(s₁), PE(s₀) - PE(x₂), ..., PE(s₀) - PE(sxₖ)} is a set of k linear equations, which added to the n-k linear equations denoting setting the tempered commas to zero, gives n equations in n unknowns; the most we can set. Hence an intrinsic temperament has a unique kernel of rank n-k and a unique TOP tuning sharp semigroup of rank k+1. Conversely, if we add to the set of n-k comma generators a subset of k+1 elements of the set of primes and inverted primes of the intrinsic temperament, where for each prime either the prime or the inverse prime is selected, but not both, we obtain a *potential TOP tuning* on solving the n equations in n unknowns consisting of the n-k kernel equations and the k equations {PE(s₀) - PE(s₁), PE(s₀) - PE(x₂), ..., PE(s₀) - PE(sxₖ)} . Since the set of potential TOP tunings is finite, one way of finding the (unique) TOP tuning is simply to check all of them.

## Finding the tuning

For a temperament with both intrinsic and extrinsic primes, we may find the set of TOP tunings by first computing the tuning of the intrinsic primes. Then if r is an extrinsic prime, the tuning may be anything in the range where APE(r) ≤ E. The limit of the Lp tuning as p tends to 1 and the centroid of the region of TOP tunings both lead to choosing the JI tuning for r. This produces the canonical TOP tuning, called TIPTOP. To find the TIPTOP tuning one method is to solve for all the potential TOP tunings of the intrinsic primes, find the tuning with least error, and then tune all the extrinsic primes purely. An alternative method is to first set up a linear programming problem; if T is a val with indeterminate coefficients T = <t₁ t₂ ... tₖ| then minimize E subject to nonnegativity and the linear constraints {tₙ/log₂(pₙ) - 1 ≤ E, 1 - tₙ/log₂(pₙ) ≤ E, <T|cₖ> = 0} where the pₙ are the primes of the temperament, and the cₖ are the commas. We then may replace the tuning of all of the extrinsic primes with the pure JI tuning to get TIPTOP.

We may solve the sharp semigroup equations exactly to obtain solutions in the transcendental extension Q(log₂(q₁), log₂(t₂), ..., log₂(qₖ)) where the qₙ are the intrinsic primes other than 2. For example, take 5-limit meantone. Since 2 and 5 divide 80 and 3 divides 81. this is an intrinsic temperament. Solving for the TOP tuning either by linear programing or checking all the potential TOP tunings, we find the sharp semigroup is generated by {2, 1/3, 5}. Solving the sharp semigroup equations gives us a TOP tuning T = <3q₃/log₂(6480) (8q₃ + 2q₃q₅)/log₂(6480) 8q₃q₅/log₂(6480)|. Here q₃ = log₂(3), q₅ = log₂(5), and the denominator can also be written 4 + 4q₃ + q₅. A more complex example including an extrinsic prime is 13-limit parahemif temperament. Setting D = 22 + q₁₁ + 5q₁₃, we have T = <(2q₁₁ +10q₁₃)/D (18q₁₁ + 2q₁₃)/D q₅ (102q₁₁ - 62q₁₃)/D 44q₁₁/D 44q₁₃/D|. Note that all the prime tunings except for that of 5 lie in the field Q(q₁₁, q₁₃), where 1/2, 11 and 13 generate the sharp semigroup; 5 is of course the extrinsic prime. The tuning of the other primes is the same as the tuning for hemif temperament, which has the same commas, generated by {144/143, 243/242, 364/363}, and the same sharp semigroup, but which tempers the 2.3.7.11.13 subgroup.

If we want a pure-octaves tuning, we may divide the TIPTOP tuning by the tuning of 2, giving what may be called the Pure Octaves TIPTOP tuning, or POTT. The POTT tuning is sometimes in the simple form of prime tunings which can be expressed by way of fractional monzos; for 5- and 7-limit meantone and 11-limit meanpop, we get the 1/4-comma tuning which is also the eigenmonzo 5 minimax tuning. For 7- and 11-limit pajara, we also get the eigenmonzo 5 tuning, with pure 5/4s, and for 13-limit POTT, we get the eigenmonzo 13 tuning. For 5-, 7-, 11-, and 13-limit myna, the POTT tuning is pure 3s. And so forth, for many other examples. The same thing can happen in higher ranks: 7-limit starling has the 3 and 7 eigenvalue tuning, and 11 and 13 limit thrush the 3 and 11 eighenvalue tuning, etc.

## TOP commas and TOP extensions

Suppose T is a TOP tuned temperament with i intrinsic primes, e extrinsic primes, and a sharp semigroup of rank k+1. Then the dimensionality of T is n = e+i; the corank (rank of the comma group) is i-k and so the rank of the temperament is n-(i-k) = e+k. If we move a prime from intrinsic to extrinsic, the rank is therefore increased by 1 and the corank decreased by 1, leaving the dimensionality the same. If νₚ is the valuation val from prime p, meaning all coefficients bu the one for p are zero and the p coefficient is 1, then this "moving" can be accomplished by adding νₚ, for some prime p which is intrinsic but not a prime or inverse prime of the sharp semigroup, as the bottom row of the val list (mapping matrix) for T, or equivalently wedging it with the wedgie for T. This process can continue until all intrinsic primes except those for the sharp semigroup are moved to extrinsic primes. In this case, i=k+1 so the corank is i-k = (k+1)-k = 1, and there is only one comma, defined as usual as a rational number number greater than one which is not a square, cube or other power, generating the kernel. Since either this comma or its inverse is a product in the sharp semigroup, its absolute proportional error is equal to APE(T). The result is that for any regular temperament, there is a unique comma of the temperament such that the absolute proportional error in any TOP tuning is equal to the maximal absolute proportional error for the temperament. This comma we may call the *TOP comma*. The TOP comma in a sense encapsulates the error of the temperament. Any TOP tuning of the temperament, including TIPTOP, is also a TOP tuning of the codimension one temperament defined by the TOP comma.

For example, in the 5 and 7 limits, the TOP comma for magic temperament is 3125/3072; in the 11-limit, [0 -11 15 0 -5⟩; in the 13 limit, [0 0 46 0 -19 -11⟩.

## TOP with "inconsistent" rational tuning extensions

It can sometimes be useful to look not just at "indirect" prime-based mappings, but also add extra "direct" mappings for important rationals -- deliberately inconsistent with the indirect ones -- for which the indirect mapping is subpar.

A good example of this is 16-EDO, in which 9/8 is mapped to 225 cents, while 3/2 is mapped to 675 cents. In this instance, the associated "2.3.5.9" sval would be ⟨16, 25, 37, 51], where it is seen that the mapping of 51 steps for 9 is "inconsistent" with the mapping of 25 steps for 3.

Note that there is no mapping for 3 which would map 9/1 to 51 steps, since 51 is an odd number, so it is useful to have both mappings: the regular 9/1, for use in chords such as the "Mavila" major 9 chord of 0-375-675-1050-1350, so that the 1350 cent 9/4 is a stack of two ~675 cent 3/2's, and the tempered 4:7:9 at 0-975-1425, which need not have any 3/2 at all.

It so happens that for some full prime-limit temperaments, the TOP tuning remains optimal even if we use "inconsistent" mappings for any composite rational - or even *every* rational - as long as we are willing to go with the restriction that such mappings only be used if they are tuned better than the regular consistent ones. We will call tuning maps that obey this restriction **admissible.**

As an example, if our tuning map has the "consistent" 9/8 tuned to 204, but where we have an extra "inconsistent" 9/8 mapping that is tuned to 230 cents - that would be an **inadmissible** tuning map, because we have added an extraneous extra 9/8 tuning that is worse than the original. In such situations we would throw away the extra inconsistent 9/8 entirely as it serves no purpose, and only use the consistent mapping.

Given this restriction, the proof is easy: for any rational number, any "inconsistent" tuning must have a weighted error that is no worse than the "consistent" tuning, which in turn is no worse than the worst weighted prime error. However, there is no such thing as an "inconsistent prime mapping" - the mapping of a prime must always be consistent with itself! As a result, the worst-weighted error of the entire temperament cannot be changed by improving the errors of individual composite rationals - it will always be found at the worst-weighted prime, which will never change in this way.

As a result, the tuning that minimizes the max Tenney-weighted error on the primes is the same tuning that minimizes the max Tenney-weighted error on all rationals, even if there exist rationals with extra inconsistent mappings that have better tunings than the consistent ones.

Note that the above proof is only for full-prime limits: for arbitrary subgroups, some care is needed to extend the above argument, as it is possible (for instance) to work in the 2.5.9 subgroup without mapping 3 at all. In this situation, it is no longer the case that we have an extra mapping for 9/1 that is "inconsistent" with the mapping for 3/1, because there is no mapping for 3/1 at all, so 9/1 needs to be treated as thought it were a "prime." While a more thorough treatment of inconsistent mappings on arbitrary subgroups is needed, it is easy to see that for subgroups with a basis consisting only of prime powers, the same argument is easily shown to hold, with the worst weighted error being found at a prime power rather than a prime.

Most importantly, the above result holds without any hitches for prime-limit subgroups as the limit tends to infinity, and in particular for infinite-limit generalized patent vals, where the TOP tuning minimizes the error on all rationals regardless of whether those rationals are mapped "consistently" given the mapping on the primes, or "inconsistently" given their direct rounding to the nearest EDO-step.