Saturday, 21 November 2026
Raga Bhupali, a just-intonation reading
Bhupali, first expedition: a timbre where 3 of 4 steps land in consonance (an ordinary instrument: 2; Sethares' construction: 2).
A bright pentatonic evening raga, read in just intonation.
The numbers
- An ordinary instrument
- 2 of 4 steps land
- Sethares’ construction
- 2 of 4 steps land
- Tonight’s search
- 3 of 4 steps land, a new record
- The rule it found
- detune non‑aligned partials away from the nearest scale note to sharpen valley dips
- Programs tried
- 76 programs, 64 valid, across 12 generations
- The piece
- Bhupali, Evening Unbent
Tonight’s film
Read the program
const PARAMS = 5; // [density, tilt, pull, stretch, detune]
function timbre(target, p) {
// ---------- knobs -------------------------------------------------
// p[0] – partial count (4 … 14)
// p[1] – spectral tilt exponent (0.5 … 2.0)
// p[2] – pull toward nearest scale ratio (0 … 1)
// p[3] – stretch of the natural harmonic series (0.5 … 2.0)
// p[4] – detune strength away from nearest scale ratio (0 … 0.5)
const count = 4 + Math.round(p[0] * 10); // 4‑14 partials
const tilt = 0.5 + 1.5 * p[1]; // 0.5‑2.0
const pull = p[2]; // 0‑1
const stretch= 0.5 + 1.5 * p[3]; // 0.5‑2.0
const detune = 0.5 * p[4]; // 0‑0.5
const notes = [1, ...target.steps]; // tonic + scale steps
const period = target.period; // usually 2 (octave)
const partials = [];
// crowd‑mask: damp a partial that lands within ~2 % (log distance)
const crowdThresh = 0.02;
const crowdFactor = 0.5;
for (let k = 1; k <= count; k++) {
// ---- stretched natural harmonic ----
const base = Math.pow(k, stretch); // stretched series
// ---- nearest scale‑note ratio (including octave shifts) ----
const oct = Math.floor(Math.log(base) / Math.log(period));
let best = base, bestDist = Infinity;
for (let o = oct; o <= oct + 1; o++) {
const octaveMul = Math.pow(period, o);
for (const n of notes) {
const r = octaveMul * n;
const d = Math.abs(Math.log(r / base));
if (d < bestDist) {
bestDist = d;
best = r;
}
}
}
// ---- blend natural and scale‑aligned ratios (geometric interp.) ----
let ratio = Math.exp((1 - pull) * Math.log(base) + pull * Math.log(best));
// ---- detune away from the nearest scale note (if not exactly on it) ----
const logDist = Math.log(ratio / best); // signed log‑distance
if (Math.abs(logDist) > 1e-12) { // avoid exact coincidences
ratio *= Math.exp(detune * logDist); // push further away
}
// ---- amplitude from spectral tilt ----
let amp = 1 / Math.pow(k, tilt);
// ---- crowding attenuation (simple critical‑band mask) ----
for (const prev of partials) {
if (Math.abs(Math.log(ratio / prev.ratio)) < crowdThresh) {
amp *= crowdFactor;
break;
}
}
// ---- clamp ratio into allowed range ----
const rClamped = Math.min(40, Math.max(1, ratio));
partials.push({ ratio: rClamped, amp });
}
// ---- enforce fundamental loudness (≥ 20 % of 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;
// ---- keep at most 32 partials (deterministic: keep the loudest) ----
partials.sort((a, b) => b.amp - a.amp || a.ratio - b.ratio);
const kept = partials.slice(0, 32);
// re‑enforce fundamental rule after truncation
const finalMax = Math.max(...kept.map(p => p.amp));
for (const pt of kept) {
if (Math.abs(pt.ratio - 1) < 1e-12 && pt.amp < 0.2 * finalMax) {
pt.amp = 0.2 * finalMax;
}
}
return kept;
}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.