Bootstrap Paradox Lullaby
One unbroken shot: the song's own text woven into a cloth of foil letters on the sea
The YouTube cut is packed and waiting; play the piece here in the meantime
The weave
The cloth is woven from the song's own text as a bytefield; the spectrogram decides which layer each cell belongs to
# Bootstrap Paradox Lullaby: music video
Working folder for the video. Built with three.js, [holospot](https://github.com/dmitrykurash/holospot) and [holocloth](https://github.com/dmitrykurash/holocloth) (both MIT, by Dmitry Kurash; credit him in the description and end card).
## Direction (2026-11-19)
**Now: the woven ocean.** 16:9, one unbroken shot, the whole song. The song's text is woven into a cloth of foil letters lying on the sea, and the camera rides the reading line: deep night, dawn, the chorus barrel, foam, the womb, the second barrel, sunset, the violet key change, back to the deep. No cards, no on-screen lyrics: just the cloth, its words and light.
Earlier direction:
**The woven lullaby.** The whole video is made of foil and cloth. The cloth is woven from the song's own text as a bytefield (every glyph is a letter of a real, traceable text), and it turns more and more liquid as the song goes on. The text is woven against the song itself: its spectrogram sets which layer each cell belongs to. So the song's sound decides where its own words go. That is the bootstrap.
- Layer 1, **lyric**: the sung lines (`text/lyrics.txt`), in the loudest cells
- Layer 2, **prompt**: the seed text and the Suno style and caption (`text/seed.txt`, `text/song-metadata.txt`), in the mid-tones
- Layer 3, **trace**: the CC commentary (`text/timed-lines.tsv`), in the quiet cells
The weave uses the Living Page Kit's own `coherent()` and `fill_runs()` (`../Living Page Kit/lp_bytefield.py`).
## Folders
| folder | what's in it |
| --- | --- |
| `audio/` | `master.mp3` (the LANDR master, 2:22) and `stems/` (WAV + MIDI per instrument, renamed from the Suno export: drums, guitar-nylon, vocal-lead, vocal-harmony, bass, piano, trumpet, pan-flute, percussion) |
| `text/` | lyrics, timed lines (lyrics + CC commentary), seed text, song metadata |
| `data/` | `song.json` (mel spectrogram at 20 fps, kick and snare times from the drum MIDI, 124.2 BPM grid) and `envelopes.json` (per-stem envelopes at 30 fps, drum hits) |
| `bytefield/` | the woven text: `chorus1.bytefield.txt` (the glyph grid), per-layer stream and source files, `chorus1.index.json`, plus `surface.png` / `height.png` / `normal.png` for the foil |
| `app/` | **the video, ready to watch and export**: `python3 serve.py`, then Chrome at http://localhost:8770/ (watch) or http://localhost:8770/?export (render the MP4). See `app/README.md` |
| `src/ocean/` | source of the video (the woven ocean, 16:9, the whole song). See its README |
| `src/woven/` | earlier: the vertical chorus slice: The Woven Lullaby, slice 1 (chorus 1). `npm install`, then `npm run dev`. See its README |
| `renders/` | preview videos (`woven-slice1-preview.mp4`) |
| `src/` | `weave_song.py` (makes a bytefield from a time range: `python3 weave_song.py 43.04 63.2 8 96 chorus1`); `proof/` the first cloth render page |
| `vendor/` | holospot and holocloth, cloned from GitHub |
| `references/` | the sample clip that set the mood, and proof renders |
| `archive/` | earlier passes: concept frames, the four-worlds piece (pass 2), the Möbius groove slice, the concept scenes |
| `_to_delete/` | a half-finished git clone that git couldn't clean up in this folder. Safe to delete |
## Timing notes
- Tempo is about 124.2 BPM (from the drum stem's kicks); one bar is about 1.93 s.
- Key moments: verse 1 at 0:13.20, chorus 1 at 0:43.04, Special Section at 0:59.16, "When it came from the womb" at 1:22.55, chorus 2 at 1:32.99, "Watching the paradox resolve" at 1:49.37, end at 2:21.84.// BOOTSTRAP PARADOX LULLABY — the woven ocean. 16:9, one unbroken shot, 2:22.
// The whole song is woven into one cloth of foil letters (tools/build_cloth.py) that lies on the sea. The eye rides
// the reading line at the speed of the song: behind it the words are lit, ahead they are written but not yet lit.
// Every frame is a pure function of song time, so the export is frame-exact.
import * as THREE from "three";
import { makeSky } from "./sky.js";
import { spectralLights, lens } from "./light.js";
import { RectAreaLightUniformsLib } from "three/addons/lights/RectAreaLightUniformsLib.js";
import { surfaceConstants, makeSurfaceJS, makeState, stripGeometry, PHI, clamp, smooth, lerp, NB } from "./surface.js";
import { createOceanMaterial } from "./material.js";
import { arcAt, T, TIME_TRAVEL } from "./arc.js";
import { exportMP4 } from "./mp4.js";
import { createMargin } from "./margin.js";
import { createSpray, readCells } from "./spray.js";
import { createDrops } from "./drops.js";
const Q = new URLSearchParams(location.search);
const TEST = Q.has("t"), EXPORT = Q.has("export");
const base = new URL("./", location.href).href;
const $ = (id) => document.getElementById(id);
const status = (s) => { const e = $("status"); if (e) e.textContent = s; };
// ---------------------------------------------------------------- data
const [D, E, cloth] = await Promise.all(["song.json", "envelopes.json", "cloth.json"].map((f) => fetch(base + f).then((r) => r.json())));
const END = D.end, BEAT = 60 / D.bpm;
const env = {};
for (const k of ["drums", "guitar", "vox", "bass", "harm"]) env[k] = Uint8Array.from(atob(E[k]), (c) => c.charCodeAt(0));
const envAt = (k, t) => { const a = env[k], x = t * E.fps, i = Math.floor(x); if (i < 0 || i >= a.length - 1) return 0; return (a[i] + (a[i + 1] - a[i]) * (x - i)) / 255; };
const lastBefore = (arr, t) => { let lo = 0, hi = arr.length - 1, k = -1; while (lo <= hi) { const m = (lo + hi) >> 1; if (arr[m] <= t) { k = m; lo = m + 1; } else hi = m - 1; } return k; };
const swell = (tau, peak) => (tau <= 0 ? 0 : (tau / peak) ** 2 * Math.exp(2 * (1 - tau / peak)));
const kick = D.kick, snare = D.snare;
// ONE signal drives everything: a slow breath, once per bar on the beat grid, scaled by the song's overall loudness
// smoothed over about two seconds. No instrument is followed on its own.
const ENERGY = (() => {
const sp = Uint8Array.from(atob(D.spec), (c) => c.charCodeAt(0)), nf = D.frames, nb = D.bands, e = new Float32Array(nf);
for (let i = 0; i < nf; i++) { let a = 0; for (let b = 0; b < nb; b++) a += sp[i * nb + b]; e[i] = a / nb / 255; }
const sig = 1.8 * D.fps, r = Math.ceil(sig * 3), w = []; for (let k = -r; k <= r; k++) w.push(Math.exp(-0.5 * (k / sig) ** 2));
const out = new Float32Array(nf);
for (let i = 0; i < nf; i++) { let a = 0, ws = 0; for (let k = -r; k <= r; k++) { const j = i + k; if (j < 0 || j >= nf) continue; a += e[j] * w[k + r]; ws += w[k + r]; } out[i] = a / ws; }
const sorted = [...out].sort((a, b) => a - b), lo = sorted[Math.floor(nf * 0.05)], hi = sorted[Math.floor(nf * 0.97)];
return out.map((v) => clamp((v - lo) / (hi - lo)));
})();
const energyAt = (t) => { const x = clamp(t * D.fps, 0, D.frames - 1.001), i = Math.floor(x); return lerp(ENERGY[i], ENERGY[i + 1], x - i); };
const BAR = 4 * 60 / D.bpm;
const pulseAt = (t) => { const ph = (t - D.beat0) / BAR; return energyAt(t) * (0.5 - 0.5 * Math.cos(2 * Math.PI * ph)); };
const K = surfaceConstants(cloth);
const S = makeSurfaceJS(K);
const sNow = (t) => t * K.SPEED;
// ---------------------------------------------------------------- the surface's state at time t (pure)
const H = 1 / 120, NSTEP = Math.ceil((END + 2) / H);
const phTab = new Float32Array(NSTEP + 1); // integral of the swell's speed; it runs backward in "time travel"
{
const dir = (t) => 1 - 2 * TIME_TRAVEL.reduce((m, [a, b]) => Math.max(m, smooth(a, a + BEAT * 1.5, t) * (1 - smooth(b - BEAT, b + BEAT * 0.5, t))), 0);
let p = 0; for (let i = 0; i <= NSTEP; i++) { phTab[i] = p; p += dir(i * H) * H; } // wave time: runs backward in "time travel"
}
const phaseAt = (t) => { const x = clamp(t / H, 0, NSTEP - 1), i = Math.floor(x); return lerp(phTab[i], phTab[i + 1], x - i); };
function stateAt(t, st = makeState(), arc = arcAt(t)) {
const p = phaseAt(t);
st.t = t; st.tau = p;
st.tide = arc.tide * Math.sin(2 * Math.PI * (t - D.beat0) / (BAR * 4)); // the tide breathes in and out, once every four bars
const pu = pulseAt(t); st.A = arc.A * (0.9 + 0.22 * pu); st.fold = arc.fold * (0.88 + 0.24 * pu); st.C = arc.C; st.F = arc.F;
st.curl = arc.curl; st.sc = sNow(t) + 1.5; st.wc = 9; st.ax = 0.9; st.R = 1.05;
st.Dw = arc.Dw; st.sw = sNow(t) + 3.2; st.rw = 2.4;
st.bumps.fill(0); // no per-hit swells: the cloth only breathes
return st;
}
// ---------------------------------------------------------------- the eye: a critically damped ride, precomputed for the whole song
function camTarget(t, st, arc) {
const sn = sNow(t);
const hb = (t - D.beat0) / (BEAT * 4) * Math.PI * 2; // the boat's sway: one slow lean per bar (half the old rate)
const g = (Math.sin(hb) + Math.sin(hb / PHI + 0.7) / PHI + Math.sin(hb / (PHI * PHI) + 1.9) / (PHI * PHI)) / 1.6;
const xe = 0.15 * g + 0.35 * Math.sin(t * 0.05);
const se = sn - arc.camBack;
let top = -1e9;
for (let ds = -0.6; ds <= 1.6; ds += 0.4) for (let dx = -0.8; dx <= 0.8; dx += 0.4) top = Math.max(top, S.height(xe + dx, se + ds, st));
const ye = Math.max(top + 0.25, S.height(xe, se, st) + arc.camH);
const sl = sn + arc.look;
const eye = new THREE.Vector3(xe, ye, -se);
const look = new THREE.Vector3(xe * 0.5, S.height(xe * 0.5, sl, st) * 0.5 + 0.05 * arc.look - 0.1, -sl);
// inside the barrel: ride the tube's axis
const b = clamp(arc.curl);
if (b > 0) {
eye.lerp(new THREE.Vector3(st.ax - 0.05, 0.5 * st.R, -(sn - 0.6)), b);
look.lerp(new THREE.Vector3(st.ax - 0.15, 0.55 * st.R, -(sn + 6)), b);
}
// the director: where the eye's attention goes (keyed in arc.js as cam* params, eased like everything else)Visuals built with holospot and holocloth by Dmitry Kurash, MIT license
The song on Before Training and the Field