Optimization: Difference between revisions

Enforcement: mention that a constraint is an eigenmonzo
Improve the formulation
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
In [[regular temperament theory]], '''optimization''' is the theory and practice to find low-error tunings of regular temperaments.  
In [[regular temperament theory]], '''optimization''' is the theory and practice to find low-error tunings of regular temperaments.  


An abstract regular temperament does not contain specific tuning information. To tune a temperament, one must specify the size of each [[generator]]. The question is what it should be. For sure, a temperament is an approximation to JI. Any tuning will unavoidably introduce errors on some intervals. The art of tempering is about compromises – to find a sweet spot where the concerning intervals have the least overall error, so that the harmonic qualities of JI are best preserved.  
A regular temperament is defined by a [[mapping]] or a [[comma basis]]. It does not contain specific tuning information. To tune a temperament, one must define a [[tuning map]] by specifying the size of each [[periods and generators|generator]]. The question is what it should be. In general, a temperament is an approximation to [[just intonation|just intonation (JI)]]. Any tuning will unavoidably introduce errors on some intervals for sure. The art of tempering seems to be about compromises – to find a sweet spot where the concerning intervals have the least overall error, so that the harmonic qualities of JI are best preserved.  
 
== Basic concepts ==
* [[Just intonation point]] (JIP)
* [[Tuning map]]
* [[Periods and generators]]


== Taxonomy ==
== Taxonomy ==
Roughly speaking, there are two types of tunings with diverging philosophies: '''prime-based tunings''' and '''target tunings'''.  
Roughly speaking, there are two types of tunings with diverging philosophies: ''prime-based tunings'' and ''target tunings''.  
* A prime-based tuning is optimized for the formal primes, but they are representative for the entire interval space. There are two perspectives. First, in the [[Vals and tuning space|tuning space]], it minimizes the errors of formal primes. Second, in the [[Monzos and interval space|interval space]], it rates all intervals through a norm, which serves as a complexity measure, and it minimizes the maximum [[damage]] (i.e. error divided by complexity) for all intervals.  
* A prime-based tuning is optimized for the [[formal prime]]s, but they are representative for the set of all intervals. There are two equivalent perspectives. First, in the [[vals and tuning space|tuning space]], it minimizes the errors of formal primes. Second, in the [[monzos and interval space|interval space]], it rates the [[complexity]] of all intervals through a norm, and it minimizes the maximum [[damage]] (i.e. error divided by complexity) for all intervals.  
* A target tuning is only optimized for a particular set of intervals and considers the rest irrelevant and/or infinitely complex.  
* A target tuning is optimized for a particular set of intervals and considers the rest irrelevant. However, the interval does not get infinite complexity even if it is disregarded due to the normed nature of the interval space, so these tunings also correspond to all-interval damage minimizations of some sorts.  


This article focuses on prime-based tunings. See the dedicated page (→ [[Target tunings]]) for target tunings.  
This article focuses on prime-based tunings. See the dedicated page (→ [[Target tunings]]) for target tunings.  
Line 18: Line 13:
[[File:Vector norms.svg|thumb|Comparison of norms on the space]]
[[File:Vector norms.svg|thumb|Comparison of norms on the space]]


In order to perform prime-based optimization, all intervals must be rated by complexity, so it is critical to employ a [[Wikipedia:Norm (mathematics)|norm]] on the space. There are a few aspects to consider. The '''weight''', which determines how important each formal prime is, and the '''skew''', which determines how divisive ratios are more important than multiplicative ratios. They can be interpreted as transformations of either the space or the norm. The two views are equivalent. In addition, there is the '''order''' (or sometimes just the '''norm'''), which determines how the space can be traversed.  
In order to perform prime-based optimization, all intervals must be rated by complexity, so it is critical to employ a {{w|norm (mathematics)|norm}}. Technically, this is to {{w|embedding|embed}} the [[just intonation subgroup|just intonation group]] into a {{w|normed vector space}}. There are a few aspects to consider. The weight, which determines how important each formal prime is, and the skew, which determines how divisive ratios are more important than multiplicative ratios. They can be interpreted as transformations of either the norm or the coordinates of the space. The two views are equivalent. In addition, there is the order (or sometimes just dubbed the norm), which determines how the space can be traversed.  


=== Weight ===
=== Weight ===
The weight determines the importance of each formal prime. For instance, the Tenney weighter
The weight, represented by a diagonal transformation matrix, determines the importance of each formal prime. Since the tuning space and the interval space are {{w|dual (mathematics)|dual}} to each other, rating of importance in the tuning space is equivalent to rating of complexity in the interval space. The Tenney weight is the most common weight:


<math>\displaystyle W = \operatorname {diag} (1/\log_2 (Q)) </math>
$$ W = \operatorname {diag} (1/\log_2 (Q)) $$


indicates that the prime harmonic ''q'' in Q has the importance of 1/log<sub>2</sub>(''q''). Since the tuning space and the interval space are [[dual]] to each other, such a rating of importance in the tuning space has the dual effect in the interval space: the prime harmonic ''q'' has the complexity log<sub>2</sub>(''q''). The more complex it is, the more error will be allowed for it.  
which indicates that the prime harmonic ''q'' in ''Q'' = {{val| 2 3 5 … }} has the importance of 1/log<sub>2</sub>(''q''). Its dual states that ''q'' has the complexity of log<sub>2</sub>(''q'').  


=== Skew ===
=== Skew ===
An orthogonal space treats divisive ratios as equally important as multiplicative ratios, yet divisive ratios are sometimes thought to be more important. For example, 5/3 is sometimes found to be more important than 15. The skew is introduced to address that.  
An orthogonal space treats divisive ratios as equally important as multiplicative ratios, yet divisive ratios are sometimes thought to be more important. For example, 5/3 is sometimes found to be more important than 15. The skew is introduced to address that.  


Notably, adopting the [[Weil height]] will skew the space by way of adding an extra dimension.  
Notably, the [[Weil norm]] is equivalent to Tenney-weighting the intervals and skewing the space such that each basis element is 60 degrees from each other.  


Both the weight and the skew are represented by matrices that can be applied to the mapping. In a more general sense, the distinction may not matter, and they may be collectively called by either part.  
Both the weight and the skew are represented by matrices that can be applied to the mapping. In a more general sense, the distinction may not matter, and they may be collectively called weight–skew transformation.  


=== Order ===
=== Order ===
The order of the norm determines what is a unit step in the space.  
The order of the norm determines what is a unit step in the interval space.
* The Euclidean norm a.k.a. ''L''<sup>2</sup> norm resembles real-world distances.
* The Manhattan norm, taxicab norm, a.k.a. ''L''<sup>1</sup> norm resembles movement of taxicabs in Manhattan – it can only traverse horizontally or vertically, so diagonal movement counts as two steps.
* The Chebyshevian norm a.k.a. ''L''<sup>inf</sup> norm is the opposite of the Manhattan norm – it is the maximum number of steps along any axis, so a diagonal movement is the same as a horizontal or vertical one.  


The '''Euclidean norm''' aka ''L''<sup>2</sup> norm resembles real-world distances.  
Note that the dual norm of ''L''<sup>1</sup> is ''L''<sup>inf</sup>, and vice versa. Thus, the ''L''<sup>1</sup> norm on the interval space corresponds to the ''L''<sup>inf</sup> tuning space, and the ''L''<sup>inf</sup> norm corresponds to the ''L''<sup>1</sup> tuning space. The dual of ''L''<sup>2</sup> norm is itself, so the Euclidean norm corresponds to Euclidean tuning as one may expect.  


The '''Minkowskian norm''', '''Manhattan norm''' or '''taxicab norm''' aka ''L''<sup>1</sup> norm resembles movement of taxicabs in Manhattan – it can only traverse horizontally or vertically. A diagonal movement mounts to two steps.
Technically, harmony works like taxicabs, as is modeled by [[James Tenney]]'s harmonic distance, or [[Tenney norm]], so it is often believed that optimization with the Manhattan norm should result in the best tuning and that Euclidean norms are only used because of ease of computation ([[D&D's guide]] has notably taken this stance). However, Euclidean and especially Chebyshevian norms may correspond to more efficient use of optimizational resource, as they take account of how many generator steps each formal prime is mapped to in the temperament.  
 
The '''Chebyshevian norm''' aka ''L''<sup>inifinity</sup> norm is the opposite of the Minkowsky norm – it is the maximum number of steps in any direction, so a diagonal movement is the same as a horizontal or vertical one.
 
It should be noted that the dual norm of ''L''<sup>1</sup> is ''L''<sup>infinity</sup>, and vice versa. Thus, the Minkowskian norm corresponds to the ''L''<sup>infinity</sup> tuning space, and the Chebyshevian norm corresponds to the ''L''<sup>1</sup> tuning space. The dual of ''L''<sup>2</sup> norm is itself, so the Euclidean norm corresponds to Euclidean tuning as one may expect.  


== Enforcement ==
== Enforcement ==
'''Enforcement''' is the technique where certain intervals are forced to be tuned as desired. The octave is the most common interval subject to enforcement, and is often assumed to be ''the'' enforced interval, but other intervals are possible. The two common methods are '''destretch''' and '''constraint'''.  
Enforcement is the technique where certain intervals are forced to be tuned as desired. The [[octave]] is the most common interval subject to enforcement, and is often assumed to be ''the'' enforced interval, but other intervals are possible. The two common methods are destretch and constraint.  


=== Destretch ===
=== Destretch ===
Destretch is a postprocess to enforce a pure interval. The most common destretched tuning is [[POTE tuning]], which works as a quick approximation to the more sophisticated CTWE aka KE tuning.  
Destretch is a postprocess to enforce a pure interval. The result is no longer optimal measured by the original norm, but it often works as a quick approximation to more sophisticated tunings. The most common destretched tuning is [[POTE tuning]], which approximates [[CWE tuning]].  


=== Constraint ===
=== Constraint ===
Constraint is a logical method to enforce one or more pure intervals. A pure interval added this way is known as an [[eigenmonzo]]. It defines a feasible region for optimization, and the result measured by the original norm remains optimal.
Constraint is a logical method to enforce one or more pure intervals. A pure interval added this way is known as a [[eigenmonzo|unit eigenmonzo a.k.a. unchanged-interval]]. It defines a feasible region for optimization, and the result measured by the original norm is feasibly optimal.


== General formulation ==
== General formulation ==
In general, the temperament optimization problem (except for the destretch) can be defined as follows. Given a temperament mapping A and the JIP J<sub>0</sub>, we specify a weight W, a skew X, and a ''p''-norm. In addition, an optional list of constraint B<sub>C</sub>. We want to find the generator list G and the tuning map T by
In general, the temperament optimization problem (except for the destretch) can be defined as follows. Given a temperament mapping matrix ''V'' and the [[just tuning map]] ''J'', we specify a weight–skew transformation matrix ''X'', a ''q''-norm, and optionally a unit eigenmonzo list ''M''. Let ''G'' denote the generator tuning map, we want to


Minimize
$$
\begin{align}
& \text{find} && G \\
& \text{that minimizes} && \lVert GV_X - J_X \rVert_q \\
& \text{subject to} && (GV - J)M = O
\end{align}
$$


<math>\displaystyle \lVert GV - J \rVert_p </math>
where (·)<sub>''X''</sub> denotes the variable in the weight–skew transformed space, found by


subject to
$$
 
\begin{align}
<math>\displaystyle (GA - J_0)B_{\rm C} = O </math>
V_X &= VX \\
 
J_X &= JX
where V is the weight-skewed mapping and J the weight-skewed JIP, found by
\end{align}
 
$$
<math>\displaystyle
V = AWX \\
J = J_0 WX
</math>


== Common tunings ==
== Common tunings ==
A good number of tunings have been given names.  
A good number of common tuning schemes have been given names. The following table shows some of them by weight–skew against the order.  


{| class="wikitable"
{| class="wikitable"
|+Table of common tunings
|+Table of common tunings
|-
|-
! Weight-skew\Order !! Chebyshevian<br>(''L''<sup>1</sup> tuning) !! Euclidean<br>(''L''<sup>2</sup> tuning) !! Minkowskian<br>(''L''<sup>infinity</sup> tuning)
! Weight–skew\order !! Chebyshevian<br>(''L''<sup>1</sup> tuning) !! Euclidean<br>(''L''<sup>2</sup> tuning) !! Manhattan<br>(''L''<sup>inf</sup> tuning)
|-
|-
| Tenney<br>Tenney-Weil || || [[TE tuning]]<br>TWE tuning || [[TOP tuning]]<br>
| Tenney<br>Weil || TC tuning<br><br> || [[TE tuning]]<br>[[WE tuning]] || [[TOP tuning]]<br><br>
|-
|-
| Frobenius<br>Frobenius-Weil || || Frobenius tuning<br>FWE tuning ||  
| Equilateral<br>Skewed-equilateral || EC tuning<br><br> || [[Frobenius tuning]]<br><abbr title="Skewed-equilateral-Euclidean">SEE</abbr> tuning || EOP tuning<br><br>
|-
|-
| Benedetti<br>Benedetti-Weil || || BE tuning<br>BWE tuning || [[BOP tuning]]<br>
| Benedetti/Wilson<br>Skewed-Benedetti/Wilson || BC tuning<br><br> || [[BE tuning]]<br><abbr title="Skewed-Benedetti-Euclidean">SBE</abbr> tuning || [[BOP tuning]]<br><br>
|}
|}


Each has a constrained and/or destretched variant. E.g. for TE tuning there is [[CTE tuning]], and for TWE tuning there is CTWE tuning, which is also known as the KE tuning (Kees-Euclidean tuning).  
Each has a constrained and/or destretched variant. E.g. for TE tuning there is [[CTE tuning]], and for WE tuning there is [[CWE tuning]].
 
: '''Note''': in [https://sintel.pythonanywhere.com/ Sintel's temperament calculator], Frobenius tuning is known as ''E tuning'', and CEE tuning is known as ''CE tuning''.


== See also ==
== See also ==
* [[Generator embedding optimization]] – more information on RTT optimization techniques that follow the above concepts but give exact solutions in the form of non-JI prime-count vectors with non-integer entries (e.g. including roots)
* [[:File:MiddlePath2015.pdf|''A Middle Path between Just Intonation and the Equal Temperaments – Part 1'']] ("middle path") by [[Paul Erlich]]
* [[:File:MiddlePath2015.pdf|''A Middle Path between Just Intonation and the Equal Temperaments – Part 1'']] ("middle path") by [[Paul Erlich]]
== External links ==
* [http://x31eq.com/temper/primerr.pdf|''Prime Based Error and Complexity Measures''] ("primerr.pdf") by [[Graham Breed]]
* [http://x31eq.com/temper/primerr.pdf|''Prime Based Error and Complexity Measures''] ("primerr.pdf") by [[Graham Breed]]
[[Category:Math]]
[[Category:Regular temperament tuning]]