The Consonance Tree

A visualizer for harmonic trajectories on the Stern–Brocot tree.
FAQ →

Input sequence

Transformation

tempo 150

Trajectory on the Stern–Brocot tree

original trajectory transformed trajectory tree edges

Original

Transformed

About

Each positive rational a/b is a node of the full Stern–Brocot tree, rooted at 1/1. A musical sequence is a trajectory through the tree. The operators are of three kinds, distinguished by what they do to the trajectory's anchor — the deepest common ancestor of its nodes. Anchor-shifting operators move the trajectory as a rigid shape by moving the anchor while holding each node's position relative to it: L moves the anchor to its left child, R to its right child, U to its parent. U is partial — there is nothing above the root, so it does nothing to a trajectory whose anchor is already 1/1. Anchor-preserving: σ swaps L↔R in every address, which at the value level is reciprocation a/b → b/a, a reflection of the whole tree about 1/1; it carries the anchor to its mirror and leaves both C_nn and the prime limit exactly unchanged. Anchor-destroying: rev reverses each address, turning the common prefix into a common suffix, so the image generally has an unrelated anchor. All three preserve the depth profile, but only σ preserves consonance — L, R and U move the trajectory into genuinely more or less consonant regions of the tree. The cents column shows deviation of each just ratio from its nearest 12-TET semitone (±0–10 clean, ±10–25 noticeable, ±25+ poorly represented). The note column includes octave markers ↑n / ↓n when a pitch is n octaves above or below the root.

Reference pitch. Choosing a reference (tonic) divides every ratio so that pitch becomes 1/1 — a transposition. Unlike the operators, this is a global rescaling rather than an anchor shift: it preserves the trajectory's interval content, and therefore its internal consonance C_nn, while relocating its tree position, addresses, and harmonic frame. It is the one move the operator family L, R, U, σ, rev does not contain. Because the harmonic root and frame are read from the tree position, they are reported relative to the chosen reference.

The tree is drawn with 1/1 at the top centre and the two halves of the Stern–Brocot tree spreading symmetrically: the lower half (intervals < 1) on the left, the upper half (intervals > 1) on the right. The major triad 1/1, 5/4, 3/2 shows root, major third, perfect fifth.

The harmonic frame above each trajectory is the unique pair of Farey neighbors p/q ◁ ▷ r/s (i.e., satisfying qr − ps = 1) that bracket the chord's pitch range as tightly as possible. It is the chord's natural enclosing region in harmonic space — invariant under the chord's internal voicing, and computable directly from the input fractions by a single Stern–Brocot descent. A chord anchored at 3/2 has frame 1/1 ◁ ▷ 2/1 (the octave); one anchored at 5/3 has frame 3/2 ◁ ▷ 2/1 (the fifth-to-octave window). Rooted chords (those containing 1/1) have frame 0 ◁ ▷ ∞ — they span all of frequency space and have no tightening bracket. The frame is also the limit of repeated L / R iteration, but is computed analytically, not by iteration.