Monday, 23 November 2026
Raga Yaman, a just-intonation reading
Yaman, first expedition: a timbre where 1 of 6 steps land in consonance (an ordinary instrument: 1; Sethares' construction: 1).
The evening raga of the raised fourth, read in just intonation.
The numbers
- An ordinary instrument
- 1 of 6 steps land
- Sethares’ construction
- 1 of 6 steps land
- Tonight’s search
- 1 of 6 steps land, a new record
- The rule it found
- valley‑focused weighting – boost partials that lie near scale steps (deepening dips) and attenuate others, while keeping the original critical‑band pruning.
- Programs tried
- 76 programs, 63 valid, across 12 generations
- The piece
- Yaman, Evening Raised
Tonight’s film
Read the program
const PARAMS = 5; // [partialCount, tilt, pull, pruneTol, focus]
function timbre(target, p) {
// ---------- parameters -------------------------------------------------
const pc = 3 + Math.round(p[0] * 12); // total generated partials (3‑15)
const tilt = 0.5 + 1.5 * Math.min(1, Math.max(0, p[1])); // amplitude roll‑off exponent
const pull = Math.min(1, Math.max(0, p[2])); // blend harmonic ↔ nearest scale note
const pruneTol = 0.01 + 0.04 * Math.min(1, Math.max(0, p[3])); // relative tolerance
const focus = Math.max(0, Math.min(2, p[4] * 2)); // strength of valley weighting (0‑2)
// ---------- helpers ----------------------------------------------------
const period = target.period;
const logPeriod = Math.log(period);
const notes = [1, ...target.steps]; // scale ratios inside one period
// ---------- generate induced‑spectrum partials -------------------------
const raw = [];
for (let k = 1; k <= pc; k++) {
// nearest harmonic octave (multiple of period) so that ratio ≤ period
const oct = Math.floor(Math.log(k) / logPeriod);
const base = Math.pow(period, oct); // harmonic base multiplier
const harmonic = k * base; // pure harmonic ratio (≤ period*period)
// find nearest scale note (including the period itself as a possible target)
let best = harmonic, bestDist = Infinity;
for (const n of [...notes, period]) {
const r = base * n;
const d = Math.abs(Math.log(r / harmonic));
if (d < bestDist) { bestDist = d; best = r; }
}
// blend between pure harmonic and nearest scale‑note
const ratio = Math.exp((1 - pull) * Math.log(harmonic) + pull * Math.log(best));
const amp = 1 / Math.pow(k, tilt);
raw.push({ratio, amp});
}
// ---------- valley‑focused weighting -----------------------------------
// distance to the nearest scale note (any octave) in log‑space
const maxDist = logPeriod / 2; // half a period = typical valley width
for (const pt of raw) {
let nearest = Infinity;
for (const n of notes) {
// try several octaves so that n*period^o is in range [1,40]
for (let o = -3; o <= 3; o++) {
const r = n * Math.pow(period, o);
if (r < 1 || r > 40) continue;
const d = Math.abs(Math.log(pt.ratio / r));
if (d < nearest) nearest = d;
}
}
// weight = (1 - (dist / maxDist))^focus, clipped to [0,1]
const w = Math.max(0, 1 - nearest / maxDist);
pt.amp *= Math.pow(w, focus);
}
// ---------- prune close partials (critical‑band avoidance) ------------
raw.sort((a, b) => b.amp - a.amp); // loudest first
const kept = [];
for (const cur of raw) {
if (kept.some(p => Math.abs(cur.ratio - p.ratio) / p.ratio < pruneTol)) continue;
kept.push(cur);
}
// ---------- enforce fundamental loudness --------------------------------
const maxAmp = Math.max(...kept.map(p => p.amp));
const scale = Math.max(1, maxAmp / 5); // make fundamental ≥ 0.2 × loudest
for (const p of kept) p.amp /= scale;
// ---------- final sanity checks -----------------------------------------
const final = kept
.filter(p => p.ratio >= 1 && p.ratio <= 40)
.slice(0, 32);
return final;
}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.