Day 19 of ∞All days

Sunday, 22 November 2026

10 equal steps to the octave

10-EDO, first expedition: a timbre where 8 of 9 steps land in consonance (an ordinary instrument: 0; Sethares' construction: 8).

Ten equal steps: Sethares showed a matched timbre can make it consonant.

The numbers

An ordinary instrument
0 of 9 steps land
Sethares’ construction
8 of 9 steps land
Tonight’s search
8 of 9 steps land, a new record
The rule it found
Boost amplitudes of partials that lie close to a scale degree to deepen valleys.
Programs tried
76 programs, 62 valid, across 12 generations
Also works for
5-EDO (4 of 4), 7-EDO (5 of 6), 8-EDO (6 of 7), 9-EDO (7 of 8), 11-EDO (9 of 10), 13-EDO (10 of 12)
The piece
Ten Steps, One Lantern

Tonight’s film

Read the program
const PARAMS = 4; // [extra‑partials, tilt, stretch, boost]

function timbre(target, p) {
  // ----- parameters -------------------------------------------------
  const extra   = Math.round(p[0] * 12);               // 0‑12 extra partials
  const tilt    = 0.5 + 1.5 * p[1];                    // amplitude roll‑off exponent
  const stretch = 0.5 + 1.5 * p[2];                    // harmonic stretch exponent
  const boost   = 1.5 * p[3];                         // max amplitude boost for near‑scale partials

  // ----- scale data -------------------------------------------------
  const notes = [1, ...target.steps];                 // scale degrees in one period
  const stepLog   = Math.log(target.period) / target.steps.length;
  const halfStep  = stepLog / 2;                      // half‑step in log‑frequency
  const cbw       = 0.07;                             // critical‑band width (log)

  // ----- generate stretched harmonics --------------------------------
  const raw = [];                                     // {ratio, rawAmp}
  const maxCount = Math.min(32, 4 + extra);
  for (let k = 1; k <= maxCount; k++) {
    // stretched harmonic index
    let ks = Math.pow(k, stretch);

    // fold into the fundamental octave [1, period)
    const oct = Math.floor(Math.log(ks) / Math.log(target.period));
    ks = ks / Math.pow(target.period, oct);

    // nearest scale note in this octave
    let nearest = 1, bestDist = Infinity;
    for (const n of notes) {
      const d = Math.abs(Math.log(ks / n));
      if (d < bestDist) { bestDist = d; nearest = n; }
    }
    // restore original octave
    nearest = nearest * Math.pow(target.period, oct);

    // distance‑dependent pull (full pull when beyond half‑step)
    const logDist = Math.abs(Math.log(ks / nearest));
    const pull = Math.min(1, logDist / halfStep);

    // blended ratio
    const ratio = (1 - pull) * ks + pull * nearest;
    if (ratio > 40) break;

    // raw amplitude (fundamental stays loudest)
    const rawAmp = 1 / Math.pow(k, tilt);
    raw.push({ ratio, rawAmp, nearest, logDist });
  }

  // ----- critical‑band crowding attenuation -------------------------
  const ampsAfterCrowd = raw.map(p => {
    let crowd = 0;
    for (const q of raw) {
      if (p === q) continue;
      const d = Math.log(p.ratio / q.ratio);
      crowd += Math.exp(- (d * d) / (cbw * cbw));
    }
    return p.rawAmp / (1 + crowd);
  });

  // ----- boost amplitudes of near‑scale partials --------------------
  const amps = ampsAfterCrowd.map((amp, i) => {
    const p = raw[i];
    // distance to the *actual* nearest scale note after pulling
    const dist = Math.abs(Math.log(p.ratio / p.nearest));
    const factor = 1 + boost * Math.max(0, 1 - dist / halfStep);
    return amp * factor;
  });

  // ----- enforce fundamental ≥ 20 % of loudest ----------------------
  let maxAmp = Math.max(...amps);
  if (amps[0] < 0.2 * maxAmp) {
    const factor = (0.2 * maxAmp) / amps[0];
    for (let i = 0; i < amps.length; i++) amps[i] *= factor;
    maxAmp = Math.max(...amps);
  }

  // ----- final output ------------------------------------------------
  return raw.map((p, i) => ({ ratio: p.ratio, amp: amps[i] }));
}

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.