Day 10 of ∞All days

Friday, 13 November 2026

11 equal steps to the fifth

Carlos β, first expedition: a timbre where 4 of 10 steps land in consonance (an ordinary instrument: 0; Sethares' construction: 2).

Wendy Carlos' beta scale, a finer non-octave grid than alpha.

The numbers

An ordinary instrument
0 of 10 steps land
Sethares’ construction
2 of 10 steps land
Tonight’s search
4 of 10 steps land, a new record
The rule it found
prune partials that lie within a critical‑band‑like log distance of a louder one, reducing self‑roughness while keeping the induced‑step coincidences.
Programs tried
76 programs, 62 valid, across 12 generations
The piece
Beta Tide

Tonight’s film

Read the program
const PARAMS = 6; // [harmCount, stretch, tilt, snapThresh, stepAmp, pruneThresh] each in [0,1]

function timbre(target, p) {
  // ---------- knobs ----------
  const harmCount   = 8 + Math.round(p[0] * 16);          // total induced partials (incl. fundamental)
  const stretchExp  = 1 + 0.4 * p[1];                     // stretch of harmonic indices
  const tiltExp     = 0.5 + 1.5 * p[2];                   // amplitude roll‑off exponent
  const snapThresh  = Math.max(0, Math.min(1, p[3]));    // fraction of half‑period for “close”
  const stepAmpBase = p[4];                              // base amp for forced step partials
  const pruneFrac   = Math.max(0, Math.min(1, p[5]));    // pruning strength

  const period   = target.period;       // e.g. 1.5
  const maxRatio = 40;
  const halfPeriodLog = Math.log(period) / 2; // half‑period in log space
  const pruneThresh = (0.01 + 0.09 * pruneFrac) * halfPeriodLog; // log distance

  // ---------- scale notes ----------
  const notes = [1, ...target.steps]; // ratios within one period (including tonic)

  // ---------- induced (nearest‑scale) spectrum ----------
  const induced = [];
  for (let k = 1; k <= harmCount; k++) {
    const harmonic = Math.pow(k, stretchExp);
    const oct = Math.floor(Math.log(harmonic) / Math.log(period));
    const base = harmonic / Math.pow(period, oct); // in [1, period)
    // nearest scale note in this period
    let best = notes[0], bestDist = Infinity;
    for (const n of notes) {
      const d = Math.abs(Math.log(base / n));
      if (d < bestDist) { bestDist = d; best = n; }
    }
    const ratio = best * Math.pow(period, oct);
    if (ratio > maxRatio) continue;
    const amp = 1 / Math.pow(k, tiltExp);
    induced.push({ ratio, amp });
  }

  // ---------- snap or add exact step partials ----------
  const partials = induced.slice(); // start from induced spectrum

  for (const n of notes) {
    let oct = 0;
    while (true) {
      const r = n * Math.pow(period, oct);
      if (r > maxRatio) break;

      // find nearest existing partial
      let nearest = null, minDist = Infinity;
      for (const pt of partials) {
        const d = Math.abs(Math.log(pt.ratio / r));
        if (d < minDist) { minDist = d; nearest = pt; }
      }

      if (minDist < snapThresh * halfPeriodLog) {
        // snap the nearest partial to the exact step ratio
        nearest.ratio = r;
      } else {
        // add a low‑amplitude forced step partial
        const amp = stepAmpBase * Math.pow(0.6, oct);
        if (amp > 0) partials.push({ ratio: r, amp });
      }
      oct++;
    }
  }

  // ---------- collapse duplicates ----------
  const uniq = [];
  const eps = 1e-12;
  for (const pt of partials) {
    const existing = uniq.find(q => Math.abs(Math.log(q.ratio / pt.ratio)) < eps);
    if (existing) {
      if (pt.amp > existing.amp) existing.amp = pt.amp;
    } else {
      uniq.push({ ratio: pt.ratio, amp: pt.amp });
    }
  }

  // ---------- ensure fundamental loud enough ----------
  let maxAmp = 0;
  for (const pt of uniq) if (pt.amp > maxAmp) maxAmp = pt.amp;
  let fund = uniq.find(pt => Math.abs(pt.ratio - 1) < eps);
  if (!fund) {
    fund = { ratio: 1, amp: 0 };
    uniq.push(fund);
  }
  if (fund.amp < 0.2 * maxAmp) fund.amp = 0.2 * maxAmp;

  // ---------- normalise amplitudes ----------
  maxAmp = 0;
  for (const pt of uniq) if (pt.amp > maxAmp) maxAmp = pt.amp;
  for (const pt of uniq) pt.amp /= maxAmp;

  // ---------- prune close, quieter partials ----------
  uniq.sort((a, b) => b.amp - a.amp); // descending amplitude
  const kept = [];
  for (const pt of uniq) {
    let tooClose = false;
    for (const k of kept) {
      if (Math.abs(Math.log(pt.ratio / k.ratio)) < pruneThresh) {
        tooClose = true;
        break;
      }
    }
    if (!tooClose) kept.push(pt);
    if (kept.length >= 32) break;
  }

  // ---------- final safety: keep at most 32 ----------
  return kept.slice(0, 32);
}

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.