A clockmaker's tool for fitting gears turns out to be a complete map of the rational numbers — and because every interval is a ratio, a map of harmony. Walk it. It plays.
research/the-mediant/verify.mjs (43/43); every tone is a tree node, 220 Hz × p⁄q. Third companion film for a Wasteland layer.
In 1861 a Parisian clockmaker, Achille Brocot, published a book on gear trains. For any desired gear ratio he needed the simplest fraction — smallest numerator and denominator — that approximated it within a tolerance. His method was a binary tree. Start with 0⁄1 on the left and 1⁄0 (standing for infinity) on the right. Their mediant — add the tops, add the bottoms: (0+1)⁄(1+0) = 1⁄1 — is the root. From any node, the left child is its mediant with the nearest ancestor on the left; the right child, its mediant with the nearest ancestor on the right. Repeat forever.
What Brocot built — not quite knowing it — was a complete enumeration of every positive rational number, each appearing at exactly one node, with the path from the root spelling out that number's continued fraction. Moritz Stern had found the same structure three years earlier in pure number theory. Brocot was tuning clocks; Stern was studying integers. The tree is the same.
And because every musical interval is a frequency ratio, the tree that optimises a gear train and organises the rationals also — with no adjustment — organises the intervals of music.
Each node is a positive rational p⁄q, read as a frequency ratio: the root note times p⁄q. The root 1⁄1 is unison; one step right is 2⁄1, the octave; one step left is 1⁄2, the octave below. Sounding a node plays a drone on the root (A3, 220 Hz) and the interval note together — consonance and dissonance are something you hear in the beating, not a label.
The structure is musically ordered: along any path the denominator strictly grows, and simpler ratios — smaller denominators — are the more consonant intervals. So the plainest agreements sit near the top. With the root at depth 0: the octave 2⁄1 is at depth 1, the perfect fifth 3⁄2 at depth 2, the perfect fourth 4⁄3 at depth 3, the major third 5⁄4 at depth 4. Descend further and the intervals turn subtle — the septimal minor third 7⁄6, then microtones, the gaps between the gaps.
That smaller denominators sound more consonant is the basis of just intonation, and is well-supported perceptually (small-integer ratios make their harmonics beat slowly, which the ear reads as agreement — Plomp & Levelt, 1965). It is a model of consonance, not a theorem; what is exact is the arithmetic underneath it — the mediant of two fractions always has a larger denominator than either, so depth in the tree rises monotonically with denominator along any path.
Every sequence of L and R choices reaches exactly one rational, and every rational is reached by exactly one finite sequence. That is a proof that the positive rationals are countable: list every finite binary string — ε, L, R, LL, LR, … — and you have listed every positive rational, once each. The proof isn't abstract; it's the path you just walked.
More precisely, the path to p⁄q is the binary search for p⁄q, comparing against mediants — and its runs of L's and R's are the continued fraction of p⁄q. The tree and the continued fraction are one object in two notations. This is why the path gives the best approximations at each scale: every node on it is the simplest fraction lying strictly between its two bounding ancestors — the best one-sided approximation available at that denominator. Walk toward 355⁄113 and you pass 3⁄1, 22⁄7, … — the textbook approximations of π, in order, because 355⁄113 = [3;7,16].
Walk toward a rational and the path stops — you arrive. Walk toward an irrational and it never stops. Aim at the equal-temperament fifth, 2^(7⁄12) ≈ 1.4983, and the melody climbs toward 700 cents and never quite lands: each node a better fraction than the last, none of them exact. The irrationals are precisely the infinite paths — the numbers that need the whole tree to name.
Brocot's clockmaker's tool, Stern's number-theoretic curiosity, and Pythagoras's consonant intervals are the same tree. It contains all of them, once each, in order of complexity — gear ratios, rationals, harmonies, indexed by the same descent. Navigate it and you are hearing the rational numbers, every one of them given enough time, as music.
Moritz A. Stern, "Über eine zahlentheoretische Funktion," Journal für die reine und angewandte Mathematik 55 (1858): 193–220. Achille Brocot, Calcul des rouages par approximation (Paris, 1861). The modern reference for the tree — that it holds every positive rational exactly once and that the path is the continued fraction — is R. L. Graham, D. E. Knuth & O. Patashnik, Concrete Mathematics (2nd ed., Addison-Wesley, 1994), §4.5; those results are stated here as established.
On consonance and denominator size: R. Plomp & W. J. M. Levelt, "Tonal Consonance and Critical Bandwidth," Journal of the Acoustical Society of America 38 (1965): 548–560. The mapping onto the tree is a consequence of its construction (the mediant raises the denominator), not an independent claim. The countability argument and the irrationality of 2^(7⁄12) are standard.
The instrument builds the tree in exact integer arithmetic (JavaScript BigInt) — no node is ever a floating-point approximation. Floating point appears only to turn an exact ratio into a frequency (220 × p⁄q Hz) and a cents reading (1200·log₂(p⁄q), rounded). Tones are sine drone + sine interval with a short envelope, via the Web Audio API. Every figure on this page, and the two corrections above, are recomputed from scratch in research/the-mediant/verify.mjs (43 checks, all passing). This layer was promoted from a deposition left at the project's door; it was rebuilt and checked, not copied.