Day 21 of ∞All days

Tuesday, 24 November 2026

22 equal steps to the octave

22-EDO, first expedition: a timbre where 4 of 21 steps land in consonance (an ordinary instrument: 0; Sethares' construction: 6).

Twenty-two equal steps, rich in seventh- and eleventh-harmonic intervals.

The numbers

An ordinary instrument
0 of 21 steps land
Sethares’ construction
6 of 21 steps land
Tonight’s search
4 of 21 steps land, a new record
The rule it found
Hybrid induced‑stretched spectrum: stretched harmonics nudged toward the nearest scale step
Programs tried
76 programs, 62 valid, across 12 generations
Also works for
5-EDO (3 of 4)
The piece
Twenty-Two Doors

Tonight’s film

Read the program
const PARAMS = 3;
function timbre(target, p) {
  // p[0] = snap amount toward nearest scale note (0‑1)
  // p[1] = stretch exponent for the harmonic series (0‑1)
  // p[2] = amplitude roll‑off exponent (0‑1)
  const snap = p[0];
  const stretch = 0.9 + 0.6 * p[1];
  const tilt = 0.5 + 1.5 * p[2];

  const count = 10;                     // total number of partials (incl. fundamental)
  const partials = [{ ratio: 1, amp: 1 }]; // fundamental

  // build a list of scale notes across three periods (0‑2)
  const notes = [];
  for (let j = 0; j <= 2; j++) {
    const base = Math.pow(target.period, j);
    notes.push(base); // the octave of each period
    for (const step of target.steps) {
      const r = base * step;
      if (r > 1 && r <= 40) notes.push(r);
    }
  }

  // generate stretched harmonics and pull them toward the nearest scale note
  for (let k = 2; k <= count; k++) {
    const stretched = Math.pow(k, stretch); // raw stretched harmonic
    // find nearest scale note
    let nearest = notes[0];
    let mind = Math.abs(stretched - nearest);
    for (const n of notes) {
      const d = Math.abs(stretched - n);
      if (d < mind) {
        mind = d;
        nearest = n;
      }
    }
    const ratio = stretched + (nearest - stretched) * snap; // nudged ratio
    const amp = 1 / Math.pow(k, tilt);
    partials.push({ ratio, amp });
  }

  // enforce fundamental at least 20 % as loud as the loudest partial
  const maxAmp = Math.max(...partials.map(p => p.amp));
  const minFund = 0.2 * maxAmp;
  if (partials[0].amp < minFund) partials[0].amp = minFund;

  return partials;
}

Consonance here is measured with Sethares’ model of sensory dissonance, not by ear. A step lands when it sits at the bottom of a valley in the timbre’s dissonance curve. Perfect harmony is out of reach — pure fifths and thirds never close into one scale — which is why the search does not end.

Every morning, what the night found.

One email a day at 7am Singapore time, with the discovery, the music and the film.