# Elementary spectrum for the dissonance curve: from biophysics to number theory of musical harmony

Alexandre Guillet

<figure><img src="image_1.png" /></figure>

## To cite this version:

Alexandre Guillet. Elementary spectrum for the dissonance curve: from biophysics to number theory of musical harmony. 2025. hal-05124442v1

HAL Id: hal-05124442

https://hal.science/hal-05124442v1

Preprint submitted on 21 Jun 2025 (v1), last revised 24 Nov 2025 (v2)

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Elementary spectrum for the dissonance curve:
from biophysics to number theory of musical harmony

Alexandre Guillet*

Max Planck Institute for the Physics of Complex Systems
Dresden, Germany

(Dated: June 21, 2025)
Abstract

Musical harmony, as the ancient problem of finding tunings and scales based on the commensu-
rability of sound waves, has been approached by Helmholtz in terms of a dissonance curve in the
frequency domain. This model is here recast in an elementary form related to the number theory
and the statistical mechanics of musical intervals and frequency ratios. The idea of the pioneer
of biophysics meets Riemann's zeta function along the imaginary direction, as a model of rational
relationships resulting from the acoustics of a harmonic timbre, and Minkowski's question mark
measure as the statistical distribution modelling the neurocognitive effort to process the lack of
commensurability between sound waves. The spectrum of the resulting fractal curve predicts the
quasi-periods of widely used musical scales, from the pentatonic division of the octave to micro-
tonal ones, thus constituting a biophysical and mathemusical common ground to harmony across
musical genres and cultures.

# I. INTRODUCTION

The scientific study of music encompasses a considerable diversity of fields and ap-
proaches, spanning biology, physics, computer science, neuroscience, linguistics, psychology,
sociology, anthropology, and numerous other disciplines. This flow of temporally encoded
information, perceived or generated, manifests as a particularly low-dimensional gateway to
consciousness phenomena, most often inaccessible behind the complexity of the body, its
environment, and their relationship.

Mathemusic is the transdisciplinary field that employs mathematics as a language to depict this art that we commonly experience and broadly appreciate. It strives to harmonize music theory across musical genres and cultural boundaries, by developing a solfege informed by physical principles, while crafting qualitative and quantitative models applicable to both natural and social studies. The rigidity of such a formal endeavour is met by the imperative to concentrate on sufficiently elementary concepts for a broad application.

Music is considered in this article through the lens of harmonious or disharmonious rela-
tionships between pairs of musical notes. Delightfully complex and diverse musical structures
are here oversimplified to a mean field description of harmony. Concerned with the locally

<footnote>* aguillet@pks.mpg.de</footnote>
periodic components of a musical signal, harmony is here based on the simplest physical and arithmetic models of timbre and interval commensurability. Time-dependent phenomena, such as rhythm and melody, are put aside in this development. The time of the musical signal as a dynamic variable is ignored to embrace harmony through the polysemic concept of frequency: namely by developing successively frequential, spectral and probabilist perspectives.

Harmonic structures that are relevant to this approach are intervals, chords and scales that embed them. By limiting our scope to pairwise relationships between musical notes, hence intervals, we derive mathematical structures that underlie their size, distribution, and regularity. Universal characteristics of musical scales are shown to stem from the interplay between two fundamental concepts from number theory: Minkowski's question mark and Riemann's zeta functions. Their novel albeit familiar interpretation takes its source of mathemusical meaning in Helmholtz's biophysical essay on the sensation of consonance and dissonance [1].

Pairwise harmonic relationships between musical notes capture both notions of musical interval and timbre in terms of distributions of frequency ratios. Difficult to account for in the ancient approach of just intervals, the timbre is of particular significance when selecting musical scales and tunings [2]. At the core of Helmholtz's theory, the concept of *dissonance curve* reflects these two notions and is here reworked in such a way that the underlying number-theoretic objects are exposed and attached with a clear acoustical and neurocognitive interpretation. The outcome of the resulting framework is a concise formula for the spectrum of the dissonance curve, which correctly predicts the quasi-period of widely used musical scales, from the pentatonic division of the octave to microtonal ones.

In Section 2, we decompose the harmonic relationships between musical notes in terms of musical intervals and their timbre. The latter is idealized as a distribution of frequency ratios, whose most elementary model is fully characterized by Riemann's zeta function. Moving on to section 3, we develop a minimal model for the neurocognitive assessment of commensurability. Rooted in the scalar perspective of just intonation, our approach expands through the application of statistical mechanics to frequency ratios as an arithmetic gas. Among the resulting family of singular measures, Minkowski's question mark stands out as the simplest dissonance measure. Section 4 then formulates the concept of dissonance curve in number-theoretical terms, revealing that its spectrum underlies the structure of musical
scales. Finally, Section 5 concludes our discussion with additional remarks on the intricate relationships between music and numbers.

## II. BIOACOUSTICS OF MUSICAL HARMONY

Let us introduce a minimal acoustic description of musical notes (or tones, without distinction since time is ignored), in terms of their pitch, their timbre, and their harmonic relationships, including the musical interval. We start with the physicist's frequential perspective, in relation to the pitch, to reach the mathematician's spectral perspective. The application of Riemann's zeta function to musical tuning [3, 4], in particular along its critical line, is here revisited, and established on a clear bioacoustical ground as originating from rich musical timbres with a harmonic structure of physical frequencies.

### A. Intervals and timbre as distributions

The pitch (or height) of a musical note is usually represented by a frequency $f > 0$, with physical unit in oscillations per second ($s^{-1}$), and the distance between two pitches $f_1, f_2$, the musical interval, by a pure number given by the frequency ratio

$$ \lambda_{12} = \frac{f_2}{f_1} . $$

The additive conception of the interval, familiar to musicians, is recovered by applying a logarithm, preferably in base 2 to imply the octave (frequency doubling) as the unit interval.

A more detailed picture of harmony can be achieved by representing a musical sound as a frequency distribution $s(f)$. In particular, we consider that the physical quantity that is distributed over frequencies is a generic amplitude of the sound wave, which is non-negative. We refrain from using the term “spectrum” here to reserve it for later use, since frequencies $f > 0$ constitute the direct space of musical harmony. Beyond the scalar representation of the pitch, the shape of this distribution reflects certain frequential aspects (with some temporal persistence, such as overtones) of the highly complex texture of the sound, called its timbre. Two notes $s_1(f), s_2(f)$ with different pitches $f_1, f_2$ but with identical timbre can be denoted by the scale invariance

$$ s_1(f) = s_2(\lambda_{12}f) $$
where the scaling factor is the musical interval, assuming the amplitude remains unchanged.

The description of the harmonic relationships between any two musical sounds extends to a distribution of all frequency ratios:

$$R_{12}(q) = s_1 \star s_2(q) = \int_0^\infty s_1(f)s_2(qf)d \log f \quad (1)$$

Applied to the pair of musical notes with identical timbre, the musical interval appears again as a scaling factor in a purely timbre-related distribution: $R_{12}(q) = R_{11}(q/\lambda_{12})$. When comparing a musical note to a sound composed of a set of notes (a chord, a melody or a musical scale), denoted $\sum_{k \in K} s_k(f)$ assuming the additivity of amplitudes, with identical timbre and different pitches

$$s_1 \star \sum_{k \in K} s_k(q) = \int_0^\infty L(\lambda) R_{11}(q/\lambda) d \log \lambda = L * R_{11}(q) \quad (2) \\ L(\lambda) = \sum_{k \in K} \delta(\log \lambda - \log \lambda_{1k}) ,$$

the distribution of ratio is nicely factorized into purely intervallic relationships $L(\lambda)$, here composed of impulses (Dirac deltas) at each interval, “dressed” with purely timbral relationships $R_{11}(q)$.

Suited to these essentially scale-invariant objects, the multiplicative cross-correlation and convolution integrals Eqs. (1, 2) can once again be understood additively as treating the distributions of frequencies and ratios over a logarithmic scale. More details on the multiplicative distributional presentation of the acoustics of musical harmony are given in Appendix A. These frequency distributions may or may not include biophysical or psychoacoustical aspects, such as filters, hearing resolution, pitch or loudness dependencies beyond the scale-invariant description, etc., and could be eventually extended to time-frequency representations.

## B. Elementary model of harmonic timbre

In order to later address the measure of commensurability in harmonic relationships, we now specify the simplest model of timbre.

A typical shape for the frequency distribution, hence for the timbre, is now introduced, neglecting timings and dynamical aspects that are less elementary. A musical sound $s$ is thus
modelled as a superposition of countably many pure waves $n = 1, 2, \dots$, each with positive frequency $f_n$ and non-negative amplitude $a_n$, summarized in a weighted sum of impulses $s(f) = \sum_n a_n \delta(\log f - \log f_n)$. The idealized use of such a singular distribution, modelling infinitely resolved hearing, aims at highlighting essential features that would otherwise be obscured by uncertainty considerations, introduced in Section 4.

Periodic oscillations of the time signal correspond to a harmonic frequency structure, $f_n = nf_1$, which is an essential (although simplified) acoustical aspect of the sound material involved in musical harmony, such as a sung voice. The amplitudes here match the absolute value of the coefficients $a_n = |c_n|$ of the Fourier series decomposition of the temporal waveform. Phases, which determine the waveform shape, are omitted as they relate to timings and are thus considered higher order timbral features. The fundamental frequency $f_1$ corresponds to the pitch, which can still be heard in absence of the fundamental mode ($a_1 = 0$, c.f. the missing fundamental paradox) since it is encoded in the full harmonic frequency structure. We call such structure a harmonic timbre, which may need to be corrected for some inharmonicity when applied to the sound of real instruments.

The numerous possible amplitudes of the partials reflect the diversity of harmonic timbres, even in this simplified frequential approach. Nevertheless, we further restrict the model to a single-parameter harmonic timbre $a_n = n^{-\sigma}$:

$$s_1(f) = \sum_{n \ge 1} n^{-\sigma} \delta\left(\log \frac{f}{nf_1}\right) \qquad (3)$$

$$R_{12}(q) = \sum_{n,m \ge 1} (nm)^{-\sigma} \delta\left(\log \frac{pq}{m\lambda_{12}}\right) . \qquad (4)$$

The exponent $\sigma$ controls the polynomial decay of the partials' amplitude with the harmonic order $n$, hence the strength of the timbre: the limit $\sigma \to +\infty$ corresponds to the scalar (timbre-less) picture of a bare pitch $f_1$, whereas a small value of $\sigma$ represents a rich and bright timbre. Helmholtz considers the case $\sigma = 1$ of the sawtooth wave, which models the displacement of a bowed string without detailing the complex filtering and resonances of the propagated sound wave through the violin. A family of waveforms satisfying Eq. (3) can be represented by the polylogarithm.

Fig. 1 (A-B) provides an illustration of the harmonic relationships between notes with the same elementary harmonic timbre resulting from the typical excitation of a string or an air column in a musical instrument. The amplitude of each harmonic mode in the Fourier
series of the waveform is collected into the frequency distribution $s_1, s_2$ and the phase is left out (A), and their harmonic relationships is factorized according to Eqs. (1, 2) into an intervallic and a timbral part (B).

<figure><img src="image_3.png" /><figcaption>FIG. 1. Representations of the harmonic relationships Eq. (2) between two notes. (A) Note in time and frequency as a Fourier decomposition of the waveform (top), and as an amplitude distribution, with timbre parameter $\sigma$. (B) Interval (left) and timbre (right) as ratio distributions. (C) Riemann's zeta as the spectrum of the timbral distribution (B, right) for different $\sigma$, here normalized by the timbre's power: $|\zeta(\sigma + i\tau u)|^2/\zeta(2\sigma)$.</figcaption></figure>

### C. Riemann's zeta characterizes the elementary timbre

The total weight of the distribution Eq. (3) (the sum of all amplitudes), when finite, corresponds to Riemann's zeta function:

$$ \zeta(\sigma) = \sum_{n \ge 1} n^{-\sigma} . \qquad (5) $$

This holds for weak enough timbres, $\sigma > 1$, and the case $\sigma = 1$ in Fig. 1 (A, B) corresponds to the harmonic series or the pole $\zeta(1)$, i.e. the threshold starting from which the absolute
convergence of the signal's waveform is lost. The existence of a singularity in temporal waveforms exactly described by the elementary timbre with $\sigma < 1$ is a caveat of this one-parameter model. Nevertheless, this regime is still considered as representative of rich harmonic timbres, as long as the total intensity or power of the sound $P = \sum_{n \ge 1} a_n^2 = \zeta(2\sigma)$ is finite, hence as long as $\sigma > \frac{1}{2}$. Indeed, finite-power sounds ensure that the largest weight in the ratio distribution $R_{12}(q)$ is also a finite intensity. Given the unit intensity of the fundamental mode, the power $\zeta(2\sigma)$ is representative of the richness of the timbre: at the critical exponent $\sigma \to \frac{1}{2}$, the timbre is so rich that the sound's power diverges ($\zeta(1) = \infty$), whereas $\sigma \to +\infty$ corresponds to the pure wave, hence the poor “beeep” (the timbre-less description, $\zeta(\infty) = 1$).

In fact, the elementary model of harmonic timbre is fully characterized by Riemann's zeta function, which directly represents the spectrum, in the sense of characteristic function, of the frequency distribution Eq. (3):

$$ \hat{s}_1(u) = \int_0^\infty s_1(f) f^{-i\tau u} d\log f = f_1^{-i\tau u} \zeta(\sigma + i\tau u) , \quad (6) $$

up to a regularized diverging term at $u = 0$ for rich timbres ($\sigma < 1$). The circle constant $\tau = 2\pi = 6.283...$ [5] satisfies Euler's identity $e^{i\tau} = 1$. The first equality is the multiplicative version of the Fourier transform, sometimes called Mellin-Fourier transform.

Notice the arbitrariness of the phase in the complex spectrum Eq. (6), since it depends on the physical unit of the fundamental frequency $f_1$. This ambiguity associated to the pitch is absent from the spectrum of the ratio distribution:

$$ \hat{R}_{12}(u) = \hat{s}_1(u) \hat{s}_2^*(u) = \lambda_{12}^{i\tau u} |\zeta(\sigma + i\tau u)|^2 , \quad (7) $$

here assuming the same harmonic timbre of strength $\sigma$ for two notes separated by the single interval $\lambda_{12} = \frac{f_2}{f_1}$, with $\hat{s}_2^*$ denoting the complex conjugate of $\hat{s}_2$.

The musical interpretation of the Fourier transform with respect to natural logarithm $\log f$ or $\log q$ is facilitated by rescaling the conjugate (Fourier-Mellin) variable as $u \log 2$, with unit in oscillations per octave, see Fig. 1. The observation of larger spectral peaks around 5, 7, 12, etc. repetitions per octave has been connected to the number of notes per octave in widely used musical scales [4, 6], as developed and clarified in Section 4. In physical terms, a cut-off on the variable $u$ introduces a simple scale-invariant model of hearing uncertainty $\Delta f$, with constant quality factor $Q = u_{max} \sim f/\Delta f$.
The factorization of the distributions in Eqs. (1, 2) into a product of intervallic and timbral spectral factors justifies the use of these equivalent spectral representations (the convolution theorem applies). A timbre-less study of (discrete) intervallic distributions $L(\lambda)$ and their spectra (here $\hat{L}(u) = \lambda_{12}^{iu}$) can be found in [7].

In this spectral domain, the elementary timbral relationships $|\zeta(\sigma + i\tau u)|^2$ that enrich intervallic ones take the form of a square by assumption of identical timbre for both notes (complex-valued otherwise). Musical sounds are characterized by rich timbres, hence small values of $\sigma > \frac{1}{2}$, corresponding to high contrast in Fig. 1 (C). Most representative of musical sounds, the limit $\sigma \to \frac{1}{2}$ are critically rich elementary timbres that saturate the auditory range above the fundamental frequency with an asymptotically constant intensity per octave. Drawing a random phase at each harmonic order constitutes a periodic realization of the pink ("1/f") noise. Those critical sounds are the ones addressed by Riemann's hypothesis.

As a last remark, the above model has not specified so far whether the acoustic amplitude of the sound waves is the physical one entering the ear, or a biophysical one in the inner ear. The physical difficulty of a diverging waveform for rich timbres $\sigma < 1$ disappears when $\sigma$ describes the trend of the bioacoustical amplitude in the cochlear frequency-analyser, past the compressive non-linearity $\sigma \mapsto \frac{1}{3}\sigma$ occurring in the hair-bundle amplifiers [8, 9], before the mechano-electrical transduction towards the nervous system.

### III. NEUROCOGNITIVE MEASURE OF DISHARMONY

We now aim at extending from scalar representation to distribution the Pythagorean perspective of consonance as commensurability, which focuses on just intervals modelled as positive rational numbers. Euler's approach consists in defining a metric of the degree of commensurability based on the prime factorization [10, 11]. We define from it a family of statistical distributions on real intervals of either their commensurability, related to the so-called primon gas [12, 13], or their incommensurability. The latter is deeply related to Euclid's algorithm and generalizes Minkowski's question mark measure [14]. We interpret this measure as modelling the probability distribution of the neurocognitive effort to process the lack of commensurability in frequency ratios.
A. Commensurability of just intervals

The sensation of consonance of a musical interval is tightly related to the commensu-
rability of harmonic relationships between the two notes. The just intonation approach is
usually timbre-less ($\sigma \to +\infty$) with a rational representation of the ratio of fundamental
frequencies $q = \lambda_{12}$, called a just interval. We can extend it to any pair of frequencies $f, f'$
with significant corresponding amplitude in each note, represented as a positive rational
number $q = f/f' = a/b \in \mathbb{Q}^+$. The smaller the reduced numerator and denominator $a, b \in \mathbb{N}$,
the more consonant the just interval $q = a/b$.

To list a few (ascending) examples: the unison 1, octave 2/3, fifth 3/5, fourth 4/5, (major) sixth 5/6, major third 7/12, minor third 6/7, etc. Descending intervals are represented by their inverse.

There is a long tradition of quantifying the lack of concordance or pleasantness of just
intervals from their prime factorization $q = \prod_j p_j^{v_j}$ [1, 10, 15, 16]. A degree of disharmonicity
is computed from prime contributions $H(p) > 0$, cumulated with multiplicity:

$$
H(q = \prod_j p_j^{v_j}) = \sum_j |v_j| H(p_j) . \qquad (8)
$$

Such additive number-theoretic functions $H(q)$ extended to rationals are used as a degree of
disharmonicity [3, 10, 15–17]: with prime contribution $H(p)$ equal to $p-1$ for Euler’s gradus
suavitatis (for $H(q) + 1$), $\log p$ for the harmonic complexity or Tenney’s height, $p$ for the
sopfr function or Wilson’s height, or $2(p-1)^\gamma(1-p^{-1})$ for Barlow’s sum of indigestibilities
(especially $\gamma = 1$), many elaborations of the number of prime factors.

The function $d(f, f') = H(f'/f)$ (with $H(1) = 0$) satisfies the properties of a metric [11]:
$H(q)$ is the distance from unison of the just interval $q \in \mathbb{Q}^{+}$, conceived as a vertex in an
infinite-dimensional prime-generated lattice, called the just-intonation Tonnetz [17].

Prime factorization is a costly computation that is likely not implemented in the phys-
iology of hearing. A weaker assumption consists in considering that commensurability is
assessed by effectively running Euclid’s algorithm. In the spirit of its antic formulation for
positive real quantities, both frequencies are compared together by recursively applying the
bivariate function

$$
f, f' \mapsto \min(f, f'), |f - f'| \qquad (9)
$$

until the difference vanishes. For commensurable inputs, the algorithm eventually completes
and returns their greatest common divisor (gcd), here denoted $f \wedge f'$. The coprime pair
$a = f'/(f \land f')$ and $b = f/(f \land f')$ can be then deduced.

The assumption that hearing does not actually implement prime factorization compels us to focus on the metric with prime disharmonicity $H(p) = \log p$. Indeed, $H(q)$ can in this case be computed directly from the knowledge of the irreducible fraction $q = \frac{a}{b}$ alone, and it even has an acoustical realization:

$$H(\frac{a}{b}) = \log ab \quad \forall a, b \in \mathbb{N} \mid \gcd(a, b) = 1 \qquad (10)$$

$$H(f'/f) = \log \frac{f \lor f'}{f \land f'} = \log \frac{\gcd(m, n)}{\gcd(m, n)} \quad \forall m, n \in \mathbb{N} \mid mf = nf' > 0 \quad . \qquad (11)$$

This disharmonicity can be interpreted as the length of the interval between two virtual frequencies, the *bass* and the *whistle* [17], derived from the structure of a harmonic timbre. The *bass* $f \land f' = f/b = f'/a = \gcd(m, n)f/n$ is the outcome of Euclid's algorithm for inputs $f, f'$ (their $\gcd$), physically interpreted as the highest (virtual) fundamental frequency that counts $f$ and $f'$ among its harmonics. Similarly, the *whistle* $f \lor f' = af = bf' = \text{lcm}(m, n)f/n$ is their least common multiple (lcm), interpreted as the lowest coincidence in a pair of harmonic series with fundamentals $f, f'$. The centre of the interval from *bass* to *whistle* corresponds to the (geometric) mean frequency $\sqrt{ff'}$, reflecting the arithmetic relation $\gcd(m, n)\text{lcm}(m, n) = mn$. Note that the $\gcd$ and $\text{lcm}$ can be computed recursively (by associativity) for larger sets of commensurable frequencies, hence generalizing Eq. (11) beyond just intervals to just triads, tetrads, etc.

The case of a non-just interval, idealized as an irrational number $q \in \mathbb{R}^+ \setminus \mathbb{Q}^+$, prevents Euclid's algorithm from stopping and yields an infinite disharmonicity $H(q)$. Each iteration produces a bit of information about the ordering of its pair of inputs. The sequence of bits corresponds to a trajectory in the Stern-Brocot binary search tree. It encodes a converging sequence of rational approximations, summarized as the continued fraction sequence of $q$:

$$q = [c_0, c_1, c_2, \dots] = c_0 + \frac{1}{c_1 + \frac{1}{c_2 + \ddots}}, \quad h(q) = \sum_{j \ge 0} c_j \qquad (12)$$

The approximation process stops after a finite number $h(q)$ of iterations if and only if the interval is just, $q \in \mathbb{Q}^+$. In practice, however, musical intervals or more generally frequency ratios are not known exactly and can be distributed on any positive real values. The next section addresses this limitation of just intonation.
## B. Thermalized lack of commensurability

The assessment of the commensurability of frequency pairs is modelled as a neurocognitive process, statistically and effectively computing Euclid's algorithm. The number of iterations is further assumed to reflect the computational effort, which has some physiological limits. We study below asymptotic distributions of intervals, whose commensurability is established within a certain neurocognitive effort.

Alluding to Helmholtz's energetic interpretation of the dissonance [1], we take a statistical mechanics turn to interpret harmonic relationships as an arithmetic gas [12, 13, 18]. A probability distribution is defined from Boltzmann weights $e^{-\beta H(q)}$ for each just interval $q$, whose energy $H(q)$ is the disharmonicity Eq. (10), the sum of prime contributions $\log p$. The resulting partition function depends on an exponent $\beta$ (an "inverse temperature") and a maximum number $h$ of Euclid's steps in the rational approximation process:

$$ \mathcal{Z}_{\beta,h} = \sum_{q \in \mathbb{Q}_h} e^{-\beta H(q)} = \sum_{\frac{a}{b} \in \mathbb{Q}_h} (ab)^{-\beta}, \quad \mathbb{Q}_h = \{q \in \mathbb{Q}^+ | h(q) \le h\}. \quad (13) $$

In practice, we generate the set $\mathbb{Q}_h$ from Stern's diatomic sequence [19, 20], which provides a non-redundant enumeration of rational numbers in a binary tree called the Calkin-Wilf tree, with permuted order within each height $h$ as compared to the Stern-Brocot tree [21, 22].

The partition function converges for $h \to \infty$ to $\mathcal{Z}_{\beta} = \frac{\zeta(\beta)^2}{\zeta(2\beta)}$ in a "low temperature" regime $\beta > 1$. This form has been interpreted in terms of the mixing of bosonic and fermionic primon gases [13]. It corresponds to a singular statistical distribution over positive rational numbers, similar to Thomae's function with impulses $(ab)^{-\beta}\delta_{\frac{a}{b}}$, proportional to the ratio distribution of the elementary timbre $R_{11}$ (Eq. (4) with $\beta = \sigma$). The standard deviation, mean energy (disharmonicity) and Shannon entropy illustrated in Fig. 2 (A) can be derived in terms of the zeta function in this regime, see Appendix B 1.

In the "high temperature" regime $\beta < 1$, the partition function diverges, and the extensivity of the mean energy and entropy with the computational effort $h$ is visible in Fig. 2 (A). The explicit enumeration of just intervals $\mathbb{Q}_{h \to \infty} = \mathbb{Q}^+$ defined in Eq. (13) is crucial to disambiguate the shape of the distribution on $\mathbb{R}^+$ in the thermodynamical limit.

The normalized distribution for sufficiently many steps in Euclid's algorithm defines an
<figure><img src="image_4.png" /><figcaption>FIG. 2. Statistics of the sonance measure. (A) Standard deviation $\langle (\log q)^2 \rangle^{1/2}$, mean energy (disharmonicity) $\langle H(q) \rangle$ and Shannon entropy as a function of $\beta$ for increasing $h$ (lines) and limit case $\beta = -\infty$ (marker), associated to the partition function $Z_{\beta,h}$. (B) Cumulative distribution function $\mathcal{G}_{\beta}(q)$ for $\beta < 1$ (left) and $\beta > 1$ (right) in the limit $h \to \infty$: Minkowski's question mark and the golden ratio $\phi = 1 + \phi^{-1}$ appear for $\beta = 0$ and $-\infty$ respectively.</figcaption></figure>

asymptotic probability measure $d\mathcal{G}_{\beta}(q)$ that we call the sonance measure [23]:

$$ \int_0^\infty R(q)d\mathcal{G}_{\beta}(q) = \lim_{h \to \infty} \mathcal{Z}_{\beta,h}^{-1} \sum_{\frac{a}{b} \in \mathbb{Q}_h} (ab)^{-\beta} R(\frac{a}{b}) \quad , \quad (14) $$

for suitably regular test functions $R$. A smooth unit-weight kernel $\psi$ modelling the hearing uncertainty around an exact musical interval $\lambda$ provides an example: $R(q) = \psi(Q \log \frac{q}{\lambda})Q$, where the quality factor $Q$ represents a finite resolution.

For numerical efficiency, the spectrum of the sonance measure:

$$ \tilde{\mathcal{G}}_{\beta}(u) = \int_{0}^{\infty} q^{-i\tau u} d\mathcal{G}_{\beta}(q) = \int_{0}^{\infty} \cos(\tau u \log q) d\mathcal{G}_{\beta}(q) \quad , \quad (15) $$

can be estimated once, and the measure of a distribution $R$ is obtained as the scalar product of the spectra: $\int \hat{R}(u) \tilde{\mathcal{G}}_{\beta}(u) du$. To prevent ambiguities with the cumulative distribution
The tilde denotes the spectrum of the singular density of the measure relative to log q. The regime $\beta > 1$ yields $\tilde{\mathcal{F}}_\beta(u) = |\zeta(\beta + i\tau u)/\zeta(\beta)|^2$ as in the model of timbre Eq. (7) (with normalization and $\sigma = \beta$), but the regime $\beta < 1$ differs.

The resulting family of singular measures are fractals, see the cumulative distributions in Fig. 2 (B). A transition from horizontal to vertical steps at each rational number happens at the critical sonance exponent $\beta = 1$, specific to the energy $H(\frac{a}{b}) = \log ab$. We can thus designate the sonance measure as rational (a consonance measure) for $\beta > 1$, and as irrational (a dissonance measure) for $\beta < 1$. The scalar case is recovered at “zero temperatures”: the sonance measure is only supported on $q = 1$ (the simplest rational number) for $\beta \to +\infty$, and on the golden ratios $q = \phi^{\pm 1} = \frac{\sqrt{5}\pm 1}{2}$ (the simplest irrational numbers) for $\beta \to -\infty$. Indeed, negative temperatures $\beta < 0$ favour large disharmonicities, which are maximized for Fibonacci fractions at each iteration, see details in Appendix B 2.

The high temperature limit $\beta = 0$, with maximum entropy, is an interestingly peculiar irrational measure. Its cumulative distribution function is known as the extension to $\mathbb{R}^+$ of Minkowski's question mark function $? (x)$ [14]:

$$ \mathcal{F}_0(x) = \int_0^x d\mathcal{F}_0(q) = ?(\frac{x}{x+1}) \qquad (16) $$

$$ \tilde{\mathcal{F}}_0(u) = \int_0^1 \cos(\tau u \log q) d? (q) , \qquad (17) $$

extensively studied by Giedrius Alkauskas [24], who has first drawn its spectrum, see Fig. 4.2-4 of his thesis or Fig. 3 (A, top). The relationship between cumulative distributions is more understandably written $\mathcal{F}_0(x) = \frac{? (x)}{2}$ for $0 \le x \le 1$ from its self-similar property.

This special case $\beta = 0$ is particularly generic as it does not depend on the specific choice of an energy or disharmonicity Eq. (8). It does not rely neither on finding prime factors nor on identifying coprime pairs. This maximum-entropy distribution on $\mathbb{Q}^+$ only depends on the above-defined enumeration $\mathbb{Q}_{h \to \infty}$: it is the limiting equiprobability distribution of intervals found to be commensurable in a sequence of increasing computational effort $h$. Therefore, Minkowski's question mark measure can be applied to distributions of frequency ratios as the neurocognitive effort to process their lack of commensurability. Set in the glyph of this exotic function, Minkowski's century old question has found a musical answer: $\mathcal{F}_0(x)$ is the simplest dissonance measure [25].
## IV. FROM DISSONANCE TO MUSICAL SCALES

Now that the acoustics and the neurocognition of musical harmony have been modelled in terms of an idealized timbral distribution and a generic irrational measure, we combine them to propose an elementary number-theoretic model for the sensation of dissonance. This dissonance model revisits Helmholtz’s phenomenological construction [1, 26] based on the sum of elementary roughness contributions from every possible pairs of harmonic frequencies from two simultaneous musical notes. It also provides a theoretical framework for existing tuning methods that relate the timbre of an instrument to the choice of musical scales [2].

### A. Dissonance and its spectrum

Dissonance is conceived as a measure of the lack of commensurability in the harmonic relationships between two sounds, captured by a cross-correlation $R_{12} = s_1 \star s_2$ between their frequency distributions as in Eq. (1). Derived as a thermodynamical limit of a statistical and computational approach of just intonation, the sonance measure $d\mathcal{G}_\beta(q)$ defined in Eq. (14), fulfils the expectation of a dissonance for an exponent $\beta < 1$. In particular, the maximum-entropy case $\beta = 0$, known as Minkowski’s question mark, is an especially elementary dissonance measure, resulting in a generic model for the dissonance between any two sounds:

$$D_{12} = \int_{0}^{\infty} s_{1} \star s_{2}(q) d\mathcal{G}_{0}(q) = \int_{-\infty}^{+\infty} \hat{s}_{1}(u) s_{2}^{*}(u) \tilde{\mathcal{G}}_{0}(u) du \quad (18)$$

Reminiscent of Helmholtz’s weighted sum of roughness contributions for each pair of partials, see Appendix C, the dissonance between two sounds is therefore defined as the cumulated intensity associated to pairwise harmonic relationships, weighted by the neurocognitive effort to process their lack of commensurability.

Note that $\frac{3}{4}$ of this dissonance measure is supported within $\frac{1}{3} \le q \le 3$. This interquartile range may be enlarged by increasing the sonance exponent to e.g. $\beta = \frac{1}{2} < 1$, see Fig. 2, for an enhanced sensitivity to the commensurability of larger intervals.

Originally, Helmholtz’s dissonance is a function of the pair of variable pitches of the notes: $D_{12} = D(f_1, f_2)$. Assuming that the scaling invariance of the frequency distributions $s_1, s_2$ represents the pitch transposition with identical timbre, then the dissonance is a function of the musical interval only: $D_{12} = D(\lambda_{12})$.
The elementary model of harmonic timbre Eqs. (3) to (7) results in a number-theoretic expression for the (Mellin-Fourier) spectrum of the dissonance $D(\lambda) = \int \hat{D}(u) \lambda^{i\tau u} du$:

$$ \hat{D}(u) = |\zeta(\frac{1}{2} + i\tau u)|^2 \tilde{\mathcal{G}}_0(u) \quad . \qquad (19) $$

The influence of a generic rich harmonic timbre is represented by Riemann's zeta function along its critical line. The dissonance spectrum can be tailored to a specific timbre by replacing the generic zeta model by the square of the Fourier-Mellin transform of the actual amplitude spectrum. While somewhat radical, the limit $\sigma \to \frac{1}{2}$ has been selected as most pertinent to the acoustics of musical harmony, as opposed to the timbre-less limit $\sigma \to \infty$. The special case $\sigma = 1$ considered by Helmholtz is problematic in the elementary zeta model, because it introduces a non-regularized divergence (at $u = 0$). Weaker timbres $\sigma > 1$ are mostly influenced by the second harmonic beside the fundamental. The regularized divergence at $u = 0$ for rich timbres $\sigma < 1$ lets dissonance values be negative or positive.

The musical relevance of $|\zeta(\frac{1}{2} + i\tau u)|^2$ hinted in Fig. 1 is most striking when decoded with $\tilde{\mathcal{G}}_0(u)$ in Fig. 3 (A). Let us unfold their meaning step by step. The spectra of the timbral relationships and the dissonance measure both represent tendencies for periodicities in the associated distributions over frequency ratios. In particular, the sign of the spectrum $\tilde{\mathcal{G}}_0(u)$ visible in Fig. 3 (A, top) indicates the tendency for dissonance (if positive) or consonance (if negative) of a pair of timbre-less pitches approximately distant of multiples of a fraction $(u \log 2)^{-1}$ of the octave. The dissonance spectrum Eq. (19) in Fig. 3 (A, bottom), which exhibits deep absorption rays, has the same interpretation for pitches associated to a rich harmonic timbre.

Without defining an exact set of pitches, the tendency for consonance for a quite regular repetition of certain intervals is a clear design principle for musical scales. Before further describing consonance-generating intervallic frequencies $u$ from the dissonance spectrum Fig. 3 (A), we discuss the revised shape (B) of the dissonance curve and its physical source of regularization.

## B. Uncertainty smooths the dissonance curve

Musical sounds idealized as singular frequency distributions of the amplitude, of the form $s = \sum_n a_n \delta_{fn}$ such as the elementary harmonic timbre Eq. (3), yield an ill-defined disso-
<figure><img src="image_5.png" /><figcaption>FIG. 3. Dissonance spectrum (A) and curve (B). (A) Mellin-Fourier spectral factors (top) representing a rich harmonic timbre ($\sigma = \frac{1}{2}$), the dissonance measure ($\beta = 0$), and the resolution of a musical ear (with a large quality factor $Q = 80$). Their product (bottom) is the dissonance spectrum Eq. (19) (grey if filtered due to hearing uncertainty). (B) Dissonance curve (top), with upward and downward-pointing markers at quadratic irrational and rational numbers respectively, compared to Helmholtz's model (bottom).</figcaption></figure>

nance value, either vanishing or diverging. This constitutes a caveat of a purely frequential approach with unlimited resolution, which should ultimately be constrained by the temporal hearing resolution $\Delta t$ according to Heisenberg's uncertainty principle [27, 28], $\Delta f \Delta t \ge 1$. A finite dissonance value is recovered by taking into account the limited frequency resolution of hearing, which can be included in the definition of the frequency distribution $s(f)$ by smoothing the ideal impulses $\delta$ into finite-width frequency peaks $\psi$.
In practice, the highly singular fractal curve resulting from the ideal distribution is regularized by an uncertainty operator, which, in its simplest form, is a low-pass filter setting the frequency resolution with a constant quality factor $Q \sim f/\Delta f$:

$$D(\lambda; Q) = \int_{-\infty}^{+\infty} |\zeta(\frac{1}{2} + i\tau u)|^2 \hat{\psi}^2(u/Q) \tilde{\mathcal{G}}_0(u) \cos(\tau u \log \lambda) du \quad (20)$$

In Fig. 3 we choose the filter $\hat{\psi}^2(x) = (1+(\pi x)^2)^{-1}$ for a progressive cut-off around a constant quality factor $Q = 80$ to model the accuracy of a musician's ear. A smaller value of $Q$ yields a less detailed version of this fractal curve, hence describes a lower training of the ear.

Local minima of great depth in the dissonance curve, Fig. 3 (B, top), are associated to the main consonant intervals. As $Q$ increases, more rationals (just intervals) but also quadratic irrationals are identified as prominent local minima and maxima respectively.

For an ideal ear that would optimize the time-frequency uncertainty bound, the quality factor directly reflects the auditory integration time in number of periods. It is quite clear from this consideration that quality factor of the ear decreases at low frequencies [29, 30], and its time-frequency resolution is not optimal, especially at high frequency [27].

Beyond the first order description of hearing with a constant quality factor, the uncertainty filter in Eq. (20) may in fact vary with the pitch or the frequency. An explicit pitch dependence can be introduced with a minor modification by combining the pitch, timbre and uncertainty models as $\hat{s}_k(u) = f_k^{-i\tau u}\zeta(\sigma + i\tau u)\hat{\psi}(u/Q(f_k))$ for each sound $k = 1, 2$ in Eq. (18). The same strategy of including the hearing measurement uncertainty in the representation of each sound $s_k$ can apply for a frequency-dependent resolution.

However, the uncertainty operator in Helmholtz's model of dissonance is not only frequency-dependent but also cannot be reduced to each sound's independent measurement, since it precisely expresses their interference in the cochlea. Therefore, we eventually introduce the more general situation of a dissonance landscape $D_{12} = D(f_1, f_2)$ resulting from a symmetric uncertainty operator $\Psi$ expressed as an integral kernel:

$$D_{12}(\Psi, \beta) = \iint_{-\infty}^{+\infty} \hat{s}_1(u_1) \hat{s}_2^*(u_2) \hat{\Psi}(u_1, u_2) \tilde{\mathcal{G}}_{\beta}(\frac{u_1+u_2}{2}) du_1 du_2 . \quad (21)$$

The case of Helmholtz's construction involves no dissonance measure ($\beta \to +\infty$) but an uncertainty operator with two distinct quality factors: a constant one and another one proportional to the frequency, see details in Appendix C. These parameters relate to the bimodal shape of Helmholtz's kernel, which models the sensation of roughness associated
to interfering excitations of the basilar membrane. Devised for simultaneous sounds, this
particular kernel yields prominent dissonance maxima around each consonance, see Fig. 3
(B, bottom). Those are absent from the simpler cut-off approach (B, top), which we picture
as more generic and applicable to non-simultaneous sounds.

Although not developed here, the formulation by Paul Erlich of a dissonance curve as a
harmonic entropy [2, 3] can be asymptotically linearized into the present formulation, with
a cut-off as uncertainty and a minus sign. In spite of its timbre-less and probabilist framing
with a sonance exponent $\beta = \frac{1}{2}$, its alternative enumeration of rationals with a threshold
on the disharmonicity Eq. (10) leads to the zeta model instead of a dissonance measure,
as shown by Mike Battaglia in [3]. The resulting analytic continuation of the consonance
measure below the transition point $\beta < 1$ may be reinterpreted in terms of a rich harmonic
timbre $\sigma = \beta$.

This development highlights the sensitivity of a quantitative approach of dissonance to
the specific modelling (on biophysical, psychoacoustical, individual, statistical or practical
grounds) of the hearing uncertainty. The identification of different forms of uncertainty
operator $\Psi$ may help resolve the longstanding debate over the definitions of dissonance,
discordance, roughness, and related concepts.

Remarkably, the specificities of the listener's perception can also be attributed to the
uncertainty operator $\Psi$. The objective instrumental timbre and computational structure of
commensurability can be examined independently by returning to the model Eq. (19) of
dissonance spectrum, keeping in mind the physical necessity of filtering its high intervallic
frequencies.

### C. Consonance quasi-periodicities and musical scales

Musical scales are discrete sets of pitches, spaced with varying regularity, forming intervals
that comprise or at least approximate the most consonant ones. The regularity (or evenness)
of the scale facilitates musical transposition, the scaling transformation that manifests the
physical scale invariance of harmony. However, this very desirable property conflicts with
the lack of periodicity of consonant intervals.

Musicians have developed numerous practical solutions to this problem. The most reg-
ular scales (with the least overall dissonance) are said with equal temperament. They are
typically chosen with a sufficiently small generating interval to embed many coarser and less regular scales. The more consonant scales can have some degree of regularity in their unevenness, such as periodic patterns generated by two intervals (diatonicity) or more. A higher consonance is often achieved with corrections to the regular embedding of these patterns (comma) at the expense of the equal temperament. These regular structures are naturally reflected in the intervallic quasi-periodicities of the consonance, which are precisely summarized in the spectrum of the dissonance curve.

The dissonance spectrum in Fig. 3 (B, bottom) reveals prominent absorption rays (negative peaks) that directly represent quasi-periods of consonances. Surprisingly, quasi-periods of dissonance (at positive peaks) for the model Eq. (19) are observed to be much less prominent. These rays are located close to integer values of the intervallic frequency $u \log 2$, expressed in number of oscillations per octave. In physical, mathematical or musical terms, this phenomenon results from the influence of even harmonics in the timbre, of the prime number 2 in shaping Riemann’s zeta function, or the octave equivalence.

The finite width of these rays reflects the lack of exact periodicity. The consonant generating intervals associated to the coarsest quasi-periods, at low intervallic frequencies in Fig. 3 (A, bottom), are unambiguous: they represent successions of octaves (1), of fifth and fourth (2), of fourth, major and minor thirds (3), to reach the ubiquitous pentatonic scale (5). Taken individually, the next quasi-periods also relate to widely used scales: the heptatonic scales (7), in particular the diatonic, the chromatic scale (12) that embeds the two previous ones, itself embedded into microtonal scales (19, 31, ...), which also embed a combinatorially large diversity of intervals and less-regular scales beyond the scope of the 12-tone paradigm. The combination of these primary quasi-periods, refined by secondary ones (10, 15, 22, 41, 46, 53, ...), encodes rich regular patterns in the structure of musical scales and harmonic structures in general.

The prominent microtonal quasi-period at 31 notes per octave was already recognized by Christiaan Huygens via early applications of the concept of logarithm. It has motivated Adriaan Fokker to design a thirty-one-keyed organ [31], whose keyboard layout nicely generalizes the black (5) and white (7) embedding of the piano.

Buried in the hearing uncertainty at higher intervallic frequencies, the existence of a particularly deep ray of quasi-period 72 per octave suggests that a universal solfège for rich harmonic timbres needs not consider finer intervals the division of the octave into 31 exactly
or approximately even steps, possibly enriched (halved) by flat and sharp alterations, for a correct embedding of subtle microtonal structures played and sung across the world.

# V. CLOSING REMARKS

## A. Beyond the elementary harmonic timbre

*Odd timbre of clarinets:* The sound of closed pipes such as the clarinet tend to concentrate their amplitude at odd harmonic orders [28]. This type of odd timbre can still be idealized in terms of the elementary zeta model by cancelling the influence of the prime number 2 using Euler's product formula $\zeta(x) = \prod_p (1 - p^{-x})^{-1}$. The resulting alteration of timbral relationships $|\zeta(\sigma + i\tau u)|^2$ with another spectral factor $|1 - 2^{-\sigma - i\tau u}|^2$ enhances the influence of the next prime numbers on harmony, in particular $p = 3$. Truncating Euler's product formula or selecting its prime contributions connects the zeta model of harmonic timbre to the prime-limited approach of just intonation.

Specific rays appear in the resulting dissonance spectrum with consonance quasi-periods near 8.2, 16.4 and 24.6 per octave, in addition of the previously cited ones, and dissonance quasi-periods are comparatively more prominent. The novel consonant structures correspond to quasi-periods of 13, 26 and 39 notes per frequency tripling, the first of which is known as the Bohlen-Pierce scale for clarinet.

*Inharmonicity of real instruments:* In practice, the tuning of instruments needs to take into account many real-world complexities such as a pitch-dependent inharmonicity. For instance, the inharmonicity of piano or guitar strings can be modelled as $f_n = n f_1 \sqrt{1 + \epsilon n^2}$, where the small inharmonicity coefficient $\epsilon > 0$ typically increases at low pitch $f_1$. The dissonance spectrum resulting from this inharmonic timbre is slightly perturbed for $\epsilon = 0.0001$ but barely recognizable for $\epsilon = 0.01$. An intermediate inharmonicity $\epsilon = 0.001$ is observed to smear microtonal rays (19, 31, ...) but also to enhance secondary rays (10, 15), reflected in the necessity to adapt the tuning.

Although far from the elementary zeta model, the timbre of strongly inharmonic instruments with clear resonance frequencies $f_n$, typically non-one-dimensional percussive instruments (bells, Gamelan, handpans), can nevertheless be suitably described in this framework. Inharmonicity and lack of scale invariance in the timbre of different notes can both be treated
with the general formulation Eqs. (A2, 18) with a distribution defined from the frequencies $f_n$ and their associated amplitude $a_n$ with a suitable hearing uncertainty.

*Riemann's hypothesis on aperiodicities:* The structure of musical harmony is shaped by resonances of timbral origin. Represented by the elementary zeta model, a rich harmonic timbre amplifies the quasi-periods of the dissonance curve discussed in Section IVC, and filters other intervallic frequencies.

In musical terms, Riemann's hypothesis implies that timbral relationships do not introduce intervallic aperiodicities in the dissonance curve, beside the ones of the dissonance measure itself for $\beta < 1$, as long as the elementary timbre carries a finite acoustic power, $\sigma > \frac{1}{2}$. For a critically rich timbre $\sigma = \frac{1}{2}$, however, new aperiodicities occur at intervallic frequencies given by non-trivial zeros of the zeta function: near $u \log 2 = 1.56, 2.32, 2.76, 3.36, 3.63, 4.15, 4.51, 4.78, 5.3, 5.49, 5.84, 6.23, 6.55, 6.71, 7.18, ...$ per octave. Those aperiodicities constitute the perspective reversal of quasi-periodicities, and are responsible for a strong spectral filtering of the dissonance and consonance for rich harmonic timbres.

The intricacy of the musical timbre and the properties of Riemann's zeta function raises the possibility of a more general correspondence between those rich musical and number-theoretic objects.

## B. Beside harmony: commensurability in rhythm and melody

The present framework is dedicated to a fundamental aspect of harmony, consonance and dissonance, in terms of the commensurability of pairs of physical frequencies in the sound waves. Distinct forms of commensurability in musical structures are commented below.

Euclid's algorithm and related arithmetic structures associated to the assessment of commensurability (Stern-Brocot and Calkin-Wilf trees, continued fractions, etc.) are found to apply to discrete musical structures of three distinct nature: harmony, rhythm and melody. Integrating these three facets of music in a physically (and culturally) informed unified mathematical solfège is the difficult long term goal of mathemusic.

*Rhythms:* This complementary physical perspective of timings and delays between musical notes is focused on the temporal space. An elegant classification of periodic rhythmic patterns has been established by adapting Euclid's algorithm in this context [32]. The result-
ing scalar and rational representation of commensurable rhythms appears as the rhythmic counterpart of the just intonation approach. This suggests the adaptation to musical rhythm of the present framework, in relation to the notion of temporal dissonance. The joint analysis of harmony and rhythm is tantalizing by its complexity.

*Melody:* Music begins with the human voice as its primary instrument, with its physiology-bound imprecision and undefined tuning, so that songs play a crucial role in the structuration of intervals, scales and melodic patterns [33–35]. The mathematical modelling of these patterns, emerging from the alchemy of harmony and rhythm, meets the complexity of formal time-frequency representations. Discrete symbolic embeddings such as the meter and the musical scale offer some degree of simplification, turning melodic patterns in to discrete sets, sequences or distributions. Tuning and dissonance considerations are secondary in this type of approach, in spite of the connexion between harmony and the specific discrete structure of musical scales.

Continued fractions and the Stern-Brocot tree have been applied to musical scales as a way to classify hierarchically their regular discrete structures [36–39]. Of the melodic type, these investigations of commensurability in the additive representation of pitch structures can lead to similitudes with the multiplicative approach of harmony [40], but remains at distinct levels of description. The incommensurable additive sizes of just intervals, for instance the fifth to the octave $\log \frac{3}{2} / \log 2$, generates approximate but regular embeddings or irregular scales in its rational approximations (successive convergents) $\frac{1}{2}, \frac{3}{5}, \frac{7}{12}, \frac{24}{41}, \frac{31}{53}, \dots$. The denominators represent the regular embedding in even divisions of the octave, whereas the numerators are the number of uneven steps in the coarser fifth-generated scale. Both types of numbers are echoed in the quasi-periods of the dissonance spectrum, although some (24) are overall dissonant. The dissonance spectrum can be understood as a distributional summary of those even or uneven step numbers, with cumulated interfering contributions with timbre-related weights from all the possible pairs of intervals.

The commensurability on both additive (melodic) and multiplicative (harmonic) levels are complementary: the first enumerates discrete pitch structures, whereas the latter characterizes the distribution of the underlying dissonance landscape. The average dissonance value of pitch distributions on any specific scale structure can be computed in the present framework, and used as a parametric cost function for tuning purpose or quantitative characterization of its dependence in the timbre and uncertainty models.
The mathematical significance of these examples indicate a fertile empirical ground for certain number-theoretical concepts, besides a clear field of application, in the comprehensive study of musical concepts.

## ACKNOWLEDGEMENT

I would like to acknowledge L'École de Musique de la Vallée de Kaysersberg, in particular Liên-Bich Bui for experimental practice, Athanase Papadopoulos and authors of the Xenharmonic Wiki for introducing me to mathemusic, Frédéric Faure for an immersion into musical psychoacoustics, Pierre-Emmanuel Lephay, Dzmitry Badziahin and Emmanuel Amiot for early critiques, Ken Sekimoto, Pascal Martin and the wavelet community for reflections about the limitations of scale-invariance in hearing and in harmony, in particular Françoise Argoul for an inspirational maturation environment, hospitable stimulations from the Biological Physics department in PKS, funding from the Max Planck Society, and countless encouragements from colleagues and friends, in particular Kévin Jiguet, Frank Jülicher and Françoise Argoul for their comments on the manuscript. This work for harmony is dedicated to Cécilia Goldstein.
CODE AVAILABILITY

Julia scripts, including interactive plot (with Makie) of the dissonance curve and spectrum, audio synthesis of the elementary harmonic timbre, and number-theoretic functions, are available in the code repository https://codeberg.org/a-guillet/mathemusic.

Appendix A: Multiplicative convolution theorem

Frequency scaling and ratios, hence a multiplicative approach, are key to the description of the pitch of musical notes and musical intervals. The description of the timbre extends the scalar approach by introducing distributions of frequencies and ratios, which are related by convolution and cross-correlation products. These integrals are usually defined with respect to an additive variable, which corresponds to the musical perspective (octaves, semitones, etc.). We prefer here to keep the multiplicative approach, which is important to the discussion of commensurability, so that the convolution product is defined as follows:

$$c * T(f) = \int_{0}^{\infty} c(f')T(f/f')d \log f', \qquad (A1)$$

where d log f is the natural (Haar) measure associated to the multiplicative group (×, R+), hence v = log f is the change of variable which returns to the additive approach. The multiplicative approach could be extended to R with the measure df/|f|, but the musical interpretation of f < 0 is unclear or redundant here, thus discarded.

The lower case c = c(f) here indicates a frequency distribution, the upper case T = T(q) a ratio distribution. For instance, c = $\sum_k \delta_{fk}$ is a distribution of pitches that may form a chord or a musical scale, and T = $\sum_n n^{-\sigma} \delta_n$ is the harmonic timbre of a musical instrument. The frequency distribution s = c * T is a simple model for the sound resulting from playing the chord c with this instrument.

The harmonic relationships between the two sounds s₁, s₂ are captured by the distribution of frequency ratios, defined as the cross-correlation product [41]:

$$s_1 \star s_2(q) = \int_0^\infty s_1(f)s_2(qf)d \log f. \qquad (A2)$$

The combination of Eqs. (A1, A2) results in a factorization of $R_{12} = s_1 \star s_2$ into a distribution of intervals (pitch relationships) and a distribution of timbral relationships:

$$(c_1 * T_1) \star (c_2 * T_2) = (c_1 \star c_2) * (T_1 \star T_2). \qquad (A3)$$
This property can be conveniently verified using the integral transform that corresponds to the Fourier transform with respect to log f, also called Mellin transform with a purely imaginary variable:

$$s(f) = \int_{-\infty}^{+\infty} \hat{s}(u) f^{i\tau u} du, \quad \hat{s}(u) = \int_{0}^{\infty} s(f) f^{-i\tau u} d\log f, \quad (A4)$$

with $\tau = 2\pi = 6.283...$ the circle constant [5], which satisfies Euler's identity $e^{i\tau} = 1$. The characteristic function $\hat{s}$ is complex-valued and can be understood as a self-similarity (or log-periodicity) spectrum for the distribution $s$. The Fourier-Mellin transform turns the convolution and cross-correlation products into the simple and complex-conjugated products respectively:

$$\int_{0}^{\infty} c * T(f) f^{-i\tau u} d\log f = \hat{c}(u) \hat{T}(u) , \quad \int_{0}^{\infty} s_{1} * s_{2}(q) q^{-i\tau u} d\log q = \hat{s}_{1}(u) \hat{s}_{2}^{*}(u) , \quad (A5)$$

where $\hat{s}_2^*$ denotes the complex conjugate of $\hat{s}_2$. This is the multiplicative variation of the convolution theorem, from which Eq. (A3) is deduced.

# Appendix B: Sonance measure at low temperature

## 1. Regime of low positive temperature

Statistical quantities in the regime of low positive temperature $\beta > 1$ yields absolutely convergent series over positive rational numbers, which can be expressed in terms of Riemann's zeta function:

$$\begin{aligned} |\zeta(\beta + i\tau u)|^2 &= \left(\sum_{m=1}^{+\infty} m^{-\beta+i\tau u}\right) \left(\sum_{n=1}^{+\infty} n^{-\beta-i\tau u}\right) \\ &= \sum_{m,n=1}^{+\infty} (mn)^{-\beta} \left(\frac{m}{n}\right)^{i\tau u} \\ &= \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} \sum_{n=1}^{\infty} (abn^2)^{-\beta} \left(\frac{a}{b}\right)^{i\tau u} \\ &= \zeta(2\beta) \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} \left(\frac{a}{b}\right)^{i\tau u} , \end{aligned}$$

from a calculation of Mike Battaglia in [6]. The sonance measure in this regime is equivalent to the description of the timbre with parameter $\beta = \sigma > 1$ (weak timbre). We can notice
here another meaning for the quantity $\zeta(2\beta)$: apart from the power of the elementary sound of parameter $\sigma = \beta$, it also represents the redundancy of rational representations as a ratio of any two integers.

Therefore, all statistical and thermodynamical quantities associated to the sonance measure in the regime $\beta > 1$ can be derived from the formula:

$$ \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} \left(\frac{a}{b}\right)^{i\tau u} = \frac{|\zeta(\beta + i\tau u)|^2}{\zeta(2\beta)} \quad (B1) $$

We provide here the expression of the partition function $\mathcal{Z}_{\beta}$, the characteristic function $\tilde{\mathcal{G}}_{\beta}(u)$, the variance $V_{\beta}$, the average energy or disharmonicity $E_{\beta}$ and the Shannon entropy $S_{\beta}$ below the critical temperature:

$$ \mathcal{Z}_{\beta} = \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} = \frac{\zeta(\beta)^2}{\zeta(2\beta)} \quad (B2) $$

$$ \tilde{\mathcal{G}}_{\beta}(u) = \mathcal{Z}_{\beta}^{-1} \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} \left(\frac{a}{b}\right)^{i\tau u} = \frac{|\zeta(\beta + i\tau u)|^2}{\zeta(\beta)^2} \quad (B3) $$

$$ V_{\beta} = \langle (\log \frac{a}{b})^2 \rangle = \mathcal{Z}_{\beta}^{-1} \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} (\log \frac{a}{b})^2 = 2 \frac{d^2}{d\beta^2} \log \zeta(\beta) \quad (B4) $$

$$ E_{\beta} = \langle \log ab \rangle = \mathcal{Z}_{\beta}^{-1} \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} \log ab = -\frac{d}{d\beta} \log \mathcal{Z}_{\beta} \quad (B5) $$

$$ S_{\beta} = \mathcal{Z}_{\beta}^{-1} \sum_{\frac{a}{b} \in \mathbb{Q}^{+}} (ab)^{-\beta} \left(\beta \log ab + \log \mathcal{Z}_{\beta}\right) = \beta E_{\beta} + \log \mathcal{Z}_{\beta} \quad (B6) $$

These quantities diverge for $\beta \to 1$, and their values for $\beta < 1$ (assuming the rational enumeration defined in Eq. (13)) are unknown, except in the limit $\beta \to -\infty$.

## 2. Limit of negative zero temperature

In the regime $\beta \to -\infty$, the sonance measure is concentrated on the golden ratio $\phi = \frac{\sqrt{5}+1}{2}$ and its inverse. Indeed, the sequence of rational approximations of $\phi$ by the ratio of consecutive Fibonacci numbers $F_{h+1}/F_h$ as the maximum energy at any iteration $h$. This is proved by induction using the Calkin-Wilf tree: to maximize the product of the numerator and the denominator at each generation $\frac{a}{b} \to \left\{\frac{a}{a+b}; \frac{a+b}{b}\right\}$, we have to choose $\frac{a+b}{b} = 1+\frac{a}{b}$ when $b > a$ and $\frac{a}{a+b} = \frac{1}{1+\frac{b}{a}}$ when $a > b$, i.e. we have to choose them alternatively. The successive and alternative applications of these generators from the root $\frac{1}{1}$ yields, in the limit $h \to \infty$,
the continued fraction of the golden ratios $\phi = 1 + \frac{1}{1+\frac{1}{1+...}}$ and $\phi^{-1} = \frac{1}{1+\frac{1}{1+...}}$. From this result, we deduce

$$ \mathcal{F}_{-\infty}(u) = \cos(\tau u \log \phi) \qquad (B7) $$

$$ V_{-\infty} = (\log \phi)^2 \qquad (B8) $$

$$ S_{-\infty} = \log 2, \qquad (B9) $$

and the diverging mean energy: $E_{-\infty,h} = \log F_{h+1}F_h \sim (2h+1)\log\phi - \log 5$ for $h \gg 1$.

## Appendix C: Playing with Helmholtz's dissonance

Helmholtz's dissonance curve is constructed by summing elementary *roughness* contributions to the dissonance from pairs of harmonics between two sounds (violin modelled as a sawtooth wave, $\sigma = 1$), up to a cut-off $N$ on the harmonic order. Given a finite resolution of the ear, later interpreted as a critical bandwidth [42], the roughness has been proposed to originate from the interference of close but non-coinciding partials in the cochlea. The elementary roughness curve depends on both harmonics' frequencies independently, $mf_1$ and $nf_2$, with an intensity proportional to the product of the harmonics' amplitudes: $(mn)^{-\sigma} = (mn)^{-1}$ [1, 26]. Helmholtz has proposed a phenomenological shape for the elementary dissonance function:

$$ D_1(f, f'; \Delta f, r) = \frac{x^2}{(1+y^2)(1+x^2)^2}, \quad x = \frac{f' - f}{\Delta f}, \quad y = 4\pi r \frac{f' - f}{f' + f} \qquad (C1) $$

$$ D_N(f_1, f_2; \Delta f, r) = \sum_{m,n=1}^{N} (mn)^{-1} D_1(mf_1, nf_2; \Delta f, r) , \qquad (C2) $$

where a constant bandwidth $\Delta f = 30$ s$^{-1}$ is assumed, provoking the beating of frequency modes that are approximately $\Delta f$ apart. The resulting unsettling roughness of the sound would be the source of dissonance according to Helmholtz. The free shape parameter has been fixed to a plausible value, visibly near $r = 5$, and the maximum harmonic order is set to $N = 10$ to prevent divergence.

Let us rewrite Helmholtz's dissonance as a function of the mean frequency $\bar{f} = \sqrt{ff'}$ and the frequency ratio $q = \frac{f'}{f}$. This change of variables calls for a slight redefinition of $x$ and $y$, which yields a nearly indistinguishable result in the regimes of interest:

$$ \tilde{x} = Q_x(\bar{f}) \log q \approx x, \quad \tilde{y} = Q_y \log q \approx y, \qquad (C3) $$
with two quality factors as psychoacoustical parameters: $Q_x = \frac{\bar{f}}{\Delta f} = Q_x(\bar{f})$ and $Q_y = 2\pi r$. Interestingly, one quality factor is proportional to the frequency, while the other is constant. The former has been identified as a non-linear function of the frequency [42] called the critical band, and determined empirically in [30]:

$$Q_x(f) = \kappa \frac{9.26}{1 + \frac{f_*}{f}}, \quad f_* = 229 \text{ s}^{-1}. \qquad (C4)$$

Because of the possible mismatch of conventions for the definition of $Q$, we have included an adjustment coefficient $\kappa$. Since the quality factor saturates rapidly, $Q_x(f) \xrightarrow{f \to \infty} Q_\infty = 9.26\kappa$, the curve resulting from this approximation is only marginally different from the high frequency limit with constant quality factor $Q_\infty$. However, the boundedness of this quality factor introduce a profound alteration of Helmholtz's original curve.

The other quality factor $Q_y$, representative of the ability to distinguish slight changes in pitch, has attracted much less attention in the psychoacoustic literature. This is probably due to its important variability as a function of the loudness and subjects [29].

A more conservative (nonetheless strongly altering) simplification of Helmholtz's model occurs when approximating the multiple frequency-dependences $\sqrt{mn}f$ in terms of a single effective frequency-dependence $\lambda f$:

$$D_N(q, f; Q_x(f'), r) \approx D_N(q; Q(\lambda f), r) = [R_1^{(N)} \star D](q; Q(\lambda f), r) \qquad (C5)$$

$$R_1^{(N)}(q) = \sum_{m,n=1}^{N} (mn)^{-1} \delta(\log \frac{qm}{m}) .$$

This simplified dissonance curve is the smoothing of the distribution of ratios $R_1^{(N)}$ with the elementary dissonance (roughness) kernel $D(q; Q_x(\lambda f), r)$, with an implicit pitch dependence. The limit $N \to \infty$ corresponds to the zeta model.

Different values of $\lambda$ can be sensibly derived as a weighted average of frequencies. For the harmonic timbre with exponent $\sigma = 1$, every amplitude weight yields $\lambda \to \infty$ for $N \to \infty$. Intensity weights converge to $\frac{\zeta^{(2)}}{\zeta^{(3)}} = 1.368$ for the harmonic average, $e^{-\frac{\zeta^{(2)}}{\zeta^{(3)}}} = \frac{2\pi e^\gamma}{A^{12}} = 1.768$ (in terms of Euler-Mascheroni and Glaisher-Kinkelin constants) for the geometric average, and diverges again for the arithmetic average.

The yellow line in Fig. 3 (B, bottom) is based on the simplified zeta model with original bimodal kernel, but with fine-tuned constant quality factors for best resemblance. The slowly diverging offset cause by the exponent $\sigma = 1$ has also been subtracted, resulting in
a qualitative comparison of profiles for the original and simplified models of roughness (or
uncertainty) kernels.

[1] H. von Helmholtz, *Die Lehre von den Tonempfindungen als physiologische Grundlage für die Theorie der Musik* (Friedrich Vieweg und Sohn, Braunschweig, Germany, 1863).

[2] W. A. Sethares, *Tuning, Timbre, Spectrum, Scale*, 2nd ed. (Springer, London, 2005).

[3] Xenharmonic Wiki, https://en.xen.wiki/.

[4] P. Buch, Favored cardinalities of scales - Xenharmonic Wiki (2005).

[5] G. White, Rush $\tau$, rush $\pi!$, The Physics Teacher **53**, 132 (2015).

[6] M. Battaglia and G. W. Smith, The Riemann zeta function and tuning - Xenharmonic Wiki.

[7] E. Amiot, *Music Through Fourier Space*, Computational Music Science (Springer International Publishing, Cham, 2016).

[8] A. J. Hudspeth, F. Jülicher, and P. Martin, A Critique of the Critical Cochlea: Hopf—a Bifurcation—Is Better Than None, Journal of Neurophysiology **104**, 1219 (2010).

[9] P. Martin, Physical principles of hearing, in *Physics and Biology* (WORLD SCIENTIFIC, 2014) pp. 127–147.

[10] L. Euler, *Tentamen Novae Theoriae Mvsicae: Ex Certissimis Harmoniae Principiis Dilvcide Expositae*, Vol. 71 (Typographia Academiae Scientiarvm [Scientiarum], 1739).

[11] A. Gräf, On Musical Scale Rationalization., in *ICMC* (2006).

[12] B. Julia, Statistical theory of numbers, in *Number Theory and Physics, Springer Proceedings in Physics*, Vol. 47 (Springer-Verlag Berlin, 1990) p. 276.

[13] I. Bakas and M. J. Bowick, Curiosities of arithmetic gases, Journal of Mathematical Physics **32**, 1881 (1991).

[14] H. Minkowski, *Geometrie Der Zahlen*, Vol. 40 (BG Teubner, 1910).

[15] J. H. Chalmers, *Divisions of the Tetrachord: A Prolegomenon to the Construction of Musical Scales* (Frog Peak Music, 1993).

[16] C. Barlow, On the quantification of harmony and metre, in *COLLOQUIA AQUITANA II–2006* (2001) p. 275.

[17] F. Faure, M. Mezzadri, and A. Ratchov, Analyse et jeu musical en tempérament juste adaptatif (2015).
[18] B. Julia, Thermodynamic limit in number theory: Riemann-Beurling gases, Physica A: Statistical Mechanics and its Applications **203**, 425 (1994).

[19] E. W. Dijkstra, More About the Function “fusc” (A Sequel to EWD570), in *Selected Writings on Computing: A Personal Perspective* (Springer New York, New York, NY, 1982) pp. 230–232.

[20] S. Northshield, Stern’s Diatomic Sequence 0,1,1,2,1,3,2,3,1,4,..., The American Mathematical Monthly **117**, 581 (2010).

[21] N. Calkin and H. S. Wilf, Recounting the rationals, The American Mathematical Monthly **107**, 360 (2000).

[22] R. Backhouse and J. F. Ferreira, Recounting the Rationals: Twice!, in *Mathematics of Program Construction*, Vol. 5133, edited by P. Audebaud and C. Paulin-Mohring (Springer Berlin Heidelberg, Berlin, Heidelberg, 2008) pp. 79–91.

[23] A. Guillet, *Revisiting Statistical Physics Tools for the Complex Time-Frequency Characterization of Physiological Signals*, Thèse de doctorat, Bordeaux (2022).

[24] G. Alkauskas, *Integral Transforms of the Minkowski Question Mark Function*, Ph.D. thesis, University of Nottingham (2008).

[25] A. Guillet, A Singular Measure of Dissonance - Xenharmonic Wiki (2018).

[26] P. Bailhache, Acoustique musicale, http://patrice.bailhache.free.fr/thmusique/ (2014).

[27] D. Gabor, Theory of communication. Part 2: The analysis of hearing, Journal of the Institution of Electrical Engineers - Part III: Radio and Communication Engineering **93**, 442 (1946).

[28] J. Wolfe, Music Acoustics, Physics, Science, UNSW, https://www.phys.unsw.edu.au/music/.

[29] E. G. Shower and R. Biddulph, Differential Pitch Sensitivity of the Ear, The Journal of the Acoustical Society of America **3**, 275 (1931).

[30] B. R. Glasberg and B. C. Moore, Derivation of auditory filter shapes from notched-noise data, Hearing Research **47**, 103 (1990).

[31] A. D. Fokker, Equal Temperament and the Thirty-One-Keyed Organ, The Scientific Monthly **81**, 161 (1955), 21995.

[32] G. Toussaint, The Euclidean algorithm generates traditional musical rhythms, in *Renaissance Banff: Mathematics, Music, Art, Culture* (2005) pp. 47–56.

[33] E. Phillips and S. Brown, Vocal imprecision as a universal constraint on the structure of musical scales, Scientific Reports **12**, 19820 (2022).
[34] J. M. McBride, E. Phillips, P. E. Savage, S. Brown, and T. Tusty, Melody predominates over harmony in the evolution of musical scales across 96 countries (2024), arXiv:2408.12633 [cs].

[35] S. Brown, E. Phillips, K. Husein, and J. McBride, Musical scales optimize pitch spacing: A global analysis of traditional vocal music, Humanities and Social Sciences Communications **12**, 546 (2025).

[36] N. Carey and D. Clampitt, Aspects of Well-Formed Scales, Music Theory Spectrum **11**, 187 (1989), 745-753.

[37] E. Wilson, Scale-tree (Peirce Sequence) (1994).

[38] T. Noll, Musical intervals and special linear transformations, Journal of Mathematics and Music **1**, 121 (2007).

[39] A. J. Milne, M. Carlé, W. A. Sethares, T. Noll, and S. Holland, Scratching the Scale Labyrinth, in *Mathematics and Computation in Music*, Vol. 6726, edited by C. Agon, M. Andreatta, G. Assayag, E. Amiot, J. Bresson, and J. Mandereau (Springer Berlin Heidelberg, Berlin, Heidelberg, 2011) pp. 180-195.

[40] J. H. Cartwright, J. Douthett, D. L. González, R. Krantz, and O. Piro, Two musical paths to the Farey series and devil's staircase, Journal of Mathematics and Music **4**, 57 (2010).

[41] A. Guillet, A. Arneodo†, P. Argoul, and F. Argoul, Quantifying the Rationality of Rhythmic Signals, in *Theoretical Physics, Wavelets, Analysis, Genomics: An Indisciplinary Tribute to Alex Grossmann*, Applied and Numerical Harmonic Analysis, edited by P. Flandrin, S. Jaffard, T. Paul, and B. Torresani (Springer International Publishing, Cham, 2023) pp. 565-593.

[42] R. Plomp and W. J. M. Levelt, Tonal Consonance and Critical Bandwidth, The Journal of the Acoustical Society of America **38**, 548 (1965).