Showing posts with label music theory. Show all posts
Showing posts with label music theory. Show all posts

Tuesday, June 16, 2026

Quasicrystal Drum Machine

Aperiodic Rhythms and the Mathematics of Groove

Musical rhythm does not require repetition. A listener can perceive a distinct groove from balance, distribution, and local predictability, even within an entirely aperiodic structure.

The Rhythm Paradox

What is rhythm? It seems like an easier question to answer than "what is music?", but it might not be. A sonic signal does not contain rhythm by itself. A perfectly random sequence can become rhythmic to a perceiver if the brain manages to find an internal structure within it. Rhythm is not merely an objective property of sound; it is an active cognitive construction.

Why do humans prefer some rhythms over others? Human beat perception is deeply wired into our motor timing systems, with a preferred entrainment range (the speed at which our internal biological clocks lock onto external stimuli) of around a few beats per second.

But music is rarely just a metronome. A groove is not just a clock; it is a fluid relationship between events in time.

Work by music theorist Andrew Milne and others on balanced rhythms shows that many compelling musical patterns share a specific mathematical property: events tend to be distributed as evenly as possible across a given timeline. Listeners routinely prefer patterns where onsets (the starting point of a note or drum hit) are spread out rather than clustered together.

A balanced sequence is one where the distribution of events stays as even as possible. If you divide the timeline into equal sections, each section contains almost the same amount of activity. The rhythm avoids both extreme crowding and extreme emptiness.

In simple terms: events should avoid clustering, spacing should feel stable, and the pattern should contain some internal symmetry or near-symmetry.

But here comes the interesting part: mathematically, balance does not require repetition.

A sequence can be balanced, evenly distributed, and still be aperiodic.

If the distribution of onsets stays roughly uniform through time, the listener can perceive balance even without the pattern ever looping.

If a pattern never repeats, how does it still feel like a rhythm?


\( \mathbb{Z}[\varphi]^2 \rtimes D_5 \)



The Long Rhythm Problem

Humans do not process an entire macroscopic rhythmic structure at once. Instead, we operate with a moving perceptual window.

Cognitive Constraints: Modern psychoacoustics estimates a window of roughly 2 to 5 seconds for rhythmic grouping, and 3 to 8 discrete events for pattern recognition. Beyond that, the brain relies on memory compression, or detail is lost entirely.

If a rhythmic cycle is long enough, the brain stops trying to construct the global loop. Instead, it shifts to tracking local distributions.

Take a riff length of 23 pulses over a 4/4 drum grid. The mathematical cycle might be: \(\text{LCM}(23, 4) = 92 \text{ beats}\) (typical Meshuggah song)

This means the true loop point is massive. Perceptually, a listener's brain doesn't store 92 beats in its working memory. The perceptual window resets constantly.

As a result, the experience transforms from a repeating loop into a stationary statistical texture. The brain stops trying to "solve" the macro-cycle; it simply rides the stability of the pulse, the distribution of onsets, and the consistency of the micro-groove.


Balanced, But Never Repeating: Sturmian Sequences

A Sturmian sequence is one of the simplest examples of an aperiodic but perfectly structured sequence. They are essentially the one-dimensional equivalent of quasicrystals: binary (composed of 0s and 1s), never periodic, yet possessing minimal complexity and an extremely balanced distribution.

Their defining property is the balanced condition: in any two substrings of equal length, the number of 1s (onsets) differs by at most 1. \[\text{If } |A| = |B|, \text{ then } |\Sigma(A) - \Sigma(B)| \le 1\]

Here is an example of a Sturmian sequence acting as a rhythm:

0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0...

Notice that the "hits" (1s) never bunch up, and the "rests" (0s) never create massive gaps. The spacing stays incredibly even, yet the pattern will never loop if extended to infinity. It creates a uniform rhythmic density without a single loop.

The Fibonacci Word

The most famous Sturmian sequence is the Fibonacci word, generated recursively by replacing characters at each step (\(A \to AB\) and \(B \to A\)):

Iteration 0: 0
Iteration 1: 01
Iteration 2: 010
Iteration 3: 01001
Iteration 4: 01001010

Musically, this aperiodic pattern is highly self-similar and deeply tied to the Golden Ratio. Because it is a Sturmian sequence, the spacing between events alternates between exactly two gap sizes (a short gap and a long gap), providing an odd sense of familiarity despite its infinite variation.


Generation via Irrational Rotation

We can generate these sequences geometrically using irrational rotation or Beatty sequences. By tracking when a line crosses a threshold using an irrational slope, we map continuous geometry into discrete time: \[x_n = \lfloor (n+1)\alpha \rfloor - \lfloor n\alpha \rfloor\]

Where \(\alpha\) is an irrational number. When \(\alpha\) is the Golden Ratio (\(\phi \approx 1.618\)), this formula yields the Fibonacci word.

Conceptually, imagine moving around a circle by an irrational step size. Every time you cross a specific boundary line, the drum machine fires. Because the step is irrational, you will never land on the exact same point twice, producing a perfectly uniform, maximally balanced distribution without a single repetition.


Quasicrystal Sequences

Taking this concept further brings us to quasicrystals. Famously found in non-repeating physical structures like Penrose tilings, these sequences are entirely deterministic and non-periodic, yet they possess a strict long-range order.

They are generated via the cut-and-project method:

1. Start with a simple, perfectly periodic grid (lattice) in a higher dimension (like a 2D graph).
2. Angle a narrow "window" or slice through this grid at an irrational slope.
3. Project the lattice points that fall inside this window down onto a 1D timeline.

The result is a rhythm that is mathematically ordered, perfectly balanced, and completely devoid of repetition.


The Quasicrystal Drum Machine

The engine on this page features two interactive implementations of the cut-and-project method to generate aperiodic rhythms for a synthesizer.

1. The Fixed Generator

A streamlined, curated showcase. It features only Play and Stop controls, displaying the generated pattern visually in real time. The underlying parameters are locked to an ideal aesthetic rhythm using the Golden Ratio as its irrational slope.

2. The Exploratory Sandbox

An open interface that exposes the generator's internal parameters, letting you map out the vast landscape of aperiodic grooves.

How the Engine Works

The generator drives a line through a higher-dimensional lattice. When the line captures a lattice point within its projection window, an event is triggered. By altering the geometric rules of this projection, completely distinct rhythmic textures emerge.

A single irrational slope simultaneously generates four interrelated drum voices: Kick, Tom, Snare, and Hit

These voices are not separate, independent patterns. They are different architectural readings of the exact same geometric structure.

The core distinction between the drum voices is the Width of their respective projection windows. By widening or narrowing the window, we change how many lattice points are captured, altering the rhythmic density of that specific drum voice. While some events coincide perfectly and others split apart, all four voices remain tethered to the same hidden geometry.

They aren't playing different songs; they are playing different dimensions of the same shape.


Global Parameters

Angle (\(\theta\)): Controls the slope of the projection line through the lattice. When the slope is irrational, the sequence is truly aperiodic. The presets include various Metallic Ratios (like the Silver and Bronze ratios), which offer distinct flavors of non-repeating structure.

(Note: Because digital computers rely on finite floating-point math, these sequences will technically eventually repeat, but the loop lengths are so massive they are effectively infinite to a human listener).

Sequence Length: Restricts the generator to a finite number of steps, allowing you to intentionally clip an infinite sequence into a manageable, phrase-like cycle.

Tempo: The underlying master clock speed, measured in Beats Per Minute (BPM).


Voice-Specific Parameters

Phase (\(\psi\)): Shifts the starting position of the projection line. This offsets the sequence in time, sliding the groove forward or backward without altering its structural DNA.

Width (\(W\)): Dictates the thickness of the projection window. Larger values capture more lattice points, transforming a sparse, minimalist accent into a dense, rapid-fire pattern.

Start: Adds a localized initial delay offset to structurally decouple voices when looking for micro-polyrythms.




Electronic music featuring quasicrystal ryhthms.

Thursday, August 8, 2024

Pythagorean Scale ≅ Z/12Z ⊕ Z

If you’re familiar with some Group Theory but not much about music theory, especially tuning theory and ancient tuning methods, this article will help you see how they connect. On the flip side, if you know tuning theory, the Pythagorean scale, and common interval manipulations but nothing about Group Theory, this article will guide you in understanding their relationships.

Pythagorean Scale and Group Theory

The Pythagorean Scale and similar tuning systems across cultures exhibit a clear group-theoretic structure,(for example forming finitely generated abelian groups).


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.(i havent found any direct mention, maybe there is, most music theory sits at the silo-obscure)

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 article 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 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 }\)
1 9/8 81/64 3/2 27/16 2/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) modulo the cycle.

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 might not fully embrace the existing mathematical framework. A 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.

Not all tuning systems can be fully described as groups, clearly

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 other 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.

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

draft


V. Conclusion

This is not merely a retroactive classification; rather, it underscores the universal and enduring nature of these structures across musical traditions.

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 [this] study. This suggests that early music theory, across diverse traditions, may represent a proto-group-theoretic framework with unexpected computational capabilities.

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.

Wednesday, July 31, 2024

SFINX - Xenharmonic Guitar Learning App

SFINX 
Stringed Fretted Instruments Notes Explorer



SFINX - (Stringed Fretted Instruments Notes Explorer)

NEW VERSION IS COMING!


1. Introduction


This free web-based app is designed to help you explore and experiment with stringed fretted instruments from traditional to alternative tunings and xenharmonic (micro/macro-tonal) guitars.

Key Features:

  • Generate scales and chord diagrams for custom instruments and tunings
  • Play and find chord progressions on an interactive virtual instrument/guitar
  • Utilize a built-in tuner and fretboard calculator

Basic Concepts:

  • Alternative Tuning: SFINX focuses on exploring alternative tunings that go beyond the usual 12-tone equal temperament. It allows users to design custom tunings using any possible set definition.
  • Virtual Fretboard: The app provides an interactive virtual instrument/fretboard interface to visualize and experiment with different tunings, scales, and chords.
  • Preset Management: Users can save and load instrument and scale presets for quick access and experimentation.

 1.1 General App Workflow 🎸


SFINX accepts any set of pitch values as input. These can be specified in multiple formats:
  • Frequency ratios (e.g., 2:3)
  • Fractions (e.g., 3/2)
  • Decimal representations (e.g., 1.5)
  • Cents (e.g., 701¢)
  • Milioctaves (e.g sqrt(2) is at 500 mocts)
  • Or any combination of the above.

1.1.1 Validation and Range Adjustment

  • The app first validates the set by attempting to map it into the audible range (20–20 000 Hz), even if custom min/max ranges are set.
  • Before defining the guitar’s physical parameters, you can assign any value from the set as the unison at a specific frequency, on a specific string and fret.
  • From this reference point, the tuning system is mapped across the fretboard, taking into account:
    • Number of strings and frets
    • Tuning relationships between strings


1.1.2. Built‑In Tuning Generators


SFINX includes generators for:
  • Equal divisions (EDO/EDx)
  • Group tunings
  • Random tunings for exploration


1.1.3. Default Guitar Setup


By default, SFINX builds:
  • A 6‑string guitar
  • A fret count that does not exceed two octaves
  • A string‑to‑string tuning pattern that mimics a common gauge setup
These parameters are fully customizable, making the app equally useful for:
  • Standard guitars
  • Non‑conventional instruments (e.g., left‑handed 10‑string guitars, 24‑fret extended‑range setups, drop tunings)
  • Microtonal and experimental designs
Finding accurate scales and chord diagrams for such setups is notoriously difficult, SFINX automates it.


1.1.4. Analytical Class System


Analytical classes in SFINX operate independently of both:
  • The tuning definition
  • The guitar’s physical parameters
  • Any class system you create can be transported to another instrument.
  • By default, the app includes:
    • 12‑EDO classes (C, C♯, D, …, B)
    • Common scales saved by name (e.g., Diatonic, Pentatonic)
  • Classes are defined numerically and can be:
    • Named (e.g., “C”, “D♯”)
    • Left as indexed numbers by default
Key Advantage

This separation of tuning, instrument layout, and analytical classes means you can:
  • Apply the same class system to multiple tunings
  • Experiment with alternative analytical equivalences
  • Work with systems that aren’t even EDO, including harmonic series subsets or irrational divisions.

2. User Interface & Controls


2.1 Main Layout Overview: Help(outdated)


Default presets include normal 12ed2 guitar and bass.
SFINX saves presets per browser, allowing you to import and export settings. Overwriting existing presets is possible, but remember to save the instrument preset after creating or modifying scales.

2.2 Instrument Setup

  • Strings and Frets: Define the physical parameters of your virtual instrument. Number of strings and maximum frets per string.
  • Tuning Pattern: Determine the open string note of each string relative to the previous one. This allows for various tuning configurations, including drop tunings.
    Each string you add, also adds a control on its left that sets the open string note in relation with its previous string (that is why the lowest string doesn't have one).
    The standard guitar tuning pattern is 5, 5, 5, 4, 5.
    A one step drop tuning pattern is: 7, 5, 5, 4, 5.
  • Min/Max Frequency: If no reference fret is used, the lowest or highest available pitch in Hertz can be defined from this point, and the rest of the guitar is mapped accordingly. If the guitar's parameters don't match, the range is clipped to the audible spectrum, and an error is displayed for exceeding frets or strings.
  • Reference Fret Mapping: Specify the exact fret and string along with the desired frequency. For instance, the open string (0 fret) of the 5th string can be set to 220 Hz.


2.3 Visualization Tools

  • Interval Rulers: Measure intervals and string lengths for in-depth analysis.
    • The pink ruler marks always the "equave".(the last number in the interval list, or the interval used for the division in equal-division systems, outdated)
    • The fixed green 12ed2 ruler is useful to measure other tunings, since most musicians are familiar with the role of those tempered 12, is easy to relate new tunings using the ruler for quick comparison. (it can be moved)
  • Calculator ruler: Displays a ruler (orange) with the relative size of the string when hovering a fret.
  • Size: Sets the nut to bridge length for calculations. In units.
For deeper interval analysis and measurement beyond the basic tools provided, explore my other app, 'Interval Matrix.'. Unlike SFINX, which focuses on a fixed interval matrix inherent to the guitar, this app offers a more flexible and comprehensive approach to interval exploration. (See Fretboard-Matrix Equivalence)
  • Highlights: Select specific notes on the fretboard to focus on particular scales or chords. The number of notes is determined by the classes.
    Here is where you set the scale to be displayed on the fretboard.
    Each marked note, adds a control for arpeggiate a chord.
  • Chord Pattern: Define the notes for each chord position.
    Each string added, adds a control for selecting a note for the chord-row.
  • Colors: Customize the appearance of notes based on:
    • Single: Plain color.
    • Class: Notes get a unique color by its class.
    • Row: Colorize by chord row, controlled by the chord pattern.
    • Chroma: Notes get a color by their musical chroma(see section 3), this uses a custom sRGB hue wheel, and the root color is red.


2.4 Playback & Sound

  • Arpeggiator: Play notes sequentially in different patterns (up, down, converge, diverge).
  • Speed: Arpeggio note separation speed in seconds.
  • Synth Sound: Choose from available sounds for the virtual guitar.
  • Note Length: Control the duration of played notes.
  • Volume: Adjust the overall volume of the virtual guitar.

Tuning System(outdated)

Decimal Ratio List: The program accepts intervals in decimal ratio, comma-separated. The last ratio represents the octave equivalent.
Equal Division: Divide the octave into a specified number of equal intervals.

2.5 Display Adjustments

  • Width, Length, Zoom: Adjust the visual representation of the fretboard without affecting the tuning or sound.



3. Core Concepts: Basics of Music and Tuning

(the "minimum universal theory")

To understand the complexity and musical possibilities of any system, SFINX focuses on a small set of universal principles. These are the foundations from which any tuning, traditional or experimental, can be explored.

3.1 Tuning Systems – App Philosophy


Just as music resists a single absolute definition, so too do tuning systems. Across music theory, numerous philosophical schools offer different views on what a tuning system is and how it should be analyzed. SFINX is built on a generalized framework designed to accommodate them all. Here, the core axiom is simple: a tuning system is any non‑empty set of pitches. How that set is analyzed, whether by octave, chroma, geometric repetition, or custom equivalence, is personal and flexible.

Understanding Properties of sound perception vs Music Manipulation

The main focus is on distinguishing the types of equivalences that are often confused in music (perceptual, analytical, geometrical).




3.2 Octave


In music, an octave is the interval between a reference pitch \( P \) and another pitch with twice its frequency, corresponding to the second harmonic. More generally, octaves from a reference pitch \( P \) are defined by all frequencies of the form \( P \times 2^n \), where \( n \) is an integer. Related intervals include the double octave (fourth harmonic) and the sub-octave (second subharmonic), among others.

Octaves are perceptually identified as similar, as exemplified by all C notes on a piano. This perceptual equivalence is rooted in the harmonic structure of timbre: in sound sources with harmonic spectra (where overtones align closely with the harmonic series), multiplying or dividing frequency by 2 results in spectral redundancy. No new overtone content is introduced, and our auditory system, evolved in a world saturated with such sounds, detects this redundancy as similarity.

Crucially, the octave does more than suggest similarity; it introduces a cycle. This perceptual equivalence transforms the linear, undifferentiated pitch continuum (spanning roughly 20 Hz to 10-20 kHz, with individual resolution limits around 5-25 cents) into cyclical chromas. Within this framework, pitch difference becomes inferential and relational, allowing tones separated by octaves to be treated as functionally equivalent.

This octave equivalence allows for the transposition of chords and voicings while preserving their musical function. It facilitates transcription across ranges, such as adapting piano music (with ~80 notes) to guitar (with fewer than 30), and supports the substitution of notes with their octave duplicates without significant loss of tonal meaning or structural role.

For a deeper exploration of the octave’s ontological status, see Tonal Constancy.


3.3 Chroma


Chroma denotes the relative position of a pitch within a perceptual cycle. For harmonic timbres, this cycle is typically the octave, meaning the chroma of a pitch remains consistent across its octave equivalents. For example, the 3rd, 6th, 12th, 24th, and 48th harmonics all share the same chroma in octave space; these correspond to the interval of a fifth.

Mathematically, this can be understood by observing that the base-2 logarithms of these harmonic numbers share the same fractional part. In musical contexts, especially within just intonation, logarithmic representations are often avoided in favor of more direct ratio-based reasoning.

A formal expression of chroma is:
\[
\text{chroma}(x) = 2^{\log_2(x) \bmod 1}
\]
Alternatively, using a multiplicative modulo operation:

\[
\Xi(x) = x \bmod 1{:}2
\]
This formulation highlights that chroma is invariant under space scaling, multiplying or dividing a pitch by powers of, in this case, 2 (i.e., \(2^n\), where \(n \in \mathbb{Z}\)) does not alter its chroma. For instance, relative to a reference pitch of 1:1, the chroma of 3, 6, 12, 24, etc. is 1.5, corresponding to the frequency ratio 2:3, a fifth.

Example: Harmonic Instruments


On traditional harmonic instruments like the guitar or piano, a frequency multiple of 5 from the fundamental, i.e., the 5th harmonic (and its octave multiples: 10th, 20th, etc.), corresponds to a major third. In octave space, this maps to the ratio 4:5, meaning its chroma is that of a major third. These harmonics align with the base-2 logarithmic structure of pitch perception, even if the tuning system itself doesn’t explicitly include octaves.

Non-Octave Systems and Timbre Manipulation


Even in systems that omit octaves, such as those based on irrational cycles like π (e.g., a 1:3.14 repetition) our auditory system still tends to perceive pitch relationships through a base-2 logarithmic lens, due to biological conditioning and harmonic familiarity.

However, if the timbre is manipulated such that the perceptual equivalence is based on a different cycle, say, 1:π then the chroma of a pitch becomes relative to that new cycle. In such a system, a frequency multiple of 5 (and all values of \(5 \times 3.14 \times n\)) might no longer be perceived as a major third. Instead, its chroma would be defined by:

\[
\text{chroma}_\pi(x) = \pi^{\log_\pi(x) \bmod 1}
\]
This represents a base-π chroma, and reflects how timbre and spectral structure can reshape the perceptual geometry of pitch space.

Key Insight


Chroma is not an intrinsic property of an isolated pitch. It emerges from the relationship between a pitch and a reference point, shaped by both spectral content and perceptual context. A pitch \( P \) alone does not possess chroma; only when considered in relation to a reference pitch \( A \), do \( P \) and all its perceptual equivalents (e.g., \( P \times 2^n \) or \( P \times \pi^n \)) share a common chroma.

Note: Timbre manipulation and psychoacoustic thresholds continue to challenge and expand our understanding of chroma. As sound synthesis evolves, even the logarithmic perception of pitch may take on new forms.

Next: separating two different invariance concepts that often get conflated because of how Xedo “cheats” by aligning them.

3.4 Geometrical Repetition

(structural / physical invariance, if any)

Definition: 


The smallest positive interval \(R_g\) such that the set is invariant under translation by \(R_g\) in its raw coordinate space (cents, ratios, etc.).
Key point: This is about the actual step size that tiles the set without changing its internal relationships.

Example:


  • In 12edo, \(R_g = 100\) cents, because every pitch is an integer multiple of 100 cents and transposing by 100 cents preserves all interval relationships.
  • In Pythagorean 12-tone, \(R_g = 1200\) cents (the octave), because the steps are not equal , transposing a triad by a single step changes the exact interval sizes, so only a full octave preserves the internal structure.

Details in appendix.

3.5 Pitch Class


In modern music theory, a pitch class (or simply class) is an abstract concept analogous to an equivalence class in algebra. It denotes a set of pitches related by a specific, defined equivalence relation. This relation is not inherently perceptual and can be arbitrarily defined according to the needs of a particular musical system or analytical framework.

In octave-based systems such as 12‑tone equal temperament (12‑TET), the most common equivalence relation is octave equivalence, which causes pitch class and chroma to coincide. However, this is only one possible choice, other equivalence relations can be imposed for analytical or compositional purposes.

A pitch class functions as an assigned label or identifier for a pitch within a defined system. This assignment is absolute for that pitch in the given framework, but it does not inherently:
  • Convey the pitch’s intervallic relationship to other pitches
  • Indicate its harmonic or tonal function

In short, the pitch class names the pitch in the context of the chosen equivalence, but the relationships between classes, and their musical meaning, are determined separately.


3.6 Analytical Equivalence


3.6.1 Definition:

An analytical equivalence is established by choosing a fixed number of pitch classes and defining a modular space within which musical elements, such as scales, chords, and progressions, are analyzed and manipulated.
The number of classes often corresponds to a musically significant interval that serves as the boundary of the analytical cycle, but this is not required. In algebraic terms, these are equivalence classes: once defined, each pitch is assigned to a class, often given symbolic names (e.g., Do, Re, Mi or letter names with sharps/flats).

3.6.2 Key Characteristics


  • Independent of geometry or perception: Analytical equivalence does not depend on the tuning’s inherent geometrical structure or repetition or perceptual chroma.
  • Flexible perspective: You can impose any class system that is useful for analysis, composition, or experimentation.
  • Naming system: Once the equivalence is chosen, pitches are grouped and labeled according to that system, regardless of their actual frequency ratios.


3.6.3 Why It’s Useful


Analytical equivalence allows you to assign a meaningful or informative class system to tuning systems that might otherwise resist simple description, such as irrational divisions of irrational intervals.

Example: 11.5 equal divisions of π:
  • Question: How many notes does it have?
  • Answer: That depends on the analytical equivalence you choose. You could define it to have 10, 15, or any other number of classes for convenience.


3.6.4 Case Study: Equalized Bohlen–Pierce


Often labeled 13ed3:
  • “13” here is not the number of classes, it’s a title indicating the step size (≈146 cents) and its connection to the third harmonic (3/1 tritave).
  • This label is informative about origin and step size, but not directly about how it maps to harmonic instruments like piano or guitar.
  • This system has a near-octave of ≈1180 cents:
    • Melodically, it can pass as an octave.
    • Harmonically, it often sounds “out of tune” relative to octave-based harmony.
    • For chord-building intuition, it can be analytically treated as having 8 classes, since it behaves locally like 8-EDO.


3.6.5 Beyond EDO


Analytical equivalence works for:
  • Non-EDO systems (e.g., harmonic series subsets)
  • Experimental tunings with no obvious periodicity
  • Custom cycles chosen for compositional effect


3.6.6 Extra Example


In a 100-cent step scale (true geometrical repetition = 100 cents), you could define only 2 analytical classes:
  • Class A
  • Class B
Playing only the A’s yields the whole-tone scale, but with the class system acting as a shortcut.


3.6.7 Core Insight


Analytical equivalence is a lens, not a property. It’s the act of deciding what counts as “the same” for the purposes of analysis, naming, and manipulation, free from the constraints of the tuning’s physical structure or perceptual cycles.

3.7 Summary


3.7.1. Octave (or chosen perceptual cycle)

  • The perceptual repetition unit , often 2:1, but could be any, π‑periodic, its always timbre‑based. (subjective thresholds).
  • Turns the infinite pitch continuum into a cyclic space.

3.7.2. Chroma

  • The position within that cycle , the “color” of a pitch, invariant under the cycle’s repetition.
  • In octave space, all C’s share the same chroma; in other cycles, the mapping changes.

3.7.3. Geometrical Repetition (if any)

  • The structural repetition of the tuning itself, the smallest shift that leaves the set’s raw geometry unchanged.
  • In 12‑EDO: 100 ¢; in Pythagorean 12‑tone: 1200 ¢; in other tunings: could be none.

3.7.4. Analytical Equivalence (Classes)

  • The imposed modular space for analysis — how you decide “these pitches count as the same” for naming, chord building, and scale logic.
  • Independent of the tuning’s geometry or perceptual cycles.
  • Lets you treat wildly different tunings with the same symbolic framework.


With just those four, a user can:
  • Load any pitch set into the app.
  • Map it to any instrument geometry.
  • Apply any analytical lens (octave‑based, tritave‑based, custom modulus).
  • Start building scales, chords, and progressions without needing to “speak” a particular school’s theory.

Everything else, cadences, modes, voice‑leading, genre styles, is layered on top of these fundamentals.
it’s theory‑agnostic but still complete enough to navigate the app and make music right away.

3.8 Extra

Analytical equivalence is essentially naming and organizing abstract ratios under a chosen “modulus”, whether that’s the octave, 900 cents, a tritave, or something else entirely. It’s the act of saying “these two pitches are the same for the purposes of my analysis” even if, physically, they’re not the same frequency ratio.

Jazz example:

  • You impose a 900 cent cycle instead of the octave.
  • You treat pitches separated by 900 cents as the same “class”, just like calling them the same letter name in a custom alphabet.
  • This lets you build chord progressions and voice-leading patterns that have their own internal logic, independent of the usual octave-based chroma.

Musicians have been doing this forever, often without formalizing it.
  • Like previous example, in jazz, it’s common to treat certain intervals as “equivalent” for reharmonization tricks.
  • In experimental tuning, analytical equivalence is the key to making sense of irrational divisions or non-octave systems, you pick the modulus that makes the relationships meaningful for your purpose.

The framework then separates:
  • Geometrical repetition (if any), what the set actually repeats at in raw space.
  • Analytical repetition, what you choose to treat as equivalent for naming, analysis, and composition.

That separation is what lets you say:

    > “12edo is analytically octave-based, but geometrically it repeats every 100 cents, and I can choose to analyze it under any modulus I want.”


4. Practical Features


4.1. Instant Fretboard Accuracy


  • Auto‑calculates exact fret positions for any tuning system, including JI, EDO, non‑octave, and irrational divisions.
  • Eliminates manual math errors and saves hours of setup time.

4.2. Microtonal “Test Drive” Before You Commit


  • Simulate any microtonal fretboard before physically modifying or buying a guitar.
  • Compare multiple tunings side‑by‑side to see which feels and sounds right.

4.3. Interactive Learning & Composition Tool


  • Clickable/Playable fretboard — hear notes, chords, and scales instantly.
  • Built‑in arpeggiators and backing track generators for real‑time practice and composition.

4.4. Scale & Chord Visualization


  • Displays accurate diagrams for any tuning, not just standard 12‑EDO.
  • Works with custom analytical class systems, so you can label notes however you want (letters, numbers, symbols).

4.5. Cross‑Instrument Portability


  • Analytical classes and scale definitions can be applied to any instrument layout, not just the guitar you started with.
  • Great for multi‑instrumentalists or luthiers designing new instruments.

4.6. Flexible Physical Parameters


  • Supports non‑standard guitars: extended‑range, left‑handed, drop tunings, altered string counts.
  • Adjustable fret counts, string intervals, and scale lengths.

4.7. Creative Experimentation


  • Try irrational cycles (e.g., π‑periodic systems) or non‑harmonic timbre‑based equivalences.
  • Explore “what if” scenarios for chord shapes, voicings, and modulations in exotic tunings.

4.8. Educational Value


  • Perfect for teaching tuning theory, interval relationships, and fretboard geometry visually.
  • Bridges the gap between abstract theory (interval matrices, chroma, equivalence) and hands‑on playing.

4.9 Shareable, Interactive Setups


  • Because SFINX runs in the browser, you can configure an instrument, set the tuning, define analytical classes, load scales, and even create chord progressions, and then generate a unique shareable URL.
  • Anyone with the link sees exactly what you set up: the same fretboard layout, same tuning, same class system, same progression.
  • Perfect for:
    • Sending musical ideas to bandmates
    • Sharing teaching examples with students
    • Posting microtonal experiments in forums or social media
  • Recipients don’t need to install anything, they just open the link and can interact with the fretboard immediately.


5. Analytical Tools & Visualization


5.1 Color‑Coded Octaves and Chroma Analysis


The infinite, continuous, and cyclical nature of musical chroma parallels the visual spectrum. When color‑coding is applied to musical notation, it becomes a powerful tool for visualizing pitch relationships, whether in complex microtonal contexts or conventional 12‑tone systems.

Perceptual Questions


Color‑coding raises intriguing perceptual issues:
  • Are there enough distinct colors in the visual spectrum to represent subtle pitch distinctions?
  • Where are the perceptual boundaries between adjacent note/color pairings?
  • As Newton observed: “the just confines of the colours are hard to be assigned, because they pass into one another by insensible gradation.”

This is strikingly similar to a core question in music theory: When does one pitch function shift to the next?
Our ears often resolve such ambiguity by prioritizing contextual relationships over exact interval boundaries.

5.1.1 Color in Notation Systems


Many notation systems, from traditional staff notation to MIDI rolls, have experimented with color to represent octave equivalence and pitch classes.
Modern software makes it easy to integrate color‑coding into both microtonal and standard workflows, aiding learning and analysis.

Example (12‑EDO):


In a color‑coded MIDI roll, 12 evenly spaced hues from the sRGB wheel are assigned to the 12 pitch classes, with an arbitrary origin (e.g., red = C).
  • A nine‑note chord might display only three colors, instantly revealing it’s a major triad (R, G, B) without manual interval calculation.


5.1.2 The Spiral Harp: A Case for Color Coding


The Spiral Harp is a virtual instrument that generates pitches from the lengths of spiral polygonal chain segments.
  • It can produce over 1,000 distinct non periodic pitches in the audible range.
  • Traditional labeling is impractical, and enumerating all interval ratios is infeasible.

Solution: Color‑coding by octave equivalence.
  • Strings of the same color share the same chroma and produce consonant sonorities.
  • An alternative sRGB hue wheel is used, revealing not only octave equivalence but also intervallic relationships.


5.1.3 Color and Interval Relationships


Complementary colors (red–cyan, orange–blue, yellow–violet, green–magenta) correspond to tritone relationships.
  • In music theory, the tritone is the geometric mean of the octave:
\[
\text{Tritone ratio} = \sqrt{2}
\]
  • In color perception research, complementary “color attractors” in the spectrum often appear at wavelength ratios approximating \(\sqrt{2}\), a striking cross‑domain coincidence.
  • Unlike perfect fifths and fourths, which invert into each other, the tritone is symmetrical under inversion, reinforcing its ambiguous, “achromatic” quality.


5.1.4 In the App


SFINX supports different independent coloring modes:
  1. By Analytical Class, colors follow your chosen modular analysis (e.g., 12‑EDO letters, custom class systems).
  2. By Perceptual Chroma, colors follow the pitch’s position within the perceptual cycle (octave or other).
  3. Chord-Row.
  4. Plain.
This approach means you can:
  • See how analytical equivalence maps onto perceptual space.
  • Instantly spot consonances, dissonances, and structural patterns, even in dense microtonal textures.


5.2 Interval & Chroma Matrices



5.2.1. Overview


In music theory, interval matrices are analytical tools for exploring the relationships between pitches in a tuning system or scale.
  • Some tunings are octave‑periodic.
  • Others use alternative periods or have no periodicity, potentially generating an infinite number of chromas.


To fully understand such systems, it’s often necessary to calculate pitches beyond the minimal generating set, revealing scale extensions and emergent musical possibilities.


5.2.2. Interval Matrix (Definition)


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

An interval matrix is a table showing the intervals between all pairs of pitches in a given tuning or scale.
  • Particularly useful for non‑equal temperaments or scales with non‑uniform step sizes.
  • In equal temperaments, the matrix contains redundant patterns, making it less informative.
  • Example: The diatonic scale’s interval matrix reveals the characteristic structures of its modes (Ionian, Dorian, Phrygian, etc.).

(Image.5.2.2), sRGB color‑coded interval matrix of the 3‑limit diatonic scale
Group presentation: ⟨2, 3 | 3⁷ ≡ 1⟩
Each row = a cyclic permutation of the scale.
Displayed logarithmically with a 12‑EDO ruler for reference.


5.2.3. Chroma Matrix


A chroma matrix is an extended interval matrix where the octave is fixed as the period.
  • Color‑coding is applied based on octave equivalence by default, and an arbitrary reference pitch.
  • One color in the matrix → the system contains only octave duplications.
  • Multiple colors emerging as pitches are added → the system has infinite chroma.

5.2.4. Analytical Value

  • In octave‑based tunings (even with unequal divisions), chroma matrices have limited analytical value, adding pitches beyond the octave does not produce new chromas.
  • In non‑octave tunings, chroma matrices are far more revealing.

5.2.5. Example: 13‑ED3 (Bohlen–Pierce Equal Temperament)

  • Period = tritave (3:1), equally divided into 13 steps.
  • Interval matrix rows are identical due to equal division and arbitrary choice of equivalence class.
  • Local interval relationships are the same from any pitch, so the global structure is not captured.
  • Chroma analysis (folding the set into the octave) is more informative — here, the chroma matrix acts as an external interval matrix, using the octave as the modulus.


5.2.6. Key Insight

  • Interval matrix → internal relationships within the system’s own period/equivalence.
  • Chroma matrix → those same relationships, but folded into an external reference period (often the octave).
  • Color‑coding makes finite vs. infinite chroma sets visually obvious.

5.2.7 Fretboard-Matrix Equivalence


The “interval matrix” and the “fretboard” are isomorphic representations of the same underlying mathematical object, the only differences are:

  • Domain:
    • Interval matrix → frequency (ratio) domain, fixed period, full permutation of the set.
    • Guitar → string length domain, fixed physical constraints, partial permutation (limited rows, fixed string‑to‑string interval).
  • Permutation scheme:
    • Interval matrix → usually permutes by 1 step through the generating set, producing an \(n \times n\) grid.
    • Guitar → permutes by the tuning interval between strings (e.g., perfect fourths), producing a subset of the full matrix.
  • Period choice:
    • Interval matrix → period is whatever modulus you choose for the analysis (octave, tritave, external element).
    • Guitar → period is implicit in the physical layout (scale length, fret spacing), but you can still “fold” it analytically into any modulus.


Why they’re the same object


Both are visualizations of multiplicative set geometry:
  • The rows are cyclic permutations of the generating set.
  • The columns are positions within the chosen period.
  • The coloring (by chroma, class, or other equivalence) reveals structural symmetries and repetitions.

The guitar is just a physically parameterized, incomplete interval matrix, a “cropped” and “tilted” slice of the full mathematical grid, optimized for human hands.
The interval matrix is the abstract, complete guitar, unconstrained by ergonomics, range, or tuning tradition.


> Any fretted string instrument layout is a partial, parametrized realization of an interval matrix in the string‑length domain. Conversely, any interval matrix can be interpreted as the complete, unconstrained fretboard of a generalized string instrument.

6. Special Topics


6.1 The Impact of Non‑Octave Tunings on Music


6.1.1 Basics


  • Chroma content; the set of distinct pitch positions within the chosen perceptual cycle, is a key factor in understanding any tuning system.
  • If the tuning’s period is the octave (or a power of the octave), the chroma set is finite.
  • If the period is not an integer multiple of the octave, the chroma set is infinite.
  • Infinite chroma sets are theoretically rich but often harder to use in conventional music‑making, especially in collaborative contexts.
  • Octave‑based systems make it easy for musicians to match pitch classes across registers; non‑octave systems require much deeper familiarity to coordinate.

6.1.2 Details


Generating Sets (in the context of tuning)


  • A generating set is a finite collection of pitches (ratios, cents, etc.) from which the full tuning is derived.
  • In instruments and software, this set is mapped across the audible range, whether the system is periodic or not.
  • This is distinct from the abstract group‑theory definition of a generating set.


Finite vs. Infinite Chroma Sets


  • Octave‑periodic tunings (period = 2ᵏ/1) → finite chroma set.
  • Non‑octave‑periodic tunings → infinite chroma set, because no finite set of chromas repeats exactly under octave equivalence.

Example: Bohlen–Pierce (13‑ED3)


  • Often described as having “13 classes” (13 equal divisions of the tritave).
  • On a standard 6‑string guitar tuned in 13‑ED3 (each string a 4th fret above the previous), you actually get 28 unique chromas across the fretboard, far more than the nominal 13.
  • A Bohlen–Pierce piano might have 80 keys, many of which are chromas unavailable to the guitarist.


Practical Implications


  • In octave‑based systems, musicians can play in any register and still match pitch classes (e.g., C major chord in multiple octaves).
  • In non‑octave systems, playing in different “periods” can disrupt harmonic function unless all players know the tuning’s full chroma content and relationships.
  • This makes non‑octave tunings powerful for solo exploration or specialized ensembles, but challenging for traditional collaborative workflows.

6.2 Why Frets Matter in Microtonality


Something a lot of people miss when they imagine “just go fretless” as the universal microtonal solution.

On paper, fretless seems like the ultimate freedom: no fixed grid, infinite pitch choice, no compromise to a temperament. But in practice, the physics of strings and the psychology of pitch perception pull you toward certain “gravitational wells”, the harmonic series, familiar consonances, and the natural resonances of the instrument. That’s why bowed strings like violin, viola, cello tend to orbit tonal centers even in free improvisation: the instrument wants to sing in tune with its own overtones.

Frets, paradoxically, are what let you escape that gravity. They impose a structure that might feel “wrong” at first, but that’s exactly what allows you to:
  • Accumulate subtle interval hacks, 5‑EDO example: stacking 480¢ “sub‑fourths” to land exactly on a 2400¢ double octave, versus 12‑EDO’s 500¢ fourths overshooting to 2500¢. Without frets, hitting those micro‑targets consistently is cognitively exhausting.
  • Exploit non‑intuitive cycles, you can train your hands to navigate a temperament’s quirks without your ear constantly pulling you back to “natural” intervals.
  • Play complex chords in JI or odd lattices, on fretless, the intonation demands for multi‑note chords are brutal; with frets, the geometry locks them in.

So frets aren’t just a fetishized relic of guitar design, they’re a cognitive prosthetic. They let you live inside a tuning system’s logic long enough to internalize it, instead of constantly being dragged back to harmonic gravity. Once it’s in your muscle memory, sure, you can take it fretless and keep the system alive in your hands. But without that scaffold, most players never get past the pull of “natural” intonation.

It’s almost poetic:
  • Fretless = the ocean, infinite but with strong currents.
  • Frets = a map of an invented continent, letting you explore terrain that doesn’t exist in nature.


7. Limitations & Workarounds


7.1 Regarding Fretboard Customization


The application presents certain inherent limitations regarding the direct creation of highly customized fretboard configurations, specifically:
  1. Unique Individual Frets: It is not possible to directly add a single, unique fret at a specific position on only one string without incorporating that interval into the underlying pitch set definition for the entire instrument.
  2. Fret-Skipping Patterns: Creating patterns where entire frets are omitted across all strings cannot be achieved through a direct fret-removal function.
These limitations are not arbitrary but stem from the application's core design philosophy, which prioritizes the generation and analysis of scales and patterns based on consistent, underlying pitch sets. Allowing arbitrary fret additions or removals would undermine this analytical framework. However, practical workarounds exist, grounded in established music theory principles. Understanding these limitations and their justifications clarifies the application's logic, which shares conceptual roots with historical approaches to instrument notation.


7.2 Historical Precedent and Theoretical Foundation


The methodology adopted finds a parallel in historical solutions developed during the Middle Ages for fretted instruments like the cittern. As instrument makers experimented with different fretting patterns (including microtonal variations, just intonation, and skipped frets), tablatures became inconsistent and difficult to interpret across instruments. A crucial development, particularly coinciding with the standardization towards 12-tone temperament, was to number frets according to their position within the complete theoretical chromatic scale, even if the physical fret was absent. (See Duodecimability)

For instance, if a string only possessed a single fret precisely at its midpoint (the octave), it was labeled "fret 12," not "fret 1." This indicated its position within the 12-tone system. This elegant solution not only standardized tablature but also facilitated theoretical understanding. It implicitly treated transposition algebraically (akin to coset shifts in modern terminology), ensuring that musical patterns like chord shapes remained consistent conceptually, even when physical frets varied. Attempting to transpose patterns based solely on naive fret counting on irregularly fretted instruments would quickly lead to inconsistencies.


7.3 Application Context: Timbre and Octave Equivalence


It is pertinent to note that while the application offers various synthesized guitar timbres, all are fundamentally harmonic. This guarantees the perceptual validity of the octave as the primary cycle of pitch repetition. Consequently, the application's chroma-based color-coding system is fixed to octave equivalence, reinforcing the focus on cyclical pitch structures.


7.4 Workaround: Simulating Unique Fret Additions


Consider the scenario of adding a single extra fret to a standard 12-tone guitar – for example, a quarter-tone fret between the 3rd and 4th traditional frets on one string. This might represent a neutral third, a specific microtonal inflection, or serve another modal/contextual purpose.

Directly modeling this single fret addition is not supported. The required workaround involves redefining the instrument's fundamental pitch set to include the desired new interval. This means the interval will be replicated at octave-equivalent positions across the entire fretboard. While a single physical fret might be intended as ornamental, incorporating its pitch interval categorically into the underlying set maintains theoretical consistency.

This approach offers significant advantages:
  • It preserves a coherent, cyclical pitch structure, which is easier to implement computationally.
  • It results in a more intuitive playing and analysis experience, as patterns remain consistent.
  • Chord progressions and scale analyses remain valid across the fretboard. Integrating the new note reveals its systematic relationship within the established structures.
To implement this, you would define the new pitch set using cents notation, incorporating the new interval. For instance, adding a quarter tone (50 cents) near the beginning of the scale: {50, 100, 200, 300, ... , 1200}. Tuning shifts can then be used to position this interval relative to the open string as desired.


7.5 Workaround: Simulating Fret-Skipping


Fret-skipping, common in constructing instruments based on subsets of larger microtonal systems (e.g., selecting specific pitches from 31-EDO), presents a different challenge. It's crucial to distinguish between:
  • Removing specific notes from a system: This is how regular temperaments are often realized (e.g., a 7-note diatonic scale derived from 12-EDO). On a guitar, this might appear as skipped frets, but the same set of notes remains available across the entire fretboard, just spaced differently.
  • Skipping entire frets across all strings: This creates a complex scenario where the availability of specific pitches becomes inconsistent across different positions and octaves.

While it is technically possible to pre-calculate the exact pitches resulting from a fret-skipping pattern and input them as a fixed, non-repeating scale into the application, this is highly impractical for analysis. It essentially defines a unique, non-standard instrument configuration, limiting the applicability of standard analytical tools and pattern recognition.

The recommended and more practical approach mirrors the historical solution: analyze the instrument based on the full, underlying pitch set (e.g., the complete 31-EDO scale if the physical instrument omits some 31-EDO frets). Although diagrams might show chords or scales utilizing frets physically absent on the specific instrument, this method allows:
  • Understanding the underlying theoretical structure and harmony.
  • Identifying alternative voicings or inversions of desired chords/patterns that are physically playable.
  • Avoiding the creation of highly specific notation tied exclusively to one instrument's unique fretting.


7.6 Conclusion


The application's limitations on direct, arbitrary fret manipulation encourage users to work within consistent theoretical frameworks. By defining instruments based on complete, cyclical pitch sets (standard or custom), the application facilitates robust musical analysis, pattern recognition, and understanding of transposition and harmony, echoing effective principles developed historically for managing complex fretting systems. The focus remains on the underlying musical structure rather than idiosyncratic physical layouts.



8. Appendix


Mathematical Formalism of Chroma


Using logarithmic and modular notation makes chroma computation explicit and practical for coding. For example, in Python:

chroma = 2 ** (math.log2(x) % 1)

This method bypasses manual interval reduction (e.g., repeated division by 2 for values > 2 or multiplication for values < 1), offering a direct way to compute a pitch’s position within the octave cycle.

Equivalence Relation and Group Structure


Chroma can be formalized via an equivalence relation on positive real numbers:
\[
x \sim y \iff x = 2^n \cdot y \quad \text{for some } n \in \mathbb{Z}
\]
This defines a multiplicative equivalence class under octave scaling. The quotient space \( (0, \infty)/\sim \) maps naturally to the unit circle via logarithmic and exponential functions:
\[
\frac{(0, \infty)}{\sim} \xrightarrow{\log_2(\bullet)} \mathbb{R}/\mathbb{Z} \xrightarrow{\exp(2\pi i \bullet)} \mathbb{S}^1 \subseteq \mathbb{C}
\]
Or more compactly:
\[
[x] \mapsto \log_2(x) + \mathbb{Z} \mapsto e^{2\pi i \log_2(x)}
\]
This mapping preserves structure and enables the construction of pitch class diagrams, such as the circle of fifths, and even spectral representations like hue wheels, where pitch chroma is visualized on the unit circle in the complex plane.

Musical Implications

This formalism reveals that melodies and chords rely on more than octave equivalence alone. The fractional parts of the log₂ scale, the “colors” of pitch, are essential to musical identity. This becomes especially relevant in tuning systems that deviate from the traditional octave structure, where chroma must be redefined relative to alternative cycles (e.g., tritave, π-periodic systems).

9. References & Further Reading

Interval Matrix, Tonal Constancy, Interval Space Randomness, Spiral Harp, Group Theory In Tunings


Quasicrystal Drum Machine

Aperiodic Rhythms and the Mathematics of Groove Musical rhythm does not require repetition. A listener can perceive a distinct groove from b...