Tuesday, August 20, 2024

The Interval Matrix


DRAFT
This article introduces the concept of the interval matrix from a traditional music theory perspective, alongside a software tool designed to create and visualize these matrices. In this context, intervals refer to proportions or ratios between numbers.

The interval matrix is built from all possible representations of a set's values under an equivalence relation, using each element as a base, resulting in a numerical or geometrical table—a matrix—that represents this expansion.

These matrices are not initially intended for conventional matrix operations; the focus lies in the geometric structure that emerges from different sets and their elements' relationships.

Interval Matrix software. Prime numbers up to 19(set to periodic), with equivalence 1:2 (octave-space)
\(\mathbf{Ä}_{1:2}(P_{19})\)


For an infinite set, the matrix cannot be fully generated. However, if the set has a repeating pattern (period), a minimal generating set can be identified. The matrix is then built and completed using this minimal set, (n-by-n) as seen in a common musical tuning system (a set of pitches or rhythms used to create or perform music).

This period typically becomes the primary equivalence relation (equave) parameter in the set's function for constructing the matrix and analyzing the intervals within.

The matrix can be constructed for a finite set that isn't meant to repeat. For example, in music, this approach can be used to analyze notes on an instrument where there's no indication to continue calculating additional pitches. This method applies to any finite set. In a finite matrix, each row contains one element less than the previous row.

Set and matrix construction:

For analyzing a set \(S\) that is already normalized and within the desired range—such as in any pre-calculated musical tuning system—the set remains unaltered, and the matrix is built directly \(\mathbf{A}(S)\). The only required parameter is its periodicity: Is the given set a minimal generating set of an infinite set, or does it represent a fixed, finite number of elements?

Most examples here will use periodic matrices. To denote matrix periodicity or non-periodicity, we might use different notation, such as \(\mathbf{Ä}\) for periodic matrices and \(\mathbf{A}\) for non-periodic ones.

The generalization of the interval matrix construction allows us to relate different sets and reductions, enabling us to find congruences between systems. The reduction function (which corresponds to the chroma function when the space is the octave, 1:2) for a real matrix, where the set consists of any real numbers, operates as follows:

The absolute value of each element is taken, and the function then returns this value, reduced or remapped (if necessary) by an equivalence relation:

For a value \(s_x\) larger or smaller than the chosen equivalence relation \(r\), it is reduced to a new element \(\tilde{s}_x\) by applying the operation:

\(\tilde{s}_x = |s_x| \bmod 1:r\)

(This uses the mod symbol because it effectively returns the intervallic remainder. This process involves repeatedly multiplying or dividing \(s_x\) by \(r\) until \(s_x\) falls into \((1, r]\) space. This page has details about interval reduction.)

Since the matrix is defined by reinterpreting the set values with each element as the base, all rows inherently start with 1. Consequently, the reduction, or normalization, is consistently performed as \(\bmod 1:r\)

Optional: A constant \(\delta\) may be applied to each element of the set before performing the base change.(this in relevant for other uses explained in other article)

The reduction can be notated and performed for sets \(S_{1:r}\) without considering any matrix. It can also be used in constructing the matrix, \(\mathbf{A}_{1:r}(S)\), which implies both reduction and base shifting.

Example: If \(S\) = {1, 2, 3, 5}, then \(S_{1:2}\) ​= {1, 3/2, 5/4, 2}, and \(\mathbf{Ä}_{1:2}(S)\) would yield [{...},{...},{...},{...}]. (reduced and periodic)

Interval Matrix Definitions:

  • Full Interval Matrix: \(\mathbf{A} = \mathbf{A}_{s_n}^{\delta}\)
    This matrix uses the last or largest element of its generating set as the equivalence relation.
  • Local Interval Matrix: \(\mathbf{A}_{s_i}^{\delta}\)
    This matrix uses any element within the generating set as the equivalence relation, except for the largest one.
  • External Interval Matrix: \(\mathbf{A}_{x}^{\delta}\)
    This matrix uses a value outside the generating set as the equivalence relation. 


A full interval matrix built from a periodic set is inherently a symmetric matrix.

A full or local interval matrix is not "useful" for isotropic sets (where the chosen period or relation is a member of the set). This leads to identical and overlapping shifts of the elements.

Musical Interpretation:
For example, the 12-tone equal temperament \(\text{12ed2}\) guitar is an interval matrix (incomplete) representing the infinite set generated by the constant \(2^{1/12}\). Each row is shifted by five elements from the previous row (except between \(\text{G}\) and \(\text{B}\), where the shift is four). The matrix is trivial for this set's intervallic analysis, as columns (frets) are always aligned regardless of the shift or element taken as base.

Interval matrices are tipically shifted by one element until they are complete.

Consider this group: \(\langle 2, 3 \mid 3^2 = 1 \rangle \). This represents a set of infinite fifths and octaves. One of its minimal generating sets is \(S\) = (1, 3/2, 2]. The resulting matrix \(\mathbf{Ä}_{1:2}(S)\) has only two rows:

(1,  3/2,  2]
(1,  4/3,  2]

Interval Matrix Accumulation: \(\text{Acc}(\mathbf{A}(S))\)

This is a new set with all the representations of the elements under the set equivalence relation, which unfiltered, might repeat values, helping to find prevalent proportions. Isotropic sets always have an accumulation identical to any of their matrix rows. (The accumulation is a vectorization or flattening of the matrix)

In this case, the infinite set generated by \(\langle 2, 3 \mid 3^2 = 1\rangle\) = { ..., 1/2, 2/3, 1, 3/2, 2, ...} has an interval accumulation (under the equivalence 1:2):  (1, 4/3, 3/2, 2].

The distinction between full, local and external interval accumulations reflects the matrix type.

For example, consider a local matrix \(\mathbf{A}_{1:2}(S)\) constructed from the set {1, 2, 3, 4} in octave space (with an equivalence relation of 1:2). The local accumulation would be:

\(\text{Acc}(\mathbf{A}_{1:2}(S))\) = {1, 4/3, 3/2, 2} (filtered, with non-repeated values)

To obtain the global or full accumulation, the space is set to the largest element in the set. Thus, the matrix built from the set {1, 2, 3, 4} under the equivalence relation 1:4 would yield:

\(\text{Acc}(\mathbf{A}(S))\) = {1, 4/3, 3/2, 2, 3, 8/3, 4} (filtered)

For larger and more complex sets, the accumulation also provides a method for finding a possible natural mode of the set, if any.

Let’s take the pentatonic \(\langle 2, 3 \mid 3^5 = 1 \rangle\)
a minimal generating set is { (1, 9/8, 81/64, 3/2, 27/16, 2/1] }, its full matrix (omitting 1):

{9/8,  81/64, 3/2,    27/16, 2/1}
{9/8,    4/3, 3/2,    27/16, 2/1}
{9/8,    4/3, 3/2,    16/9,  2/1} Natural Mode
{32/27,  4/3, 3/2,    16/9,  2/1}
{32/27,  4/3, 128/81, 16/9,  2/1}

The natural mode of any set is the particular representation that includes the most frequent values appearing after shifts; it is the most faithful or weighted representation of the set.


How the Interval Matrix App Works

It accepts a list of numbers, treating them always as a minimal generating set(for now).

If the list/set is an already a reduced tuning system, the matrix is full and the equave(period, interval of equivalence) parameter should initially be set to match that of the set, typically the last and largest value. It does not adjust it automatically.

The matrix displays for each element in each row: the original value inserted, the reduced value(if it was reduced), a delta value(if it was displaced), and a rational approximation of the value.

The delta value comes from the delta parameter, usually 0. This value is added to every element in the original set before the rest of the calculations. This is useful for understanding how a minimal set, while maintaining its original absolute difference between members, shapes through this change.

For example, you can start with period/equave 1:2, and this set {1,2,3} reduces to {1, 3/2, 2}, but with delta = 3, it becomes {4, 5, 6}, and reduced, {1, 5/4, 3/2, (2)}.

Prime numbers up to 19. Delta = -1, octave-space.
\(\mathbf{Ä}_{1:2}^{-1}(P_{19})\)

The rational approximation has an adjustable tolerance value.

On top of the interval matrix, there is a configurable equal division ruler that helps with intervallic/ratio measures.

The chroma matrix has a fixed equivalence relation of an octave and, by default, starts at red. You can select whether the chromas displayed are absolute or relative to each row. When selecting relative, the full spectrum located in the bottom UI expands to display all the possible chroma shifts. (The full spectrum isn’t really "full"—you set a maximum space to occupy, with a logical maximum of the human hearing range.)

This last part is the most important when dealing with musical tuning systems; practical tuning systems have a simpler chroma matrix.

Unlike Scala files, the 1 must be inserted (remove it to understand what happens). You can, if you want, omit the equave in this list; it will be added (invisibly) from the equave parameter. However, it’s useful to keep it too, for example, when analyzing a non-octave tuning using an equave 3 (tritave). You can omit it, but if you want to inspect these intervals reduced to an octave, you might want to keep it and track it. So if when the set has an element equal to the equave, you will find two identical rows in the matrix.

Future Development

If you paid close attention to the code of this app and the SFINX app, you may have noticed that they use the same engine. That’s because, as I have pointed out, a guitar is essentially an interval matrix by string length.

My goal is to finally reunite both apps—SFINX was developed to aid in the graphic and diagram generation of scales for microtonal guitars, while the Interval Matrix was developed ideally for geometric analysis of sets and chromas.

(DRAFT)

Link to the apps:

jbcristian.github.io/xeneize/




Sunday, August 18, 2024

Another Aural Temperament or Golden Harmonics




Phi (\(\phi\)) is defined as the arithmetic mean of \(1\) and \(\sqrt{5}\), similar to how the fifth \((3/2)\) is the arithmetic mean of the octave \((2/1)\). This system maps powers of \(\phi\) into \(\sqrt{5}\) space, making it the period. As an interval ,\(\sqrt{5}\) , represents a traditionally consonant (though irrational) ninth, situated between \(16/7\) and \(15/7\).

By stacking and folding (rotations on the circle in log-coordinates) four powers of \(\phi\) into \(\sqrt{5}\) space ( \(\{ (\sqrt{5})^n \times \phi^m \} \in [1,\sqrt{5})\) ), with \(n\) and \(m\) integers, the first five notes (zero index) include unison/identity and four effective powers, implying five quasi-equal divisions of \(\sqrt{5}\).
Similarly, using nine powers of \(\sqrt{\phi}\) approximates a 10-ed√5, which is also close to a 6-edΦ.(see note) 

This introduces a smaller step of about 139¢, forming a suitably sized leading tone, slightly smaller than that in the Bohlen-Pierce scale and 8-edo.

The small difference provides a good initial fifth, approximately \(1.489... = (\sqrt{\phi})^5 \times (\sqrt{5})^{-1}\) It is locally tonic, allowing for 3 or 4 consecutive notes within the "same scale." The next notes, guided by "consonance," align with a different tonal center scale out of phase with the previous one (sparse duodecimability). Additional "belonging" notes appear farther up, as this is an infinite chroma system that avoids near octaves in most practical ranges (nearest at 1253 cents, next at 2368, etc.), while other notes can create a distinct mode/s, as traditionally understood.

The tuning also provides a spanned but functional \(V_7 \rightarrow I\) chord progression (video/audio 1:10).

"Acoustic phi" is dissonant with harmonic timbres, so I avoided it in this guitar solo. It acts as a pivot for the separated tonics, creating a centerless sound.

Why \(\phi\) Acts Like a Generator of \(\sqrt{5}\)-space

The connection comes from expressing \(\phi\) in terms of equal divisions of \(\sqrt{5}\). 
Already at the first step, \(\phi\) itself is an excellent approximation to a rational power of \(\sqrt{5}\):

\(\phi = (1+\sqrt{5})/2 ​\approx (\sqrt{5})^{3/5}\).

Numerically,

\(\phi \approx 1.6180\), (\(\sqrt{5})^{3/5} \approx 1.6206\).

The error here is tiny (~ 833 vs 835 cents), small enough that, for all perceptual and practical purposes, \(\phi\) can be treated as though it were exactly a fractional division of \(\sqrt{5}\).

This means that stacking powers of \(\phi\) within \(\sqrt{5}\)-space is essentially the "same" as running an equal-step generator chain (just like stacking fifths in 12-EDO approximates octaves).

From this perspective: Four powers of φ fold neatly into \(\sqrt{5}\), yielding an effective 5-ED(√5) division. Using \(\sqrt{\phi}\) instead, you get 10-ED(√5) (≈ 139¢ steps), which is the scale i actually play with. (here we get the inexact acoustic phi at \((\sqrt{5})^{6/10}\) ).

edit: i just noticed some type errors in the table graphics,,, and on notation:

In the video, the tuning is described with generators in the form

\( (\sqrt{5})^n \times (\sqrt{\phi})^{m \bmod 10}\), with \(n, m \in \mathbb{Z}\)

 For \(m\), it doesn’t matter whether \(m \in \mathbb{Z}\) or \(m \in \mathbb{N_0}\), as modular reduction absorbs negative values.

For example,

\((−4 \bmod 10)=6\).

To avoid confusion, we can write \(m \in \{0,1,2,…,k−1\}\), so that m explicitly ranges within this set.

---

The Phi “Intervalizations”

In Western music theory, the constant phi has been interpreted as a musical interval in a couple of ways, with the most common being “acoustic phi” and “logarithmic phi.” Acoustic phi takes the normalized value of phi (about 1.618) and treats it as a frequency ratio, similar to how intervals like a fifth are 3/2 or 1.5. An interesting feature of this approach is that the resulting combination tones are also in golden proportion. Logarithmic phi, on the other hand, represents the golden ratio of the octave, calculated directly in cents as 1200 × 0.618 approx 741 cents.
Formulas and calculations vary among authors and theorists, and there are many different ways to interpret or "hear" the golden ratio.

Scala file:

! rphi9-rfive.scl

!
9 powers of square root of phi, mapped into square root of five space. rational approximations with gcd tolerance .000001
10
!
2983/2768
1597/1364
491/386
451/329
1741/1169
987/610
1109/636
646/341
743/361
2207/987



group theory notation https://xcjb.blogspot.com/2024/08/pythagorean-scale-z12z-z.html

Saturday, August 17, 2024

How to compute logarithms (without log function)

This article is a condensed version of the original, where the musical roots of the algorithm and its ancient origins are explored, making it less straightforward to follow. Here’s a clear explanation of how it works, think of it as a tutorial on “how to calculate logarithms in Python/JavaScript without the log function.”

The two Python implementations below are similar, except the second handles arguments in the 0–1 range. To make the logic explicit, both provide the list of consecutive convergents found, excluding the first one if integer.


def mla(a, b, max_q):
    if b <= 1 or a < 1:
        return []
    if a == 1:
        return ["0/1"]  # log_b(1) = 0
    if a == b:
        return ["1/1"]  # log_b(b) = 1

 for p in results]
    results = []
    link, lower, upper = a, 1, b
    p, q = 1, 1
    while q < max_q:
        while link < 1:
            link *= b; p += 1
        while link > b:
            link /= b; p += 1
        if q == 1:
            H = b / link; p += p - 1
        q += 1
        if link == b:
            results.append(f"{p-1}/1"); break
        if lower < link < upper:
            commas = [link/lower, upper/link]
            if (max(commas) - 1) / (min(commas) - 1) <= 2:
                results.append(f"{p}/{q}")
            lower, upper = (link, upper) if link < H else (lower, link)
        link *= a
    return results





The algorithm is a single dynamical template for different coordinate systems: additive (circle rotations), multiplicative (logs / exp / MLA),  angular (trig), and, implicitly, lattice / torus dynamics.
The core object is a rotation on a 1-torus, everything reduces to \(x \mapsto x+\alpha \pmod 1 \) for irrational \(\alpha\) : (Logs: \(\alpha = \log_b a\), angles: \(\alpha = \theta / 2\pi\), continued fractions: best rational returns of this rotation). The MLA is rotation dynamics written multiplicatively.
At a convergent \(p/q\): \(q\alpha \approx p\), the orbit nearly closes, the circle is partitioned into exactly two gap lengths. That’s the Three Gap Theorem at a convergent, this is why the ordering stabilizes, the gap structure simplifies, and discrete group actions suddenly appear. (The “dual cyclic groups”, at a convergent \(p/q\))
Object | Group | Generator
sorted indices | \(\mathbb{Z}/q\mathbb{Z}\) | \(p^{-1} \bmod q\)
overflow terms | \(\mathbb{Z}/p\mathbb{Z}\) | \(q^{-1} \bmod p\)
That symmetry is forced by \(p q' - q p' = \pm 1\) from CFs. So each convergent induces a pair of mutually dual cyclic actions, one “horizontal” (ordering) and one “vertical” (overflow). A lattice/tprus.
The “overflow” sequence is key, from the inequalities: \(\left|\alpha - \frac pq\right| < \frac{1}{q^2}\), MLA tracks modular advancement (floor terms, wrap counts) so that turns Diophantine approximation into explicit dynamics, group actions generated by irrational flow.
Trig case is the same object, replace multiplication with addition, \(\mathbb{R}^+/\langle b\rangle\) with \(S^1\) since \(a^q \approx b^p \quad \leftrightarrow \quad q\theta \approx 2\pi\).
All these computations (Pythagorean Scale/Sanfen-Sunyi, Grover Serach), are the same algorithm acting on different groups, with convergence limited by Diophantine structure.


TGT Details:
The three gap theorem says that for any irrational number \(\alpha\) and any positive integer \(n\), the set of fractional parts \(\{k\alpha\}\) (that is, \(k\alpha \bmod 1\)) for \(k = 1, 2, ..., n\), when arranged on the unit interval \([0,1)\), divides it into at most three distinct gap sizes. It also connects \(\alpha\) and the k values where gap changes relates to its continued fraction expansion. This algorithm uses a logarithmic isomorphism instead of \(k\alpha \bmod 1\); for instance, with \(\log_b(a)\), it looks at the modular remainders of exponential sequences \(a^x \cdot b^{y_x} \in (1, b]\), effectively rotating the \(a^x\) sequence within a modular space of \(b^{y_x}\). It detects when gaps change, marking that a convergent of the continued fraction expansion has been found. As the location of the change narrows, it focuses on comparing only the most recent gaps in that area.

This live demo calculates a few example convergents and renders one of the earlier ones. By default, it’s set to log2(3), showing a list of 10 convergents up to 1054/665, with the graphic displaying the fractional part of 19/12. (7/12)





For more on the music theory behind it, see (link), and for the theoretical basis (group theory, continued fractions, three gap theorem), see (link).

Thursday, August 8, 2024

Pythagorean Scale ≅ Z/12Z ⊕ Z

Pythagorean Scale and Group Theory

The Pythagorean Scale and related tuning systems across cultures exhibit a clear group-theoretic structure, specifically forming finitely generated abelian groups. This analysis reveals that the algorithmic basis of these scales not only defines their musical properties but also implicitly encodes a method for approximating logarithms, as explored in a companion study. This suggests that early music theory, across diverse traditions, may represent a proto-group-theoretic framework with unexpected computational capabilities.

I. The Pythagorean Scale

The Pythagorean Scale is one of the most well-known tuning systems from antiquity and continues to influence Western music theory. While similar intervals and generative methods are found in other cultures (1), the scale remains a fundamental example within the broader Pythagorean framework of number and harmony. Musicians beginning their study of tuning theory often learn about the Pythagorean Scale as a precursor to modern equal temperament (12EDO). However, this characterization is not entirely accurate (2).

A multitude of tuning systems has existed since antiquity, and in modern times, many more have emerged due to the ease of implementation and experimentation with synthesizers and computers. While some contemporary tuning systems employ sophisticated mathematical concepts, group theory is frequently applied to both tuning definitions and musical analysis. Despite the prevalence of textbooks linking music to algebraic structures, the Pythagorean Scale itself has not been explicitly identified as an instance of group-theoretic structure in either musicological or mathematical literature.

Ancient theorists did not conceptualize musical intervals as elements of an algebraic group. Instead, they developed practical tuning methods that implicitly embody group-theoretic principles, driven by the acoustical properties of intervals and human perceptual preferences. Still, it is accurate to describe the Pythagorean Scale (and its cross-cultural analogs) as one of the oldest implicit examples of a finitely generated abelian group (FGAG). This retroactive classification underscores the universality of mathematical patterns in music, even when the underlying theory remained undiscovered for millennia.

This study shows that the group structure is inherent to the algorithm used to construct the scale, as reflected in modern interpretations found in numerous music theory textbooks and historical references (e.g., Boethius, Ptolemy, Guido d'Arezzo, Vincenzo Galilei).

It is important to acknowledge that this analysis presents a specific perspective on the Pythagorean Scale, focusing on its algorithmic structure. Historically, the scale has been interpreted through various lenses, including harmonic theory, philosophical considerations, and perceptual studies. This paper does not seek to invalidate those interpretations but rather to provide a complementary perspective rooted in group theory. The focus remains on the mathematical properties of the algorithm itself, independent of any particular musical application or aesthetic judgment.

Some may argue that labeling ancient tuning systems with modern algebraic terminology is anachronistic without explicit recognition of group axioms. However, in mathematics, it is common practice to retroactively classify structures once their properties are understood. For example, ancient symmetries are now described using group theory.

The following sections will review the historical context, examine the algorithmic generation of the scale, and formalize it using group theory, revealing a direct correspondence.

II. Historical Context & Algorithmic Generation

Many tuning systems share a common foundation, historically referred to as "chaining/stacking and reducing/folding" or its linguistic equivalents (e.g., "encadenamiento y cancelación" in Spanish). This method, exemplified in the Pythagorean tuning system, involves repeatedly adding intervals (specifically, perfect fifths) and reducing the results by octaves (a 1:2 ratio). This principle finds parallels in ancient Mesopotamian and Chinese musical systems, suggesting a universal approach to generating scales and temperaments.

The Chinese sanfen sunyi system, also known as the shí’èr lǜ (十二律) or "twelve-pitch" system, documented in texts such as the Lüshi Chunqiu and the Huainanzi, involves successively raising a pitch by a perfect fifth and then lowering it by an octave. This process closely resembles the "chaining/stacking and reducing/folding" method and results in a twelve-tone scale strikingly similar (identical) to the Pythagorean system. This historical evidence suggests that the concept of generating scales through interval manipulation was present in ancient Chinese musical thought, even if not formalized in group-theoretic terms.

Similarly, recent translations of cuneiform tablets from ancient Mesopotamia (3) reveal sophisticated tuning practices. These tablets describe step-by-step scale generation and document modal relationships as cyclic permutations of interval sequences. This implicit understanding of group-like structures highlights the mathematical depth of early musical systems.

The Algorithm

The Pythagorean tuning algorithm is introduced here in its most common interpretation. While historically (or folklorically) Pythagoras is said to have derived the scale from a monochord, bells, or even hammers (4), the fundamental method remains consistent regardless of the starting point. The arithmetic operations are adjusted accordingly for either string-length or frequency-based interpretations. This study adopts the frequency-based interpretation, as modern music theory represents tuning systems as sets of frequency multiples and provides clear mathematical notation for these operations.

The algorithm can be understood as follows:

1. Establish octave equivalence: Pitches at twice the frequency (or half the string length) are perceived as equivalent, forming a cyclic structure with the ratio 1:2. 
2. Generate new pitches using the perfect fifth (3/2): This interval is derived from the third harmonic (3/1), reduced to the octave range. 
3. Stack fifths and fold back into the octave: Iteratively applying the fifth and reducing by octaves when necessary.

For simplicity, examples use the Pythagorean pentatonic scale, corresponding to the first five notes obtained from the method.

Pythagorean Pentatonic Scale Construction:

- Initial notes: {1/1 (Unison), 2/1 (Octave)}

- Generate the first fifth: 1/1 * 3 = 3/1 → Reduced to 3/2

- Compute another: (3/2) * 3 = 9/2 → Reduced to 9/8

- Compute next: (9/8) * 3 = 27/8 → Reduced to 27/16

- Continue iterating…

Stopping at five iterations for the pentatonic, the resulting scale in ascending order is:

{ 1, 9/8, 81/64, 3/2, 27/16, 2/1 }

\(2^0 \times 3^{0}\)\(2^{-3} \times 3^{ 2}\)\(2^{-6} \times 3^{4}\)\(2^{-1} \times 3^{1  }\) \(2^{-4} \times 3^{3 }\)\(2^1 \times 3^{5 }\)
19/881/643/2 27/162/1

This set embodies the distinct elements of the pentatonic group, excluding octave duplicates.

(Note: The scale is often shifted using a different base, such as 9/8, yielding {1, 9/8, 4/3, 3/2, 16/9, 2/1}. Due to its cyclical nature, the starting point is relative.)

Since the octave serves as a period, the generated set is duplicated to extend the scale across an instrument’s range.

Some may argue that historical theorists, such as Guido d'Arezzo, worked with a fixed number of pitches without explicitly considering infinite extension. However, as musical practice expanded, scales were extended using the underlying infinite representation inherent in the algorithm.

It becomes evident that the algorithm simultaneously generates the group and selects a subset.

A more concise representation of the algorithm considers the exponential sequence {3^0, 3^1, 3^2, ...}, reduced modulo 1:2, and ordered by size. \(r_x = a^x \times b^{y_x} \in [1, b)\).

III. Group-Theoretic Formulation

Defining the Generators

As the algorithm implies, every pitch in the Pythagorean Scale, whether the full 12-tone system or the pentatonic subset or any k-cycle, can be expressed as products of powers of its fundamental generators: the octave (2) and the perfect fifth (3).

These two harmonics serve distinct roles:
- The octave (2/1) functions as a free generator, unrestricted in its powers.
- The fifth (3/2) is constrained by a modular cycle in the pentatonic case, specifically, a 5-cycle.

Thus, each pitch in the pentatonic scale can be represented as a product of powers of these generators. Using standard group notation:
\[
\text{Pentatonic} = \langle 2, 3 \,|\, 3^5 \equiv 1 \rangle
\] where any pitch \( p \) can be written as:
\[
 p = 2^n \cdot 3^{m \bmod 5}, \quad \text{with } n, \; m \in \mathbb{Z}
\] This notation aligns with standard finitely generated abelian group (FGAG) representations, analogous to:
\[
G = \langle a, b \,|\, b^k = 1 \rangle.
\] Group Properties

The structure of the Pythagorean scale follows naturally from the algorithmic process of stacking fifths and reducing by octaves:

- Commutativity: Since multiplication in the frequency domain is commutative, the group operations inherit this property.
- Identity: The unison (1/1) acts as the identity element, represented as \( 2^0 \cdot 3^0 = 1 \).
- Inverses: The group inherently contains inverse elements due to the modular restriction.
- Closure: Any two pitches \( p_1 = 2^{n_1} \times 3^{k_1 \bmod 5} \) and \( p_2 = 2^{n_2} \times 3^{k_2 \bmod 5} \) multiply as:
\[
p_1 \cdot p_2 = 2^{n_1 + n_2} \times 3^{(k_1 + k_2) \bmod 5}
\]Since exponents of 3 are taken modulo 5, results remain within the defined group, ensuring closure.

Structural Clarification

The Pythagorean scale, and its cyclic subsets like the pentatonic, are not built from arbitrary powers of 2 and 3. Instead, each pitch class is of the form: \(p = 2^n \cdot 3^{m \bmod k}, \quad \text{with } n \in \mathbb{Z},\; m \in \mathbb{N_0},\; k \in \mathbb{N}\).

This definition differs crucially from the unrestricted "3-limit tuning group" \(\langle 2, 3 \rangle \subset \mathbb{Q}^+\), where both exponents range freely over \(\mathbb{Z}\), and the resulting structure is infinitely generated and not bounded within an octave.

Here, the modulo operation on the exponent of \(3\) constrains it to a cyclic subgroup of order \(k\), making the set of pitch classes isomorphic to: \(\mathbb{Z}/k\mathbb{Z} \oplus \mathbb{Z}\), which is a finitely generated abelian group: a product of a finite cyclic group (mod-k fifths) and the infinite cyclic group generated by octave shifts.

The operation remains standard multiplication in \(\mathbb{Q}^+\),
But the set is closed under modular identification of one of the generators, resulting in a well-structured group.

Notes:
1.  The 3-Limit is Dense: The set \(P = \{ 2^n \times 3^m \,|\, n, m \in \mathbb{Z} \}\) under standard multiplication is a group (isomorphic to \(\mathbb{Z} \oplus \mathbb{Z}\)), but it represents all possible intervals generated solely by octaves and perfect fifths/fourths. It's dense within the positive rationals and doesn't represent a discrete scale with a repeating structure.
2.  The \(\mod k\) Creates the Scale Structure: The crucial step in defining a specific Pythagorean scale (like the 12-tone or 5-tone) is imposing the cyclic identification \(3^k \sim 1\) (modulo octaves). This is what limits the distinct pitch classes derived from the \(3\) generator to \(k\) consecutive possibilities.


IV. Cultural Analogs

While the FGAG structure has been demonstrated for the Pythagorean scale, other historical tuning systems require careful consideration. For example, the Chinese temperament has a rich and multifaceted history. While many musicologists equate it with the Pythagorean system, some disagree. Given its nuances, a rigorous classification of its group structure needs a separate study.

The Sanfen Sunyi method (三分损益法, c. 500 BCE), which constructs scales by alternating multiplication by \(3/2\) and division by \(3\) (equivalent to multiplying by \(2/3\)), followed by octave reduction. This process explicitly generates a cyclic subgroup of \( \mathbb{Q}^+/\langle 2 \rangle \), aligning with FGAG structures.

A more challenging case is the Mesopotamian tuning system, dating back to 2500 BCE. Cuneiform tablets describe tuning procedures that cyclically permute intervals, akin to generating cosets in a quotient group. While less explicit than the Pythagorean or Chinese systems, this suggests an intuitive grasp of modular arithmetic and group-like structures.

The key controversy lies in interpretation: these tablets do not explicitly reference octaves, fifths, or the numbers 2 and 3. Instead, reconstructions rely on geometric depictions of tuning procedures for the lyre.

Algorithmic Basis of the Structure

The group structure arises naturally from the algorithm rather than any inherent musical qualities. The selection of generators and modular constraints is parametric rather than fundamental. For instance, in this video [link], the scale demonstrated is constructed using the same framework but employs different generators. Instead of the octave and fifth, it uses the golden ratio (phi) and the square root of 5 as the period. \[ \langle \sqrt{5}, \sqrt{\phi} \,|\, \sqrt{\phi}^{10} \equiv 1 \rangle \]
This insight has direct applications in modern music theory, which already incorporates algebraic methods.

Note: different theoretical schools often introduce overlapping terminology. Some branches of xenharmonic music theory, for example, employ group-like concepts but hesitate to fully embrace the existing mathematical framework. The frequent disclaimer that "this group is not a group in the mathematical sense" only adds unnecessary complexity. In reality, both set theory and group theory already provide comprehensive tools for analyzing musical structures, from noise to harmonic organization.

Not all tuning systems can be fully described as groups.

While this study focuses on well-structured cases, many historical systems do not rely on the same principles and may be better understood as sets rather than algebraic groups. However, group theory remains a powerful tool for analyzing ancient musical structures, and many lesser-studied tuning systems may reveal even deeper mathematical properties.

Additionally, while the algorithm itself is simple, it provides a remarkably robust framework, aligning with well-classified FGAG structures. A forthcoming (7) extends this algorithm, revealing that it is one condition away from functioning as a logarithm calculator.

Revisiting ancient mathematical and musical traditions continues to enrich both fields, with potential applications in modern tuning theory, digital synthesis, and mathematical musicology.

V. Conclusion

This study has demonstrated that the Pythagorean scale—and its cross-cultural analogs—exhibits a clear group-theoretic structure. This is not merely a retroactive classification; rather, it underscores the universal and enduring nature of these structures across musical traditions.

The supplementary study, Mesopotamian Logarithm Algorithm, hints at even deeper historical roots, suggesting that ancient musicians may have unwittingly applied mathematical principles that would only be formalized millennia later.

(draft)

VI. Extra:

Isomorphism

The pentatonic group is isomorphic to the direct sum of:
- A cyclic group of order 5 (capturing the modulo constraint on powers of 3).
- An infinite cyclic group (capturing the free octave generator).

Thus,
\[
\langle \text{Pentatonic} \rangle \cong \mathbb{Z}/5\mathbb{Z} \oplus \mathbb{Z}.
\]Defining the mapping:
\[
\varphi(p) = (k \bmod 5, n) \quad \text{for } p = 2^n \times 3^{k \bmod 5}.
\]
For any two pitches \( p_1 = 2^{n_1} \times 3^{k_1 \bmod 5} \) and \( p_2 = 2^{n_2} \times 3^{k_2 \bmod 5} \),
\[
p_1 \cdot p_2 = 2^{n_1 + n_2} \times 3^{(k_1 + k_2) \bmod 5}
\] Applying the mapping:
\[
\varphi(p_1 \cdot p_2) = ((k_1 + k_2) \bmod 5, n_1 + n_2).
\]
In \( \mathbb{Z}/5\mathbb{Z} \oplus \mathbb{Z} \), the operation is component-wise addition:
\[
\varphi(p_1) + \varphi(p_2) = ((k_1 \bmod 5, n_1) + (k_2 \bmod 5, n_2)) = ((k_1 + k_2) \bmod 5, n_1 + n_2).
\]
Since \( \varphi(p_1 \cdot p_2) = \varphi(p_1) + \varphi(p_2) \), the mapping preserves group structure, proving the isomorphism.

Thus, the pentatonic scale is structurally identical to \( \mathbb{Z}/5\mathbb{Z} \oplus \mathbb{Z} \), confirming its classification as a finitely generated abelian group.


Extended Applications of Group Theory

Invariance Under Transposition

Transposition—shifting all pitches by a fixed interval—corresponds to group translation. For instance, transposing by a perfect fifth (\(3/2\)) maps to the transformation:
\[
(m, n) \mapsto (m+1 \bmod 5, n)
\]
in \( \mathbb{Z}/5\mathbb{Z} \oplus \mathbb{Z} \). The invariance of this operation under the group structure confirms the isomorphism, reinforcing the robustness of this algebraic model.


Excluding Specific Harmonic Classes


The classic diatonic group is defined as:
\[
D = \langle 2, 3, 5 \mid 3^4 \equiv 1, \, 5^2 \equiv 1 \rangle.
\]
Initially, every note has a major third. To exclude the major third of "Re" (\(D\)), we identify the subgroup:
\[
H = \langle 2^n \cdot 3^3 \cdot 5 \rangle,
\]
which represents this interval. By forming the quotient group \( D/H \), we impose the relation:
\[
3^3 \cdot 5 = 1.
\]
This effectively removes the "Re" major third while preserving other intervals. This demonstrates how quotient groups can selectively eliminate harmonic classes within a tuning system’s algebraic structure.



\( \text{Golden Harmonics} = \langle \sqrt{\phi}, \sqrt{5}\,|\, (\sqrt\phi)^{10} \equiv 1\rangle \)

Thursday, August 1, 2024

The Average Tuning System: Scala Archive Statistics

Introduction: The Average Tuning System (ATS)

The Average Tuning System (ATS) represents a set of pitches derived from a descriptive statistical analysis of the extensive Scala Archive, a renowned database encompassing a vast collection of global tunings. The primary objective of this investigation was to identify common structural elements and tendencies across diverse historical and contemporary tuning practices, seeking a statistically informed representation of shared characteristics.

A core aspect of the analysis involved interpreting the data under the assumption that most tuning systems within the archive function as periodic pitch sets. To comprehensively assess the interval content, an interval matrix expansion was performed for each tuning file. The rationale for this step is crucial: cyclic permutation and base changes inherent in periodic sets mean that the initially presented sequence of intervals (the "key") may not fully reveal the system's most prominent interval relationships. Matrix expansion calculates all possible intervals generated within the set, providing a complete picture independent of the starting note. This process revealed that while some systems appear distinct initially, expansion shows they are permutations of the same underlying structure (torsors), often highlighting strong internal interval preferences (like the perfect fifth) not explicit in the original file listing.

Despite the potential for the matrix expansion to alter perceived interval prominence, key statistical findings remained remarkably consistent whether analyzing the initial keys directly or the fully expanded interval matrices. The average (mean), median, and mode for the number of notes per system, as well as the ranking of the most frequent intervals (top 10), showed strong convergence in both scenarios, indicating powerful underlying tendencies within the archive.

The analysis navigated inherent challenges related to data representation, including precision issues arising from converting between fractional ratios and cent values, the limitations of decimal representations for logarithmic pitch data, and the effects of necessary truncation and clustering. While acknowledging these potential sources of error (and noting that analysis on a logarithmic scale would be optimal), the fundamental trends in interval popularity and system size proved robust even when accounting for these factors.

Therefore, while not an exhaustive machine learning approach, this descriptive statistical analysis confidently identifies key features:
Dominant Equave: The octave (2/1) serves as the interval of equivalence in over 95% of the analyzed systems.
Common System Size: The statistical average size was 17 notes, with 12 being the median and clear mode. For the ATS, this was refined to 14 notes, considering practical application constraints (e.g., guitar fretting).
Most Prominent Intervals: The analysis yielded a set of the 14 most frequent intervals, forming the basis of the ATS:
 
{16/15, 10/9, 7/6, 6/5, 5/4, 4/3, √2, 3/2, 8/5, 5/3, 12/7, 9/5, 15/8, 2/1}

The ATS, constructed from these statistically prevalent components, offers a unique perspective—a tuning system reflecting the central tendencies found within the diverse tapestry of the Scala Archive.

Further details of the analysis, including specific statistical distributions, graphical representations, data processing considerations, and comparisons, are presented in the following draft analysis section. Further research avenues, potentially involving more sophisticated correlation analyses, remain possible.

DRAFT: 

This tuning system is a simple descriptive statistical representation of the scala archive, a renowned curated database of global tunings, seeking common ground and practical use among diverse world tunings.

Interval    Traditional Western Name
16/15       minor diatonic semitone
10/9        minor whole tone
7/6         septimal minor third
6/5         minor third
5/4         major third
4/3         perfect fourth
√2
3/2         perfect fifth
8/5         minor sixth
5/3         major sixth
12/7        septimal major sixth
9/5         just minor seventh
15/8        classic major seventh
2/1         octave


Statistics and tuning construction:

Out of the 5,176 files, the range of system sizes extends from 2 to 579. The average system size is 17, with a median of 12. The mode is also 12, appearing 1,546 times, followed by 7-note size tunings with 715 occurrences. This signifies a diverse collection, albeit with a notable concentration of systems hovering around the 12-note mark.

Top 5 Sizes

Size  Occurrences
12    1546
7     715
5     231
19    218
8     206


While some files span multiple octaves or include non-reduced intervals below the unison, these instances are relatively rare. Most are periodic tunings in alignment with the octave, the archive's most common interval. (Note: rather than relatively rare, some are intentionally wrong, since scala file definition specifies the omission of the 1, and conclude with the equave, implementations may totally ignore those values)

In a direct analysis of the files, the first key from each tuning, totaling 87,558 notes, reveals the octave as the most common, appearing with its exact representation in 4,481 total files and with close variations in practically all tunings.

The perfect fifth emerges as the second most popular interval, succeeded by the perfect fourth and major third.

Distribution of intervals. The two graphics depict identical data. The first graphic displays both vertical and horizontal axes on a linear scale, while the second utilizes a logarithmic scale for the vertical axis. This logarithmic scale highlights intervals that occur only once, significantly beyond the octave, as well as those appearing below a value of 1.

Top 5 Intervals

Interval  Name              Occurrences
2/1       octave            4481
3/2       perfect fifth     2001
4/3       perfect fourth    1743
5/4       major third       1290
9/8       major whole tone  1095



Assuming all tunings are periodic, cyclical pitch sets, the octave is identified as the interval of equivalence in 4,379 tuning files. The next most common equave is the twelfth, with only 93 files.

When calculating all added tones, the complete interval matrix only for the octave-ending tunings yields a total of 2,641,310 intervals, and the list of the most frequent remains largely unchanged.


The two graphics present distinct datasets. The first graphic represents the scan of the initial key in each file, while the second illustrates the scan subsequent to computing all matrices. Both graphics showcase the top 17 intervals, which exhibit remarkable similarity. Each graph encompasses a single octave, with both vertical and horizontal axes set to a logarithmic scale.


(Why is it important to calculate the interval matrix and added tones to determine the most common intervals?

Take this periodic tuning, for example: 16/15 6/5 8/5 9/5 2/1.

If you're not very familiar with intervals, simply seeing the initial key doesn't tell you anything. However, upon computing the matrix for this 5-note periodic tuning, it reveals 14 unique intervals. Among these, the most common intervals are the fifth (3/2), the fourth (4/3), the major whole tone (9/8), and the Pythagorean minor seventh (16/9) – all of which aren't explicitly mentioned in the "first" key.)

There are precision issues affecting interval categorization, resulting from the conversion of fractions and cents, the dual languages of scala files, to a common decimal representation. This inherits machine number problems. When calculating the complete matrix of equal division systems, where a size of any given number should imply the same diversity, the precision nuances in floating-point arithmetic may lead to some being counted as different.

Another problem arises in categorizing cent tunings. Some files may refer to the same note, but due to differences in the amount of digits in their definitions, no program will consider them equal. (701.955 != 701.95)

You can attempt to correct this by equally limiting the number of digits, which would effectively reduce the number of individual distinct intervals. However, since truncation occurs in their decimal format, an uneven definition loss of musical notes is observed due to their original distribution, which is nonlinear (without repetitions).

The graph represents the tuning space horizontally and accumulates identical exact repetitions vertically.


Both graphics portray identical data, but the second one illustrates the data after truncation (with a maximum error of approximately 0.2 cents). Both visuals display the top 17 intervals, which remained consistent even after truncation. This reduction resulted in 242,538 unique intervals being compressed to just 9,997. The logarithmic view in the graphic also highlights the uneven definition loss of musical notes post-truncation, which was executed on the decimal data.


Progressively truncating the notes in this way, doesn't significantly alter popularity, even a 2-cent error proved insufficient to dislodge any peak prominence.

Additionally, the graph experiences intrinsic truncation due to its fixed resolution, significantly lower than the data range. Consequently, different notes are depicted on the same pixel, this is used to add a third dimension to the graph, highlighting note concentrations, which are always very close to some of the already favored intervals. For example, the perfect fifth has a concentration of notes next to it, hinting at systems like 12-tone equal temperament, where the fifth is 700 cents. However, without altering the graphical scale, these clusters won't even be apparent.


Both graphics represent the analysis of the initial keys, displaying the same dataset. However, the first graphic features a vertical logarithmic scale, while the second employs a linear scale. Presented as a heat map, red areas denote note concentrations (which are not visible in the linear view), while blue indicates fewer notes.

The generated systems employing the 17 most frequent intervals, are symmetric in both cases, reflecting a mirror image via the square root of 2. They comprise half superparticular intervals and half their reduced inversions, the perfect fourth and fifth, major third and minor sixth, minor third and major sixth, etc.

Nonetheless, some of these intervals are very small in practice, which poses minimal concerns for keyboard or synthesizer configurations but imposes constraints upon the guitar's limited space, among other factors that make it less suitable for very precise tunings; and 17 was just the average system size.

The final generated system consists of 13 notes, or 14 when including the square root of 2. This selection exhibits near-complete coverage of the tuning space. Graphically, their common-tone aggregate resembles the added tones for the entire collection, which is interesting. The intervals that were left out from the average 17 due to their proximity haven't disappeared entirely; they remain popular, even surpassing those included, although the major whole-tone was removed from the main key, it still exists in some of the others.


The first image corresponds to the analysis of the full archive's interval matrix, showcasing the 17 most popular intervals. The second image depicts the same graphic process, computing the interval matrix and accumulating the repetitions vertically, but on the newly generated tuning system. The general contour of both is similar, this type of tuning analysis typically provides the fingerprint for a tuning. This means the 14-note system generates a similar fingerprint to the entire database of 2.5 million notes.

The system does not match any of the existing files.

Analysis using subsets of the archive—half or a third selected randomly—still yielded the same most frequent intervals. However, for a more accurate representation of an average world tuning system, it's essential to curate the data better. This would involve handpicking the most well-known tunings that are or were actually in use, rather than relying on the full Scala archive, which contains numerous modern tunings seldom used.


Composition with the average system


Improvisation with the average system


TODO: Additional statistics:

The first ~500 most frequent intervals comprise just, rational, and integer ratio intervals before cent-defined intervals like the octave at 1200 cents appear.

How to:

The program developed for this analysis is open-source and available at [LINK]. It's designed for straightforward usage—simply load any .scl file or files, and it will promptly conduct and showcase statistics on them. The analysis comes in two modes: 'direct' examines files as they are, focusing on the first key, while 'full' generates interval matrices for all files. Notably, the 'full' analysis uses a fixed equave of 2:1, a setting implemented after discovering that 95% of the database concludes with a 2:1 equave. This equave parameter can be adjusted within the code for further exploration and customization.

Tonal Cognition and Quantum Search Analogies

The analogy to quantum amplitude amplification should be understood as a conceptual description of global hypothesis redistribution, closely...