Tenney–Euclidean tuning: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Wikispaces>genewardsmith
**Imported revision 511016766 - Original comment: **
+ actually needed contents
 
(60 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<h2>IMPORTED REVISION FROM WIKISPACES</h2>
'''Tenney–Euclidean tuning''' ('''TE tuning'''), also known as '''TOP–RMS tuning''', is a tuning technique for regular temperaments which leads to the least sum of squared errors of the Tenney-weighted basis.  
This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br>
: This revision was by author [[User:genewardsmith|genewardsmith]] and made on <tt>2014-05-24 17:11:18 UTC</tt>.<br>
: The original revision id was <tt>511016766</tt>.<br>
: The revision comment was: <tt></tt><br>
The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br>
<h4>Original Wikitext content:</h4>
<div style="width:100%; max-height:400pt; overflow:auto; background-color:#f8f9fa; border: 1px solid #eaecf0; padding:0em"><pre style="margin:0px;border:none;background:none;word-wrap:break-word;white-space: pre-wrap ! important" class="old-revision-html">[[toc|flat]]


[[image:mathhazard.jpg align="left"]]
If we have ''r'' linearly independent [[Vals and tuning space|vals]] of dimension ''n'', they will span a subspace of [[Vals and tuning space|tuning space]]. This subspace defines a regular temperament of rank ''r'' in the prime limit ''p'', where ''p'' is the ''n''-th prime. Similarly, starting from {{nowrap|''n'' − ''r''}} independent commas for the same regular temperament, the corresponding monzos span an {{nowrap|''n'' − ''r''}} dimensional subspace of [[monzos and interval space|interval space]]. Both the subspace of tuning space and the subspace of interval space characterize the temperament completely. A question then arises as to how to choose a specific tuning for this temperament, which is the same as asking how to choose a point (vector) in this subspace of tuning space which provides a good tuning. One answer to this is the weighted RMS ({{w|root mean square|root-mean-squared}}) tuning discussed right here.
----


Tenney-Euclidean tuning is a variant of [[TOP tuning]] which employs the [[Tenney-Euclidean metrics|TE norm]]. While there are theoretical arguments favoring TOP, the advantages of using a Euclidean norm provides a powerful argument in favor of TE tuning.
TE tuning can be viewed as a variant of [[TOP tuning]] since it employs the [[Tenney–Euclidean metrics #TE norm|TE norm]] in place of the [[Tenney height]] as in TOP tuning. Just as TOP tuning minimizes the maximum Tenney-weighted ''L''<sub>1</sub> error of any interval, TE tuning minimizes the maximum Tenney-weighted ''L''<sub>2</sub> error of any interval.


Just as the TOP tuning minimizes the maximum Tenney-weighted (L1) error of any interval, the TE tuning minimizes the maximum TE-weighted error of any interval.
In [[D&D's guide]], the systematic name for TE tuning is ''minimax-ES''.


=Temperaments=  
== Motivation ==
If we have k linearly independent [[Vals and Tuning Space|vals]] of dimension n, they will span a subspace of [[Vals and Tuning Space|tuning space]]. This subspace defines a regular temperament of rank k in the prime limit p, where p is the nth prime. Similarly, starting from n-k independent commas for the same regular temperament, the corresponding monzos span an n-k dimensional subspace of [[Monzos and Interval Space|interval space]]. Both the subspace of tuning space and the subspace of interval space characterize the temperament completely.
TE tuning combines the ideas of Tenney weighting of prime limits and optimizing the root mean square (RMS) of weighted error/damage.  Prime limits are a way of choosing musically useful intervals without being too specific about which intervals you think are useful. Tenney weighting is a way of giving equal treatment to intervals of equal complexity without choosing a finite set of intervals. RMS optimization (least squares) implies optimizing for the average sensory dissonance of an interval, and so allows for good consonances to balance weak dissonances and well tuned intervals to balance poorly tuned intervals.


A question then arises as to how to choose a specific tuning for this temperament, which is the same as asking how to choose a point (vector) in this subspace of tuning space which provides a good tuning. One answer to this is RMS tuning.
TE shares with TOP tuning the insight that adding octaves to the optimization simplifies the calculation.  Allowing for scale stretch balances intervals of different sizes.


=TE tuning=
As an RMS measure, TE error is optimized by the least squares method, which is well known and simple and efficient to calculate.
If we put the (weighted) Euclidean metric on tuning space, leading to TE tuning space in weighted coordinates, it is easy to find the nearest point in the subspace to the JI point &lt;1 1 ... 1|, and this closest point will define a tuning map which is called TE tuning (or TOP-RMS), a tuning which has been extensively studied by [[Graham Breed]]. We may also keep unweighted coordinates and use the TE norm on tuning space; in these coordinates the JI point is &lt;1 log2(3) ... log2(p)|. The two approaches are equivalent.


One way to find this tuning is to use k parameters times the vals, leading to a parametrization of the subspace, and then to find the nearest point by least squares, differentiating the square of the distance to the JI point and solving the resulting linear equations. Another is to use the [[http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse|Moore-Penrose pseudoinverse]].
TE tuning is uniquely optimized for a given prime limit.  There are no free parameters determining the weighting of different intervals or the balance of wide and narrow intervals: all follow from the definition of Tenney weighting of primes.


=The pseudoinverse=  
== Definition ==
If A is an m×n matrix with real entries, and if we denote the pseudoinverse by A`, then it is defined as the n×m matrix such that
If we put the weighted Euclidean metric on tuning space, leading to TE tuning space in weighted coordinates, it is easy to find the nearest point in the subspace to the [[JIP]] {{val| 1 1 … 1 }}, and this closest point will define a [[tuning map]] which is called TE tuning, a tuning which has been extensively studied by [[Graham Breed]]. We may also keep unweighted coordinates and use the TE norm on tuning space; in these coordinates the JI point is {{val| 1 log<sub>2</sub>3 … log<sub>2</sub>''p'' }}. The two approaches are equivalent.
# AA`A = A. Hence, AA` maps the rows of A to itself and A`A the columns of A to itself.
# A`AA` = A
# A`A and AA` are symmetric matrices


From these properties it can be deduced that
To start with, suppose ''W'' is the weighting matrix. For the prime basis ''Q'' = {{val| 2 3 5 … ''p'' }},  
* If A is invertible, its inverse is A`
* If A has rational entries, so does A`
* A`` = A
* The pseudoinverse of the transpose is the transpose of the pseudoinverse
* AA` is the orthogonal projection map onto the space spanned by the columns of A
* A`A is the orthogonal projection map onto the space spanned by the rows of A
* I - A`A, where I is the identity matrix, is the orthogonal projection map onto the kernel, or null space, of A
* If the rows of A are linearly independent, then A` = A*(AA*)^(-1), where A* is the transpose of A. This means the pseudoinverse can be found in this important special case by people who don't have a pseudoinverse routine available by using a matrix inverse routine.
* uA` is the nearest point to u in the subspace spanned by the rows of A; A`v is the nearest point to v in the space spanned by the columns of A.


=Computing TE tuning using pseudoinverses=
$$ W = \operatorname {diag} (1/\log_2 (Q)) $$
Suppose V is a matrix whose rows consist of vals in the weighted basis. No assumption need be made that the rows are linearly independent or that the vals are free of [Saturation|contorsion]. If J is the JI point, &lt;1 1 ... 1|, then JV` gives the TE tuning in the sense that it gives (not necessarily independent) generators which correspond to the rows of V. How many of each generator to take to map a rational number contained in the prime limit in question is determined by applying the val corresponding to the generator to the rational number.


We may also obtain the TE tuning from a projection map. P = V`V is the orthogonal projection map onto the space spanned by the rows of V. This space corresponds to the temperament, and so does P. However, P is independent of how the temperament is defined; it does not depend on whether the vals are linearly independent, how many of them there are, or whether contorsion has been removed. The tuning map giving the tuning of each prime number is found by multiplying by the JI map: JP where J is the JI map, which is the nearest point in the subspace corresponding to the temperament to J.
If ''V'' is the mapping of the [[regular temperament|abstract temperament]] whose rows are (not necessarily independent) vals, then {{nowrap| ''V<sub>W</sub>'' {{=}} ''VW'' }} is the mapping in the weighted space. If ''J'' is the row vector of targeted JI intervals (i.e. the [[JIP]]), then {{nowrap| ''J<sub>W</sub>'' {{=}} ''JW'' }} is the JI intervals in the weighted space, in the case of Tenney-weighting it is {{val| 1 1 … 1 }}. Let us also denote the row vector of TE generators ''G''. TE tuning then defines a {{w|least squares}} problem of the following overdetermined {{w|system of linear equations}}: ''GV''<sub>''W''</sub> = ''J''<sub>''W''</sub>, which simply says that the sum of (''v''<sub>''w''</sub>)<sub>''kl''</sub> steps of generator ''g''<sub>''k''</sub> for all ''k'''s should equal the ''l''-th targeted JI interval (''j''<sub>''w''</sub>)<sub>''l''</sub>. That is to say we want to


We may find the same projection map starting from a list of weighted monzos rather than vals. If M is a rank n matrix whose rows are weighted monzos, and I is the nxn identity matrix, then P = I - M`M is the same projection map as V`V so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are.
$$
\begin{align}
& \text{find} && G \\
& \text{that minimizes} && \lVert GV_W - J_W \rVert_2
\end{align}
$$


=Pure octaves TE tuning=
There are a number of methods to solve least squares problems. One common way is to use the [[Moore–Penrose pseudoinverse]].
(alias **[[POTE tuning]]**)
If T = JP is the TE tuning map, then a corresponding pure-octaves map can be found by [[http://en.wikipedia.org/wiki/Scalar_multiplication|scalar multiplication]], T/T[1], where T[1], the first entry, is the tuning of 2. The justification for this is that T does not only define a point, but a line through the origin lying in the subspace defining the temperament, or in other words, a point in the linear subspace of projective space corresponding to the temperament, and hence is a projective object. Another way to say this is that T defines not only the closest point to J, but the closest direction in terms of angular measure between the line through T and the line through J. We may call pure-octaves Tenney-Euclidean tuning the [[POTE tuning]].


=The Frobenius projection map=  
== Computation ==
We may also do the same things starting from unweighted vals. This leads to a different tuning, the [[Fractional monzos|Frobenius tuning]], which is perfectly functional but has less theoretical justification than TE tuning. However, if greater weight needs to be attached to the larger primes than TE tuning attaches, Frobenius tuning may be preferred; people who feel that larger primes require more tuning care than smaller ones may well prefer it. However the main value of unweighted vals is that the pseudoinverse and projection map have rational entries, so that the rows of the matrix are [[Fractional monzos|fractional monzos]]. The Frobenius projection map therefore, like the [[Wedgies and Multivals|wedgie]], defines a completely canonical object not depending on any arbitrary definition (eg how Hermite normal form or LLL reduction is specifically defined) which corresponds 1-1 with temperaments, and which does not depend on whether the monzos or vals from which it is computed are [[Saturation|saturated]]. It may be found starting either from a set of vals or a set of commas, since if Q is the projection map found by treating monzos in the same way as vals, P = I-Q is the same projection map as would be found if starting from a set of vals defining the same temperament.
=== Using pseudoinverse ===
The Moore–Penrose pseudoinverse, denoted ''A''{{+}}, is a generalization of the inverse matrix with which it shares a lot of properties. In this method, the (not necessarily independent) TE generator map ''G'', which correspond to the rows of ''V'' are given by


Spelling this out, if V is a matrix whose rows are vals, then P = V`V is a [[http://en.wikipedia.org/wiki/Positive-definite_matrix|positive-semidefinite]] [[http://en.wikipedia.org/wiki/Symmetric_matrix|symmetric matrix]] with rational matrix entries, which exactly specifies the regular temperament defined by the vals of V. If M is a matrix with rows of monzos which spans the subspace of interval space containing the commas, then this same matrix P is given by I - M`M.
$$ G = J_W V_W^+ $$


If the vals defining V are linearly independent, then P = V*(VV*)^(-1)V. If the rows of M are independent, then we likewise have P = I - M*(MM*)^(-1)M.
Applying the val list to the generators, The TE tuning map is given by


=Examples=  
$$ T = GV = J_W V_W^+ V $$
The val for 5-limit 12et is &lt;12 19 28|. In weighted coordinates, that becomes v12 = &lt;12 19/log2(3) 28/log2(5)| ~ &lt;12.0 11.988 12.059|. If we take this to be a 1x3 matrix and take the pseudoinverse, we get the 3x1 matrix v12` ~ [|0.027706 0.027677 0.027842&gt;]. Then P = v12`v12 is a projection map onto the one-dimensional subspace whose single basis vector is v12. We find that v12P equals v12; on the other hand, if we take the monzo for 81/80, which is |-4 4 -1&gt; and monzo-weight it to &lt;-4 4log2(3) - log2(5)| and multiply (either side, the matrix is symmetric) by P, we get the zero vector, corresponding to the unison.


Now consider [[Diaschismic family|pajara]], the 7-limit temperament tempering out both 50/49 and 64/63. Two possible equal temperament tunings for pajara are [[12edo]] and [[22edo]]. We may define a 2x4 matrix with rows equal to the vals for 12, and 22; in weighted coordinates this would be
We may also obtain the TE tuning from a [[projection matrix]]. {{nowrap| ''P''<sub>''W''</sub> {{=}} {{subsup|''V''|''W''|+}}''V''<sub>''W''</sub> }} is the orthogonal projection matrix that maps onto the space spanned by the rows of ''V''<sub>''W''</sub>. This space corresponds to the temperament, and so does ''P''<sub>''W''</sub>. However, ''P''<sub>''W''</sub> is independent of how the temperament is defined; it does not depend on whether the vals are linearly independent, how many of them there are, or whether [[contorsion]] has been removed. The weighted tuning map ''T''<sub>''W''</sub> = ''TW'' giving the weighted tuning of each prime number is found by multiplying by the JIP: {{nowrap| ''T''<sub>''W''</sub> {{=}} ''J''<sub>''W''</sub>''P''<sub>''W''</sub> {{=}} ''J''<sub>''W''</sub>{{subsup|''V''|''W''|+}}''V''<sub>''W''</sub> }}, which is the nearest point in the subspace corresponding to the temperament to ''J''<sub>''W''</sub>, so that {{nowrap| ''T'' {{=}} ''J''<sub>''W''</sub>''P''<sub>''W''</sub>''W''{{inv}} {{=}} ''J''<sub>''W''</sub>{{subsup|''V''|''W''|+}}''V'' }}.


V ~ [&lt;12 11.988 12.059 12.111|, &lt;22 22.083 21.965 22.085|]
We may find the same projection matrix starting from a list of weighted monzos rather than vals. If ''M''<sub>''W''</sub> is a rank-''n'' matrix whose columns are weighted monzos, and ''I'' is the ''n''×''n'' identity matrix, then {{nowrap| ''P''<sub>''W''</sub> {{=}} ''I'' − ''M''<sub>''W''</sub>{{subsup|''M''|''W''|+}} }} is the same projection matrix as {{subsup|''V''|''W''|+}}''V''<sub>''W''</sub> so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are.


Then the pseudoinverse V` is approximately
=== Computer program ===
Here is a minimalistic [https://www.python.org/ Python] script that takes a mapping and gives TE generators and tuning maps, using [https://scipy.org/ Scipy].


[-1.81029 1.00052]
<syntaxhighlight lang="python">
[-6.68250 3.66285]
import numpy as np
[4.83496 -2.63063]
from scipy import linalg
[3.67652 -1.99757]


which we may also write as [|-1.81029 -6.68250 4.83496 3.6765175829982166001&gt;,
def te (mapping, subgroup_basis):
|1.00052 3.66285 -2.63063 -1.99757&gt;]
    just_tuning_map = 1200*np.log2 (subgroup_basis)
    te_weight = np.diag (1/np.log2 (subgroup_basis))
    mapping_w = mapping @ te_weight
    just_tuning_map_w = just_tuning_map @ te_weight


Paj = V`V is a 4x4 symmetrical matrix which projects weighted vals in TE tuning space, or weighted monzos in TE interval space, to a subspace defined by pajara. It therefore projects the weighted monzos for 50/49, 64/63, 225/224, 2048/2025 and etc to the zero vector, whereas it leaves pajara vals such as [[10edo]] in weighted coordinates unchanged.
    te_generators = linalg.lstsq (np.transpose (mapping_w), just_tuning_map_w)[0]
    te_tuning_map = te_generators @ mapping
    return te_generators, te_tuning_map
</syntaxhighlight>


If we use unweighted coordinates we get the Frobenius projection map instead, whose rows are [[fractional monzos]]. The unweighted pseudoinverse u12` of the 5-limit val u12 for 12 equal is the column matrix u12*/1289, where the * denotes the transpose; that is, the 1x3 matrix with column |12/1289 19/1289 28/1289&gt;. Then u12`u12 is the 3x3 Frobenius projection map F:
<syntaxhighlight lang="python">
# taking septimal magic as an example ...
mapping = np.array ([[1, 0, 2, -1], [0, 5, 1, 12]])
subgroup_basis = np.array ([2, 3, 5, 7])


&lt;144 228 336|, &lt;228 361 532|, &lt;336 532 784|]/1289
# to find the TE tuning you enter
te (mapping, subgroup_basis)
</syntaxhighlight>


Multiplying &lt;12 19 28| by F gives &lt;12 19 28| again. Multiplying the monzos for 81/80, 128/125, 648/625 and etc gives the zero monzo, corresponding to a unison. Multiplying the val for 5-limit 19 equal, &lt;19 30 44|, by F gives &lt;24360 38570 56840|/1289, which is approximately the 19 equal val. Multiplying the 5-limit monzo for 3/2, which is |-1 1 0&gt; times F gives the fractional monzo corresponding to (2^84 3^133 5^196)^(1/1289), which equates to 698.121 cents, the tempering of 3/2 in Frobenius tuning for 5-limit 12et, the tuning with octave defined by the top row of F, which is to say by |1 0 0&gt;F, of 1196.778 cents.
Output:


We can do the same thing with a matrix U with rows consisting of the vals for 7-limit 12 and 22 equal; then U`U, the Frobenius projection map for pajara, is
<pre>
[1201.08240941  380.695113  ]
[1201.08240941, 1903.47556502, 2782.85993183, 3367.25894662]
</pre>


[|36 92 14 32&gt;, |92 269 -32 14&gt;, |14 -32 141 148&gt;, |32 14 148 64&gt;]/305
== Enforcement ==
=== Pure-octave TE tuning ===
{{Main| POTE tuning }}


This sends monzos for 50/49, 64/63 etc to the unison monzo, and vals for 10et, 12et and 22et to themselves.</pre></div>
We may call the pure-octave Tenney−Euclidean tuning the ''POTE tuning''. If {{nowrap|''T'' {{=}} ''J''<sub>''W''</sub>{{subsup|''V''|''W''|+}}''V'' {{=}} ''GV''}} is the TE tuning map, then a corresponding pure-octaves map can be found by {{w|scalar multiplication}}, ''T''/''t''<sub>1</sub>, where ''t''<sub>1</sub>, the first entry, is the tuning of 2. While POTE is a very simple way to enforce a pure octave, it tends to overtemper the generators for divisive ratios and leads to less than ideal results.
<h4>Original HTML content:</h4>
 
<div style="width:100%; max-height:400pt; overflow:auto; background-color:#f8f9fa; border: 1px solid #eaecf0; padding:0em"><pre style="margin:0px;border:none;background:none;word-wrap:break-word;width:200%;white-space: pre-wrap ! important" class="old-revision-html">&lt;html&gt;&lt;head&gt;&lt;title&gt;Tenney-Euclidean Tuning&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;!-- ws:start:WikiTextTocRule:14:&amp;lt;img id=&amp;quot;wikitext@@toc@@flat&amp;quot; class=&amp;quot;WikiMedia WikiMediaTocFlat&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/flat?w=100&amp;amp;h=16&amp;quot;/&amp;gt; --&gt;&lt;!-- ws:end:WikiTextTocRule:14 --&gt;&lt;!-- ws:start:WikiTextTocRule:15: --&gt;&lt;a href="#Temperaments"&gt;Temperaments&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:15 --&gt;&lt;!-- ws:start:WikiTextTocRule:16: --&gt; | &lt;a href="#TE tuning"&gt;TE tuning&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:16 --&gt;&lt;!-- ws:start:WikiTextTocRule:17: --&gt; | &lt;a href="#The pseudoinverse"&gt;The pseudoinverse&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:17 --&gt;&lt;!-- ws:start:WikiTextTocRule:18: --&gt; | &lt;a href="#Computing TE tuning using pseudoinverses"&gt;Computing TE tuning using pseudoinverses&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:18 --&gt;&lt;!-- ws:start:WikiTextTocRule:19: --&gt; | &lt;a href="#Pure octaves TE tuning"&gt;Pure octaves TE tuning&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:19 --&gt;&lt;!-- ws:start:WikiTextTocRule:20: --&gt; | &lt;a href="#The Frobenius projection map"&gt;The Frobenius projection map&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:20 --&gt;&lt;!-- ws:start:WikiTextTocRule:21: --&gt; | &lt;a href="#Examples"&gt;Examples&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:21 --&gt;&lt;!-- ws:start:WikiTextTocRule:22: --&gt;
=== Constrained TE tuning ===
&lt;!-- ws:end:WikiTextTocRule:22 --&gt;&lt;br /&gt;
{{Main| Constrained tuning }}
&lt;!-- ws:start:WikiTextLocalImageRule:52:&amp;lt;img src=&amp;quot;/file/view/mathhazard.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; align=&amp;quot;left&amp;quot; /&amp;gt; --&gt;&lt;img src="/file/view/mathhazard.jpg" alt="mathhazard.jpg" title="mathhazard.jpg" align="left" /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:52 --&gt;&lt;br /&gt;
 
&lt;hr /&gt;
Another way to enforce pure octaves is by adding the constraint before the optimization process. This is the ''CTE tuning''. The result, under the constraint of pure octaves, remains TE optimal. Contrary to POTE, CTE tends to under-optimize for divisive ratios; variations to fix this are considered under [[Constrained tuning]].
&lt;br /&gt;
 
Tenney-Euclidean tuning is a variant of &lt;a class="wiki_link" href="/TOP%20tuning"&gt;TOP tuning&lt;/a&gt; which employs the &lt;a class="wiki_link" href="/Tenney-Euclidean%20metrics"&gt;TE norm&lt;/a&gt;. While there are theoretical arguments favoring TOP, the advantages of using a Euclidean norm provides a powerful argument in favor of TE tuning.&lt;br /&gt;
== Otherwise normed tunings ==
&lt;br /&gt;
Tenney weighting gives equal treatment to intervals of equal complexity without choosing a finite set of intervals. While this makes a lot of sense, more specific demands on the field sometimes require it to be altered one way or another.
Just as the TOP tuning minimizes the maximum Tenney-weighted (L1) error of any interval, the TE tuning minimizes the maximum TE-weighted error of any interval.&lt;br /&gt;
 
&lt;br /&gt;
One common complaint is that it gives an undue weight to very high primes, as evidenced by the fact that you have to choose a limit to get sensible results. It does not converge as you keep adding primes. That it appears to be a limit to infinity of RMS of intervals approaching infinite complexity is psychoacoustically meaningless since the human ear cannot perceive even moderately complex intervals. To fix this, a free parameter ''s'' may be introduced such that each prime ''q'' is weighted by 1/(log<sub>2</sub>(''q''))<sup>s</sup> instead of 1/log<sub>2</sub>(''q''), and we can obtain a steeper weight curve with any {{nowrap| ''s'' > 1 }}:  
&lt;!-- ws:start:WikiTextHeadingRule:0:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc0"&gt;&lt;a name="Temperaments"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:0 --&gt;Temperaments&lt;/h1&gt;
 
If we have k linearly independent &lt;a class="wiki_link" href="/Vals%20and%20Tuning%20Space"&gt;vals&lt;/a&gt; of dimension n, they will span a subspace of &lt;a class="wiki_link" href="/Vals%20and%20Tuning%20Space"&gt;tuning space&lt;/a&gt;. This subspace defines a regular temperament of rank k in the prime limit p, where p is the nth prime. Similarly, starting from n-k independent commas for the same regular temperament, the corresponding monzos span an n-k dimensional subspace of &lt;a class="wiki_link" href="/Monzos%20and%20Interval%20Space"&gt;interval space&lt;/a&gt;. Both the subspace of tuning space and the subspace of interval space characterize the temperament completely.&lt;br /&gt;
$$ W = \operatorname {diag} (1/(\log_2 (Q))^s) $$
&lt;br /&gt;
 
A question then arises as to how to choose a specific tuning for this temperament, which is the same as asking how to choose a point (vector) in this subspace of tuning space which provides a good tuning. One answer to this is RMS tuning.&lt;br /&gt;
Another fix is to adopt the Wilson weight in place of Tenney weight, discussed in [[#Benedetti/Wilson–Euclidean tuning]].
&lt;br /&gt;
 
&lt;!-- ws:start:WikiTextHeadingRule:2:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc1"&gt;&lt;a name="TE tuning"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:2 --&gt;TE tuning&lt;/h1&gt;
The other complaint, contrary to above, is that Tenney weighting gives insufficient weight to higher primes than a weight specifically considering the relevant intervals within the limit. For this, we can use the parameter ''s'' again, as any {{nowrap| ''s'' < 1 }} will give us a flatter weight curve. In particular, we can set ''s'' to 0, which removes the weight entirely and results in equal weight of all primes. This is called Frobenius tuning, discussed right below.
If we put the (weighted) Euclidean metric on tuning space, leading to TE tuning space in weighted coordinates, it is easy to find the nearest point in the subspace to the JI point &amp;lt;1 1 ... 1|, and this closest point will define a tuning map which is called TE tuning (or TOP-RMS), a tuning which has been extensively studied by &lt;a class="wiki_link" href="/Graham%20Breed"&gt;Graham Breed&lt;/a&gt;. We may also keep unweighted coordinates and use the TE norm on tuning space; in these coordinates the JI point is &amp;lt;1 log2(3) ... log2(p)|. The two approaches are equivalent.&lt;br /&gt;
 
&lt;br /&gt;
=== Frobenius tuning and Frobenius projection matrix ===
One way to find this tuning is to use k parameters times the vals, leading to a parametrization of the subspace, and then to find the nearest point by least squares, differentiating the square of the distance to the JI point and solving the resulting linear equations. Another is to use the &lt;a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse" rel="nofollow"&gt;Moore-Penrose pseudoinverse&lt;/a&gt;.&lt;br /&gt;
The '''Frobenius tuning''' may be considered as the same RMS tuning but starting from nonweighted vals. This is perfectly functional but has less theoretical justification than TE tuning. However, if greater weight needs to be attached to the larger primes than TE tuning attaches, Frobenius tuning may be preferred; people who feel that larger primes require more tuning care than smaller ones may well prefer it.
&lt;br /&gt;
 
&lt;!-- ws:start:WikiTextHeadingRule:4:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc2"&gt;&lt;a name="The pseudoinverse"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:4 --&gt;The pseudoinverse&lt;/h1&gt;
The weighting matrix ''W'' is given by
If A is an m×n matrix with real entries, and if we denote the pseudoinverse by A`, then it is defined as the n×m matrix such that&lt;br /&gt;
 
&lt;ol&gt;&lt;li&gt;AA`A = A. Hence, AA` maps the rows of A to itself and A`A the columns of A to itself.&lt;/li&gt;&lt;li&gt;A`AA` = A&lt;/li&gt;&lt;li&gt;A`A and AA` are symmetric matrices&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
$$ W = I $$
From these properties it can be deduced that&lt;br /&gt;
 
&lt;ul&gt;&lt;li&gt;If A is invertible, its inverse is A`&lt;/li&gt;&lt;li&gt;If A has rational entries, so does A`&lt;/li&gt;&lt;li&gt;A`` = A&lt;/li&gt;&lt;li&gt;The pseudoinverse of the transpose is the transpose of the pseudoinverse&lt;/li&gt;&lt;li&gt;AA` is the orthogonal projection map onto the space spanned by the columns of A&lt;/li&gt;&lt;li&gt;A`A is the orthogonal projection map onto the space spanned by the rows of A&lt;/li&gt;&lt;li&gt;I - A`A, where I is the identity matrix, is the orthogonal projection map onto the kernel, or null space, of A&lt;/li&gt;&lt;li&gt;If the rows of A are linearly independent, then A` = A*(AA*)^(-1), where A* is the transpose of A. This means the pseudoinverse can be found in this important special case by people who don't have a pseudoinverse routine available by using a matrix inverse routine.&lt;/li&gt;&lt;li&gt;uA` is the nearest point to u in the subspace spanned by the rows of A; A`v is the nearest point to v in the space spanned by the columns of A.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
That simplifies the list of Frobenius generators, ''G'', to
&lt;!-- ws:start:WikiTextHeadingRule:6:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc3"&gt;&lt;a name="Computing TE tuning using pseudoinverses"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:6 --&gt;Computing TE tuning using pseudoinverses&lt;/h1&gt;
 
Suppose V is a matrix whose rows consist of vals in the weighted basis. No assumption need be made that the rows are linearly independent or that the vals are free of [Saturation|contorsion]. If J is the JI point, &amp;lt;1 1 ... 1|, then JV` gives the TE tuning in the sense that it gives (not necessarily independent) generators which correspond to the rows of V. How many of each generator to take to map a rational number contained in the prime limit in question is determined by applying the val corresponding to the generator to the rational number.&lt;br /&gt;
$$ G = JV^+ $$
&lt;br /&gt;
 
We may also obtain the TE tuning from a projection map. P = V`V is the orthogonal projection map onto the space spanned by the rows of V. This space corresponds to the temperament, and so does P. However, P is independent of how the temperament is defined; it does not depend on whether the vals are linearly independent, how many of them there are, or whether contorsion has been removed. The tuning map giving the tuning of each prime number is found by multiplying by the JI map: JP where J is the JI map, which is the nearest point in the subspace corresponding to the temperament to J.&lt;br /&gt;
where ''J'' is the non-weighted JIP and ''V'' is the nonweighted mapping.  
&lt;br /&gt;
 
We may find the same projection map starting from a list of weighted monzos rather than vals. If M is a rank n matrix whose rows are weighted monzos, and I is the nxn identity matrix, then P = I - M`M is the same projection map as V`V so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are.&lt;br /&gt;
The Frobenius tuning map, ''T'', becomes
&lt;br /&gt;
 
&lt;!-- ws:start:WikiTextHeadingRule:8:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc4"&gt;&lt;a name="Pure octaves TE tuning"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:8 --&gt;Pure octaves TE tuning&lt;/h1&gt;
$$ T = GV = JV^+V $$
(alias &lt;strong&gt;&lt;a class="wiki_link" href="/POTE%20tuning"&gt;POTE tuning&lt;/a&gt;&lt;/strong&gt;)&lt;br /&gt;
 
If T = JP is the TE tuning map, then a corresponding pure-octaves map can be found by &lt;a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Scalar_multiplication" rel="nofollow"&gt;scalar multiplication&lt;/a&gt;, T/T[1], where T[1], the first entry, is the tuning of 2. The justification for this is that T does not only define a point, but a line through the origin lying in the subspace defining the temperament, or in other words, a point in the linear subspace of projective space corresponding to the temperament, and hence is a projective object. Another way to say this is that T defines not only the closest point to J, but the closest direction in terms of angular measure between the line through T and the line through J. We may call pure-octaves Tenney-Euclidean tuning the &lt;a class="wiki_link" href="/POTE%20tuning"&gt;POTE tuning&lt;/a&gt;.&lt;br /&gt;
However, the main value of unweighted vals is that the pseudoinverse and projection matrix have rational entries, so that the rows of the matrix are [[fractional monzos]]. The Frobenius projection matrix therefore defines a completely canonical object not depending on any arbitrary definition (e.g. how Hermite normal form or LLL reduction is specifically defined) which corresponds one-to-one with temperaments, and which does not depend on whether the monzos or vals from which it is computed are [[Mathematical theory of saturation|saturated]]. It may be found starting either from a set of vals or a set of commas, since if ''Q'' is the projection matrix found by treating monzos in the same way as vals, {{nowrap|''P'' {{=}} ''I'' − ''Q''}} is the same projection matrix as would be found if starting from a set of vals defining the same temperament.
&lt;br /&gt;
 
&lt;!-- ws:start:WikiTextHeadingRule:10:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc5"&gt;&lt;a name="The Frobenius projection map"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:10 --&gt;The Frobenius projection map&lt;/h1&gt;
Spelling this out, if ''V'' is a matrix whose rows are vals, then {{nowrap| ''P'' {{=}} ''V''{{+}}''V'' }} is a {{w|Positive-definite matrix|positive-semidefinite}} {{w|symmetric matrix}} with rational matrix entries, which exactly specifies the regular temperament defined by the vals of ''V''. If ''M'' is a matrix with columns of monzos which spans the subspace of interval space containing the commas, then this same matrix ''P'' is given by {{nowrap| ''I'' − ''MM''{{+}} }}.
We may also do the same things starting from unweighted vals. This leads to a different tuning, the &lt;a class="wiki_link" href="/Fractional%20monzos"&gt;Frobenius tuning&lt;/a&gt;, which is perfectly functional but has less theoretical justification than TE tuning. However, if greater weight needs to be attached to the larger primes than TE tuning attaches, Frobenius tuning may be preferred; people who feel that larger primes require more tuning care than smaller ones may well prefer it. However the main value of unweighted vals is that the pseudoinverse and projection map have rational entries, so that the rows of the matrix are &lt;a class="wiki_link" href="/Fractional%20monzos"&gt;fractional monzos&lt;/a&gt;. The Frobenius projection map therefore, like the &lt;a class="wiki_link" href="/Wedgies%20and%20Multivals"&gt;wedgie&lt;/a&gt;, defines a completely canonical object not depending on any arbitrary definition (eg how Hermite normal form or LLL reduction is specifically defined) which corresponds 1-1 with temperaments, and which does not depend on whether the monzos or vals from which it is computed are &lt;a class="wiki_link" href="/Saturation"&gt;saturated&lt;/a&gt;. It may be found starting either from a set of vals or a set of commas, since if Q is the projection map found by treating monzos in the same way as vals, P = I-Q is the same projection map as would be found if starting from a set of vals defining the same temperament.&lt;br /&gt;
 
&lt;br /&gt;
If the vals defining ''V'' are linearly independent, then {{nowrap| ''P'' {{=}} ''V''{{t}}(''VV''{{t}}){{inv}}''V'' }}. If the columns of ''M'' are independent, then we likewise have {{nowrap| ''P'' {{=}} ''I'' − ''M''(''M''{{t}}''M''){{inv}}''M''{{t}} }}.
Spelling this out, if V is a matrix whose rows are vals, then P = V`V is a &lt;a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Positive-definite_matrix" rel="nofollow"&gt;positive-semidefinite&lt;/a&gt; &lt;a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Symmetric_matrix" rel="nofollow"&gt;symmetric matrix&lt;/a&gt; with rational matrix entries, which exactly specifies the regular temperament defined by the vals of V. If M is a matrix with rows of monzos which spans the subspace of interval space containing the commas, then this same matrix P is given by I - M`M.&lt;br /&gt;
 
&lt;br /&gt;
In D&D's guide, the systematic name for Frobenius tuning is ''minimax-E-copfr-S''.
If the vals defining V are linearly independent, then P = V*(VV*)^(-1)V. If the rows of M are independent, then we likewise have P = I - M*(MM*)^(-1)M.&lt;br /&gt;
 
&lt;br /&gt;
=== Benedetti/Wilson–Euclidean tuning ===
&lt;!-- ws:start:WikiTextHeadingRule:12:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc6"&gt;&lt;a name="Examples"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:12 --&gt;Examples&lt;/h1&gt;
'''Benedetti/Wilson–Euclidean tuning''' ('''BE tuning''') adopts the Benedetti or Wilson weight in place of Tenney weight, based on the dual norm of [[Wilson norm]]<ref group="note">Technically, the [[Benedetti height]] is not a norm, and tunings that minimize the maximum Benedetti-weighted damage can be different from those based on the Wilson norm for certain subgroups. However, it is almost always more convenient to simply use the Wilson norm in these cases.</ref>. For {{nowrap|''Q'' {{=}} {{val| 2 3 5 … }}}}, the weighting matrix has the form
The val for 5-limit 12et is &amp;lt;12 19 28|. In weighted coordinates, that becomes v12 = &amp;lt;12 19/log2(3) 28/log2(5)| ~ &amp;lt;12.0 11.988 12.059|. If we take this to be a 1x3 matrix and take the pseudoinverse, we get the 3x1 matrix v12` ~ [|0.027706 0.027677 0.027842&amp;gt;]. Then P = v12`v12 is a projection map onto the one-dimensional subspace whose single basis vector is v12. We find that v12P equals v12; on the other hand, if we take the monzo for 81/80, which is |-4 4 -1&amp;gt; and monzo-weight it to &amp;lt;-4 4log2(3) - log2(5)| and multiply (either side, the matrix is symmetric) by P, we get the zero vector, corresponding to the unison.&lt;br /&gt;
 
&lt;br /&gt;
$$ W = \operatorname{diag} (1/Q) $$
Now consider &lt;a class="wiki_link" href="/Diaschismic%20family"&gt;pajara&lt;/a&gt;, the 7-limit temperament tempering out both 50/49 and 64/63. Two possible equal temperament tunings for pajara are &lt;a class="wiki_link" href="/12edo"&gt;12edo&lt;/a&gt; and &lt;a class="wiki_link" href="/22edo"&gt;22edo&lt;/a&gt;. We may define a 2x4 matrix with rows equal to the vals for 12, and 22; in weighted coordinates this would be&lt;br /&gt;
 
&lt;br /&gt;
In D&D's guide, the systematic name for BE tuning is ''minimax-E-sopfr-S''.
V ~ [&amp;lt;12 11.988 12.059 12.111|, &amp;lt;22 22.083 21.965 22.085|]&lt;br /&gt;
 
&lt;br /&gt;
== Examples ==
Then the pseudoinverse V` is approximately&lt;br /&gt;
: ''For practical help, see [[POTE tuning]].''
&lt;br /&gt;
 
[-1.81029 1.00052]&lt;br /&gt;
=== Optimizing a temperament ===
[-6.68250 3.66285]&lt;br /&gt;
Consider [[pajara]], the 7-limit temperament tempering out 50/49 and 64/63. Its mapping ''V'' is
[4.83496 -2.63063]&lt;br /&gt;
 
[3.67652 -1.99757]&lt;br /&gt;
$$
&lt;br /&gt;
V = \begin{bmatrix}
which we may also write as [|-1.81029 -6.68250 4.83496 3.6765175829982166001&amp;gt;,  &lt;br /&gt;
2 & 0 & 11 & 12 \\
|1.00052 3.66285 -2.63063 -1.99757&amp;gt;]&lt;br /&gt;
0 & 1 & -2 & -2
&lt;br /&gt;
\end{bmatrix}
Paj = V`V is a 4x4 symmetrical matrix which projects weighted vals in TE tuning space, or weighted monzos in TE interval space, to a subspace defined by pajara. It therefore projects the weighted monzos for 50/49, 64/63, 225/224, 2048/2025 and etc to the zero vector, whereas it leaves pajara vals such as &lt;a class="wiki_link" href="/10edo"&gt;10edo&lt;/a&gt; in weighted coordinates unchanged.&lt;br /&gt;
$$
&lt;br /&gt;
 
If we use unweighted coordinates we get the Frobenius projection map instead, whose rows are &lt;a class="wiki_link" href="/fractional%20monzos"&gt;fractional monzos&lt;/a&gt;. The unweighted pseudoinverse u12` of the 5-limit val u12 for 12 equal is the column matrix u12*/1289, where the * denotes the transpose; that is, the 1x3 matrix with column |12/1289 19/1289 28/1289&amp;gt;. Then u12`u12 is the 3x3 Frobenius projection map F:&lt;br /&gt;
This can be found by taking two equal temperaments supporting pajara (e.g. [[12edo]] and [[22edo]]), defining a 2×4 matrix formed by the vals and then canonicalizing it. In weighted coordinates this would be
&lt;br /&gt;
 
&amp;lt;144 228 336|, &amp;lt;228 361 532|, &amp;lt;336 532 784|]/1289&lt;br /&gt;
$$
&lt;br /&gt;
V_W =
Multiplying &amp;lt;12 19 28| by F gives &amp;lt;12 19 28| again. Multiplying the monzos for 81/80, 128/125, 648/625 and etc gives the zero monzo, corresponding to a unison. Multiplying the val for 5-limit 19 equal, &amp;lt;19 30 44|, by F gives &amp;lt;24360 38570 56840|/1289, which is approximately the 19 equal val. Multiplying the 5-limit monzo for 3/2, which is |-1 1 0&amp;gt; times F gives the fractional monzo corresponding to (2^84 3^133 5^196)^(1/1289), which equates to 698.121 cents, the tempering of 3/2 in Frobenius tuning for 5-limit 12et, the tuning with octave defined by the top row of F, which is to say by |1 0 0&amp;gt;F, of 1196.778 cents.&lt;br /&gt;
\begin{bmatrix}
&lt;br /&gt;
2.000000 & 0.000000 & 4.737442 & 4.274486 \\
We can do the same thing with a matrix U with rows consisting of the vals for 7-limit 12 and 22 equal; then U`U, the Frobenius projection map for pajara, is&lt;br /&gt;
0.000000 & 0.630930 & -0.861353 & -0.712414
&lt;br /&gt;
\end{bmatrix}
[|36 92 14 32&amp;gt;, |92 269 -32 14&amp;gt;, |14 -32 141 148&amp;gt;, |32 14 148 64&amp;gt;]/305&lt;br /&gt;
$$
&lt;br /&gt;
 
This sends monzos for 50/49, 64/63 etc to the unison monzo, and vals for 10et, 12et and 22et to themselves.&lt;/body&gt;&lt;/html&gt;</pre></div>
Then the pseudoinverse ''V''{{+}} is approximately
 
$$
V_W^+ =
\begin{bmatrix}
0.143942 & 0.622569 \\
0.196399 & 1.232405 \\
0.072833 & -0.207801 \\
0.085876 & -0.060988
\end{bmatrix}
$$
 
so we obtain the generator tuning map {{nowrap|''G'' {{=}} ''J''<sub>''W''</sub>{{subsup|''V''|''W''|+}} }}:
 
$$ G = \begin{bmatrix} 0.499049 & 1.586185 \end{bmatrix} $$
 
and the tuning map {{nowrap| ''T'' {{=}} ''GV'' }} which shows the value each prime harmonic is tuned to:
 
$$ T = \begin{bmatrix} 0.998099 & 1.586185 & 2.317174 & 2.816223 \end{bmatrix} $$
 
The results are in octaves. Multiply them by 1200 to obtain the tuning in cents.
 
=== Using a Frobenius projection matrix ===
Using the values provided above, {{nowrap|''P''<sub>''W''</sub> {{=}} {{subsup|''V''|''W''|+}}''V''<sub>''W''</sub>}} is a 4×4 symmetrical matrix which projects weighted vals in TE tuning space, or weighted monzos in TE interval space, to a subspace defined by pajara. It therefore projects the weighted monzos for 50/49, 64/63, 225/224, 2048/2025 etc. to the zero vector, whereas it leaves pajara vals such as [[10edo]] in weighted coordinates unchanged.
 
If we use unweighted coordinates we get the Frobenius projection matrix instead, whose rows are [[fractional monzos]]. For instance, the unweighted pseudoinverse {{subsup|''V''|12|+}} of the 5-limit val ''V''<sub>12</sub> for 12 equal is the column matrix {{subsup|''V''|12|T}}/1289; that is, the 1×3 matrix with column {{monzo| 12/1289 19/1289 28/1289 }}. Then {{subsup|''V''|12|+}}''V''<sub>12</sub> is the 3×3 Frobenius projection matrix ''P''<sub>F</sub>:
 
$$
P_\text{F} = \frac{1}{1289}
\begin{bmatrix}
144 & 228 & 336 \\
228 & 361 & 532 \\
336 & 532 & 784
\end{bmatrix}
$$
 
Multiplying {{val| 12 19 28 }} by ''P''<sub>F</sub> gives {{val| 12 19 28 }} again. Multiplying the monzos for 81/80, 128/125, 648/625 etc. gives the zero monzo, corresponding to a unison. Multiplying the val for 5-limit 19 equal, {{val| 19 30 44 }}, by ''P''<sub>F</sub> gives {{val| 24360 38570 56840 }}/1289, which is approximately the 19 equal val. Multiplying the 5-limit monzo for 3/2, which is {{monzo| -1 1 0 }}; times ''P''<sub>F</sub> gives the fractional monzo corresponding to (2<sup>84</sup> 3<sup>133</sup> 5<sup>196</sup>)<sup>1/1289</sup>, which equates to 698.121 cents, the tempering of 3/2 in Frobenius tuning for 5-limit 12et, the tuning with octave defined by the top row of ''P''<sub>F</sub>, which is to say by {{monzo| 1 0 0 }}''P''<sub>F</sub>, of 1196.778 cents.
 
We can do the same thing with a matrix ''V'' for pajara; then ''P''<sub>F</sub>, the Frobenius projection matrix, is
 
$$
P_\text{F} = V^+V = \frac{1}{305}
\begin{bmatrix}
36 & 92 & 14 & 32 \\
92 & 269 & -32 & 14 \\
14 & -32 & 141 & 148 \\
32 & 14 & 148 & 64
\end{bmatrix}
$$
 
This sends monzos for 50/49, 64/63 etc. to the unison monzo, and vals for 10et, 12et, and 22et to themselves.
 
== Notes ==
<references group="note"/>
 
[[Category:Terms]]
[[Category:Math]]
[[Category:Regular temperament tuning]]

Latest revision as of 13:21, 11 December 2025

Tenney–Euclidean tuning (TE tuning), also known as TOP–RMS tuning, is a tuning technique for regular temperaments which leads to the least sum of squared errors of the Tenney-weighted basis.

If we have r linearly independent vals of dimension n, they will span a subspace of tuning space. This subspace defines a regular temperament of rank r in the prime limit p, where p is the n-th prime. Similarly, starting from nr independent commas for the same regular temperament, the corresponding monzos span an nr dimensional subspace of interval space. Both the subspace of tuning space and the subspace of interval space characterize the temperament completely. A question then arises as to how to choose a specific tuning for this temperament, which is the same as asking how to choose a point (vector) in this subspace of tuning space which provides a good tuning. One answer to this is the weighted RMS (root-mean-squared) tuning discussed right here.

TE tuning can be viewed as a variant of TOP tuning since it employs the TE norm in place of the Tenney height as in TOP tuning. Just as TOP tuning minimizes the maximum Tenney-weighted L1 error of any interval, TE tuning minimizes the maximum Tenney-weighted L2 error of any interval.

In D&D's guide, the systematic name for TE tuning is minimax-ES.

Motivation

TE tuning combines the ideas of Tenney weighting of prime limits and optimizing the root mean square (RMS) of weighted error/damage. Prime limits are a way of choosing musically useful intervals without being too specific about which intervals you think are useful. Tenney weighting is a way of giving equal treatment to intervals of equal complexity without choosing a finite set of intervals. RMS optimization (least squares) implies optimizing for the average sensory dissonance of an interval, and so allows for good consonances to balance weak dissonances and well tuned intervals to balance poorly tuned intervals.

TE shares with TOP tuning the insight that adding octaves to the optimization simplifies the calculation. Allowing for scale stretch balances intervals of different sizes.

As an RMS measure, TE error is optimized by the least squares method, which is well known and simple and efficient to calculate.

TE tuning is uniquely optimized for a given prime limit. There are no free parameters determining the weighting of different intervals or the balance of wide and narrow intervals: all follow from the definition of Tenney weighting of primes.

Definition

If we put the weighted Euclidean metric on tuning space, leading to TE tuning space in weighted coordinates, it is easy to find the nearest point in the subspace to the JIP 1 1 … 1], and this closest point will define a tuning map which is called TE tuning, a tuning which has been extensively studied by Graham Breed. We may also keep unweighted coordinates and use the TE norm on tuning space; in these coordinates the JI point is 1 log23 … log2p]. The two approaches are equivalent.

To start with, suppose W is the weighting matrix. For the prime basis Q = 2 3 5 … p],

$$ W = \operatorname {diag} (1/\log_2 (Q)) $$

If V is the mapping of the abstract temperament whose rows are (not necessarily independent) vals, then VW = VW is the mapping in the weighted space. If J is the row vector of targeted JI intervals (i.e. the JIP), then JW = JW is the JI intervals in the weighted space, in the case of Tenney-weighting it is 1 1 … 1]. Let us also denote the row vector of TE generators G. TE tuning then defines a least squares problem of the following overdetermined system of linear equations: GVW = JW, which simply says that the sum of (vw)kl steps of generator gk for all k's should equal the l-th targeted JI interval (jw)l. That is to say we want to

$$ \begin{align} & \text{find} && G \\ & \text{that minimizes} && \lVert GV_W - J_W \rVert_2 \end{align} $$

There are a number of methods to solve least squares problems. One common way is to use the Moore–Penrose pseudoinverse.

Computation

Using pseudoinverse

The Moore–Penrose pseudoinverse, denoted A+, is a generalization of the inverse matrix with which it shares a lot of properties. In this method, the (not necessarily independent) TE generator map G, which correspond to the rows of V are given by

$$ G = J_W V_W^+ $$

Applying the val list to the generators, The TE tuning map is given by

$$ T = GV = J_W V_W^+ V $$

We may also obtain the TE tuning from a projection matrix. PW = V +
W
 
VW
is the orthogonal projection matrix that maps onto the space spanned by the rows of VW. This space corresponds to the temperament, and so does PW. However, PW is independent of how the temperament is defined; it does not depend on whether the vals are linearly independent, how many of them there are, or whether contorsion has been removed. The weighted tuning map TW = TW giving the weighted tuning of each prime number is found by multiplying by the JIP: TW = JWPW = JWV +
W
 
VW
, which is the nearest point in the subspace corresponding to the temperament to JW, so that T = JWPWW−1 = JWV +
W
 
V
.

We may find the same projection matrix starting from a list of weighted monzos rather than vals. If MW is a rank-n matrix whose columns are weighted monzos, and I is the n×n identity matrix, then PW = IMWM +
W
 
is the same projection matrix as V +
W
 
VW so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are.

Computer program

Here is a minimalistic Python script that takes a mapping and gives TE generators and tuning maps, using Scipy.

import numpy as np
from scipy import linalg

def te (mapping, subgroup_basis):
    just_tuning_map = 1200*np.log2 (subgroup_basis)
    te_weight = np.diag (1/np.log2 (subgroup_basis))
    mapping_w = mapping @ te_weight
    just_tuning_map_w = just_tuning_map @ te_weight

    te_generators = linalg.lstsq (np.transpose (mapping_w), just_tuning_map_w)[0]
    te_tuning_map = te_generators @ mapping
    return te_generators, te_tuning_map
# taking septimal magic as an example ...
mapping = np.array ([[1, 0, 2, -1], [0, 5, 1, 12]])
subgroup_basis = np.array ([2, 3, 5, 7])

# to find the TE tuning you enter
te (mapping, subgroup_basis)

Output:

[1201.08240941  380.695113  ]
[1201.08240941, 1903.47556502, 2782.85993183, 3367.25894662]

Enforcement

Pure-octave TE tuning

We may call the pure-octave Tenney−Euclidean tuning the POTE tuning. If T = JWV +
W
 
V = GV
is the TE tuning map, then a corresponding pure-octaves map can be found by scalar multiplication, T/t1, where t1, the first entry, is the tuning of 2. While POTE is a very simple way to enforce a pure octave, it tends to overtemper the generators for divisive ratios and leads to less than ideal results.

Constrained TE tuning

Another way to enforce pure octaves is by adding the constraint before the optimization process. This is the CTE tuning. The result, under the constraint of pure octaves, remains TE optimal. Contrary to POTE, CTE tends to under-optimize for divisive ratios; variations to fix this are considered under Constrained tuning.

Otherwise normed tunings

Tenney weighting gives equal treatment to intervals of equal complexity without choosing a finite set of intervals. While this makes a lot of sense, more specific demands on the field sometimes require it to be altered one way or another.

One common complaint is that it gives an undue weight to very high primes, as evidenced by the fact that you have to choose a limit to get sensible results. It does not converge as you keep adding primes. That it appears to be a limit to infinity of RMS of intervals approaching infinite complexity is psychoacoustically meaningless since the human ear cannot perceive even moderately complex intervals. To fix this, a free parameter s may be introduced such that each prime q is weighted by 1/(log2(q))s instead of 1/log2(q), and we can obtain a steeper weight curve with any s > 1:

$$ W = \operatorname {diag} (1/(\log_2 (Q))^s) $$

Another fix is to adopt the Wilson weight in place of Tenney weight, discussed in #Benedetti/Wilson–Euclidean tuning.

The other complaint, contrary to above, is that Tenney weighting gives insufficient weight to higher primes than a weight specifically considering the relevant intervals within the limit. For this, we can use the parameter s again, as any s < 1 will give us a flatter weight curve. In particular, we can set s to 0, which removes the weight entirely and results in equal weight of all primes. This is called Frobenius tuning, discussed right below.

Frobenius tuning and Frobenius projection matrix

The Frobenius tuning may be considered as the same RMS tuning but starting from nonweighted vals. This is perfectly functional but has less theoretical justification than TE tuning. However, if greater weight needs to be attached to the larger primes than TE tuning attaches, Frobenius tuning may be preferred; people who feel that larger primes require more tuning care than smaller ones may well prefer it.

The weighting matrix W is given by

$$ W = I $$

That simplifies the list of Frobenius generators, G, to

$$ G = JV^+ $$

where J is the non-weighted JIP and V is the nonweighted mapping.

The Frobenius tuning map, T, becomes

$$ T = GV = JV^+V $$

However, the main value of unweighted vals is that the pseudoinverse and projection matrix have rational entries, so that the rows of the matrix are fractional monzos. The Frobenius projection matrix therefore defines a completely canonical object not depending on any arbitrary definition (e.g. how Hermite normal form or LLL reduction is specifically defined) which corresponds one-to-one with temperaments, and which does not depend on whether the monzos or vals from which it is computed are saturated. It may be found starting either from a set of vals or a set of commas, since if Q is the projection matrix found by treating monzos in the same way as vals, P = IQ is the same projection matrix as would be found if starting from a set of vals defining the same temperament.

Spelling this out, if V is a matrix whose rows are vals, then P = V+V is a positive-semidefinite symmetric matrix with rational matrix entries, which exactly specifies the regular temperament defined by the vals of V. If M is a matrix with columns of monzos which spans the subspace of interval space containing the commas, then this same matrix P is given by IMM+.

If the vals defining V are linearly independent, then P = V T(VV T)−1V. If the columns of M are independent, then we likewise have P = IM(M TM)−1M T.

In D&D's guide, the systematic name for Frobenius tuning is minimax-E-copfr-S.

Benedetti/Wilson–Euclidean tuning

Benedetti/Wilson–Euclidean tuning (BE tuning) adopts the Benedetti or Wilson weight in place of Tenney weight, based on the dual norm of Wilson norm[note 1]. For Q = 2 3 5 …], the weighting matrix has the form

$$ W = \operatorname{diag} (1/Q) $$

In D&D's guide, the systematic name for BE tuning is minimax-E-sopfr-S.

Examples

For practical help, see POTE tuning.

Optimizing a temperament

Consider pajara, the 7-limit temperament tempering out 50/49 and 64/63. Its mapping V is

$$ V = \begin{bmatrix} 2 & 0 & 11 & 12 \\ 0 & 1 & -2 & -2 \end{bmatrix} $$

This can be found by taking two equal temperaments supporting pajara (e.g. 12edo and 22edo), defining a 2×4 matrix formed by the vals and then canonicalizing it. In weighted coordinates this would be

$$ V_W = \begin{bmatrix} 2.000000 & 0.000000 & 4.737442 & 4.274486 \\ 0.000000 & 0.630930 & -0.861353 & -0.712414 \end{bmatrix} $$

Then the pseudoinverse V+ is approximately

$$ V_W^+ = \begin{bmatrix} 0.143942 & 0.622569 \\ 0.196399 & 1.232405 \\ 0.072833 & -0.207801 \\ 0.085876 & -0.060988 \end{bmatrix} $$

so we obtain the generator tuning map G = JWV +
W
 
:

$$ G = \begin{bmatrix} 0.499049 & 1.586185 \end{bmatrix} $$

and the tuning map T = GV which shows the value each prime harmonic is tuned to:

$$ T = \begin{bmatrix} 0.998099 & 1.586185 & 2.317174 & 2.816223 \end{bmatrix} $$

The results are in octaves. Multiply them by 1200 to obtain the tuning in cents.

Using a Frobenius projection matrix

Using the values provided above, PW = V +
W
 
VW
is a 4×4 symmetrical matrix which projects weighted vals in TE tuning space, or weighted monzos in TE interval space, to a subspace defined by pajara. It therefore projects the weighted monzos for 50/49, 64/63, 225/224, 2048/2025 etc. to the zero vector, whereas it leaves pajara vals such as 10edo in weighted coordinates unchanged.

If we use unweighted coordinates we get the Frobenius projection matrix instead, whose rows are fractional monzos. For instance, the unweighted pseudoinverse V +
12
 
of the 5-limit val V12 for 12 equal is the column matrix V T
12
 
/1289; that is, the 1×3 matrix with column [12/1289 19/1289 28/1289. Then V +
12
 
V12 is the 3×3 Frobenius projection matrix PF:

$$ P_\text{F} = \frac{1}{1289} \begin{bmatrix} 144 & 228 & 336 \\ 228 & 361 & 532 \\ 336 & 532 & 784 \end{bmatrix} $$

Multiplying 12 19 28] by PF gives 12 19 28] again. Multiplying the monzos for 81/80, 128/125, 648/625 etc. gives the zero monzo, corresponding to a unison. Multiplying the val for 5-limit 19 equal, 19 30 44], by PF gives 24360 38570 56840]/1289, which is approximately the 19 equal val. Multiplying the 5-limit monzo for 3/2, which is [-1 1 0; times PF gives the fractional monzo corresponding to (284 3133 5196)1/1289, which equates to 698.121 cents, the tempering of 3/2 in Frobenius tuning for 5-limit 12et, the tuning with octave defined by the top row of PF, which is to say by [1 0 0PF, of 1196.778 cents.

We can do the same thing with a matrix V for pajara; then PF, the Frobenius projection matrix, is

$$ P_\text{F} = V^+V = \frac{1}{305} \begin{bmatrix} 36 & 92 & 14 & 32 \\ 92 & 269 & -32 & 14 \\ 14 & -32 & 141 & 148 \\ 32 & 14 & 148 & 64 \end{bmatrix} $$

This sends monzos for 50/49, 64/63 etc. to the unison monzo, and vals for 10et, 12et, and 22et to themselves.

Notes

  1. Technically, the Benedetti height is not a norm, and tunings that minimize the maximum Benedetti-weighted damage can be different from those based on the Wilson norm for certain subgroups. However, it is almost always more convenient to simply use the Wilson norm in these cases.