Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
chore: resync Codex mirror
Alex Greenshpun8b1418efc08c
diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.tsindex 0dac60c..493f93b 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts@@ -18,8 +18,9 @@ export type Film = { meta: {holds?: [from: number, to: number][];onTwos?: boolean;step?: 1 | 2 | 3;- // the score as fitted to this film (fitScore): its tempo and form; render prints it next to the grid's bpm- score?: { tempo: number; form: string };+ // the score as fitted to this film: its tempo and form; render prints it next to the grid's bpm.+ // grid: the film's cuts sit on meta.bpm, so the score must play within 0.5 % of it (render refuses otherwise)+ score?: { tempo: number; form: string; grid?: boolean };}; assets: Assets; shots: Shot[]; audio?: (sampleRate: number) => [Float32Array, Float32Array] };// Cheap structural checks every adapter runs before frame 0. (The full gate is Phase 2.)diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.tsindex b053245..18e4e80 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts@@ -31,7 +31,9 @@ import * as launchPieces from "./music/pieces/launch";import * as nocturnePieces from "./music/pieces/nocturne";import * as samplers from "./music/pieces/samplers";import type { Piece } from "./music/plan";-import { composePiece, type Material } from "./music/compose";+import { composePiece, stretchIndex, withStretch, type Material } from "./music/compose";+import { perform } from "./music/perform";+import { beatsPerBar } from "./music/plan";import { novelty } from "./music/novelty";export type LaunchAsk = {@@ -98,10 +100,11 @@ export const makeLaunchFilm = (spec: LaunchSpec): Film & { cut: ReturnType<typeoif (spec.score === undefined && !spec.audio) throw new Error("launchTemplate: `score` is required: a piece composed for this product (references/music/compose.md), or null for silence");if (spec.score) refuseOurs(spec.score);const grid = beatGrid(spec.bpm, fps);- const ASK = Math.round((spec.askBeats ?? 6) * grid.beat), TYPE = Math.round((spec.typeBeats ?? 4) * grid.beat), END = Math.round((spec.endBeats ?? 8) * grid.beat);+ const ASK = Math.round((spec.askBeats ?? 6) * grid.beat), TYPE = Math.round((spec.typeBeats ?? 4) * grid.beat), END0_HOLD = Math.round((spec.endBeats ?? 8) * grid.beat);+ let END = END0_HOLD; // the end card is a hold: a scored film sets it so the film is whole bars of its scoreif (n < 1 || n > 3) throw new Error("launchTemplate: 1 to 3 asks; more is a feature list, not a story");if (ASK < 100) throw new Error(`launchTemplate: an ask beat needs 100 frames or more (it has ${ASK}); raise askBeats`);- if (END < 3 * fps + 40) throw new Error("launchTemplate: the end card must hold the install lines 3 s or more; raise endBeats");+ if (END < MIN_END(fps)) throw new Error("launchTemplate: the end card must hold the install lines 3 s or more; raise endBeats");const T = spec.asks.map((a, i) => ({ ...askTiming(a.prompt, i, ASK), base: i * ASK }));const END0 = n * ASK; // content frame where the end card starts@@ -191,6 +194,10 @@ export const makeLaunchFilm = (spec: LaunchSpec): Film & { cut: ReturnType<typeosegs.push(last && spec.claimBar !== undefined ? pic(i * ASK, (i + 1) * ASK, grid.solve(spec.claimBar, fixed, 60)) : pic(i * ASK, (i + 1) * ASK));if (!last && words[i]?.length) segs.push(type(words[i], TYPE, (i + 1) * ASK - 1, (i + 1) * ASK));});+ // the score plays at the film's bpm, exactly: the cuts sit on this grid. Sync wins over length, so+ // the end-card hold (not the tempo) takes up the difference: the film becomes whole bars of the score.+ const bed = !spec.audio && spec.score ? gridScore(spec.score, spec.bpm, fps, segs.reduce((a, x) => a + x.len, 0), END) : null;+ if (bed) END = bed.end;segs.push(pic(END0, END0 + END));const cut = makeCut(segs);const draw = (ctx: Ctx, F: number, env: Env) => {@@ -208,31 +215,56 @@ export const makeLaunchFilm = (spec: LaunchSpec): Film & { cut: ReturnType<typeoholds.push([cut.STARTS[k] + written + 1, cut.STARTS[k] + open + 1]);});holds.push([cut.N - END + 53, cut.N]); // the end card, all on: read it, screenshot it- // the score, fitted to the film's exact length so it ends on its phrase (fitScore: its stretch section- // repeated or dropped, then the tempo trimmed); the fitted tempo goes in meta so render prints it- // beside the grid's bpm (compose at the film's bpm and they stay within a few percent)- const bed = !spec.audio && spec.score ? scoreFit(asPiece(spec.score), cut.N, fps) : null;return {- meta: { title: `${spec.title} · launch`, W, H, fps, bpm: spec.bpm, durationFrames: cut.N, raster: "cpu", kind: "launch", holds, ...(bed ? { score: { tempo: bed.fit.tempo, form: bed.fit.form } } : {}) },+ meta: { title: `${spec.title} · launch`, W, H, fps, bpm: spec.bpm, durationFrames: cut.N, raster: "cpu", kind: "launch", holds, ...(bed ? { score: { tempo: spec.bpm, form: bed.form, grid: true } } : {}) },assets: { images: {} },shots: [{ id: "cut", start: 0, end: cut.N, draw }],- audio: spec.audio ?? (bed ? musicBed(() => bed.fit, cut.N, fps, -14, { limit: spec.limit }) : undefined),+ audio: spec.audio ?? (bed ? musicBed(() => bed.piece, cut.N, fps, -14, { limit: spec.limit, tempo: spec.bpm }) : undefined),cut,};};type Fit = ReturnType<typeof fitScore>;-const scoreFit = (piece: () => Piece, frames: number, fps: number) => ({ fit: fitScore(piece(), frames / fps) });+const MIN_END = (fps: number) => 3 * fps + 40; // the install lines held 3 s or more, after the card writes on-// A music bed: the piece FITTED to the film (fitScore, exactly as filmAudio: its stretch section-// repeated or dropped so it lands on its outro, the tempo trimmed so the tail rings out on the last-// frame; never cut and faded), then set to `lufs` integrated (default -14, the one published+/**+ * The score for a beat-grid film: played at the film's bpm exactly (the cuts sit on that grid), and+ * the film made whole bars of it. A Material's stretch section is repeated 0..n times; each form is+ * `bars` long plus whole bars for its tail to ring out, and the form whose length puts the end-card+ * hold nearest the one asked for wins (the hold stays between 3 s and the asked hold + 4 bars).+ * No tempo is changed; if no form fits, it throws. Bars before the final ritard are checked against+ * the grid to half a frame, so a rubato or a breath can never pull a downbeat off a cut.+ */+export const gridScore = (score: () => Piece | Material, bpm: number, fps: number, before: number, hold: number) => {+ const x = score(), barF = (4 * 60 * fps) / bpm, lo = MIN_END(fps), hi = hold + 4 * barF;+ const forms: (() => Piece)[] = "plan" in x ? [() => x] : stretchIndex(x) < 0 ? [() => composePiece(x)] : Array.from({ length: 33 }, (_, r) => () => composePiece(withStretch(x, r)));+ let best: { piece: Piece; end: number; bars: number; ring: number } | null = null, tried: string[] = [];+ for (const make of forms) {+ const p = make(), bpb = beatsPerBar(p.plan.meter);+ if (bpb !== 4) throw new Error(`launchTemplate: the score is in ${p.plan.meter}; a launch film's cuts sit on 4-beat bars, so compose it in 4/4`);+ if (p.plan.pickupBeats) throw new Error(`launchTemplate: the score opens with a ${p.plan.pickupBeats}-beat pickup; frame 0 is a downbeat, so start the score on the bar`);+ const bars = p.plan.sections.reduce((a, q) => a + q.bars, 0), ring = Math.ceil((p.tail * bpm) / 60 / 4 - 1e-9), end = Math.round((bars + ring) * barF) - before;+ tried.push(`${bars}+${ring} bars -> hold ${(end / fps).toFixed(1)} s`);+ if (end >= lo && end <= hi && (!best || Math.abs(end - hold) < Math.abs(best.end - hold))) best = { piece: p, end, bars, ring };+ if (end > hi) break; // more repeats only make it longer+ }+ if (!best) throw new Error(`launchTemplate: the score cannot end on a bar of this film at ${bpm} bpm without changing its tempo. The cut before the end card is ${(before / fps).toFixed(1)} s and the end-card hold must be ${(lo / fps).toFixed(1)}-${(hi / fps).toFixed(1)} s; the score's forms give ${tried.join(", ")}. Compose a 1-bar stretch section (stretch: true), or change askBeats/endBeats/claimBar.`);+ const piece: Piece = { ...best.piece, plan: { ...best.piece.plan, tempo: bpm, rubato: 0 } }, perf = perform(piece, bpm, { expressive: true }), spb = 60 / bpm;+ const lastBar = Math.floor((perf.lastOnset / spb - 6) / 4); // the final ritard lives in the last 6 beats, inside the end card+ for (let k = 0; k <= lastBar; k++) { const drift = perf.sec(4 * k) - 4 * k * spb; if (Math.abs(drift) > 0.5 / fps) throw new Error(`launchTemplate: the score's bar ${k} lands ${(drift * 1000).toFixed(0)} ms off the film's grid (a breath or a caesura in the score); a launch film's cuts need every downbeat on the grid: even out the section dynamics there`); }+ return { piece, end: best.end, bars: best.bars, form: `${best.bars} bars + ${best.ring} to ring, at the film's ${bpm} bpm` };+};++// A music bed: the piece FITTED to the film, never cut and faded. With `tempo` (a beat-grid film, as+// the launch template passes it) the piece plays at exactly that tempo and the film is already whole+// bars of it (gridScore); without, fitScore fits it as filmAudio does (its stretch section repeated or+// dropped, the tempo trimmed so the tail rings out on the last frame). Then it is set to `lufs` integrated (default -14, the one published// cross-platform target) with the true peak held at or under -1 dBTP. A dynamic piece stops at the// peak ceiling first (render prints how far short); `limit: true` lets a look-ahead limiter take// those few peaks instead so the bed reaches the target. Compose the piece for this film at the// film's bpm, so the cuts sit on its downbeats. `piece` may return a Piece or a fitScore result.-export const musicBed = (piece: () => Piece | Fit, frames: number, fps = 30, lufs = -14, o: { limit?: boolean } = {}) => (sr: number): [Float32Array, Float32Array] => {- const seconds = frames / fps, x = piece(), fit = "order" in x ? x : fitScore(x, seconds);+export const musicBed = (piece: () => Piece | Fit, frames: number, fps = 30, lufs = -14, o: { limit?: boolean; tempo?: number } = {}) => (sr: number): [Float32Array, Float32Array] => {+ const seconds = frames / fps, x = piece(), fit = "order" in x ? x : o.tempo ? { piece: x, tempo: o.tempo } : fitScore(x, seconds);const m = renderPiece(fit.piece, sr, { seconds, tempo: fit.tempo }), n = Math.round(seconds * sr);const L = new Float32Array(n), R = new Float32Array(n); L.set(m.L.subarray(0, n)); R.set(m.R.subarray(0, n));const gain = (dB: number) => { const g = Math.pow(10, dB / 20); for (let i = 0; i < n; i++) { L[i] *= g; R[i] *= g; } };diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/compose.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/compose.tsindex 7d0f296..dc1b9dd 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/compose.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/compose.ts@@ -162,14 +162,20 @@ export const lofiElectronic = (m: Omit<Material, "style">): Piece => composePiec* groove/hook/verse/drop) is played more or fewer times (0 = dropped), whichever puts the last* onset nearest `seconds - tail` at the written tempo. fitToDuration then trims the tempo.*/-export const refitMaterial = (m: Material, seconds: number): Material => {- const secs = m.sections, want = seconds - (m.tail ?? 3.2);- let si = secs.findIndex((s) => s.stretch);+/** The section a film fit repeats or drops: the one marked `stretch`, else the longest groove/hook/verse/drop; -1 when none. */+export const stretchIndex = (m: Material) => {+ const secs = m.sections; let si = secs.findIndex((s) => s.stretch);if (si < 0) secs.forEach((s, i) => { if (["groove", "hook", "verse", "drop"].includes(s.kind) && (si < 0 || s.bars * (s.repeat ?? 1) > secs[si].bars * (secs[si].repeat ?? 1))) si = i; });+ return si;+};+/** The same material with its stretch section played `r` times (0 = dropped). */+export const withStretch = (m: Material, r: number): Material => { const si = stretchIndex(m); return si < 0 ? m : { ...m, sections: m.sections.map((s, i) => (i === si ? { ...s, repeat: r } : s)).filter((s) => (s.repeat ?? 1) > 0) }; };+export const refitMaterial = (m: Material, seconds: number): Material => {+ const want = seconds - (m.tail ?? 3.2), si = stretchIndex(m);if (si < 0 || want <= 0) return m;let best: { m: Material; cost: number } | null = null;for (let r = 0; r <= 64; r++) {- const m2: Material = { ...m, sections: secs.map((s, i) => (i === si ? { ...s, repeat: r } : s)).filter((s) => (s.repeat ?? 1) > 0) };+ const m2 = withStretch(m, r);if (!m2.sections.some((s) => s.lead)) continue;const t = perform(composePiece(m2), m.bpm, { expressive: true }).lastOnset, tempo = m.bpm * (t / want), cost = Math.abs(Math.log(tempo / m.bpm));if (!best || cost < best.cost) best = { m: m2, cost };diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/launchTemplate.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/launchTemplate.test.tsindex 4955006..030de55 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/launchTemplate.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/launchTemplate.test.ts@@ -1,8 +1,8 @@// LAUNCH TEMPLATE TESTS. makeLaunchFilm takes a score composed for the product: a Material (what// compose.md writes) or a Piece. anidoodle's own pieces are refused by identity, by title and by// content, so a retitled or transposed copy of our launch score cannot ship as a user's film.-import { makeLaunchFilm } from "../src/canvas-core/launchTemplate";-import { chiptunePlayful, composePiece, daylightCopy, filmAudio, fitScore, launchLofi3, launchLofi3Material, loudness, perform, truePeak, type Material } from "../src/canvas-core/music";+import { gridScore, makeLaunchFilm } from "../src/canvas-core/launchTemplate";+import { chiptunePlayful, composePiece, daylightCopy, renderPiece, launchLofi3, launchLofi3Material, loudness, perform, truePeak, type Material } from "../src/canvas-core/music";import type { Film } from "../src/canvas-core/film";export const name = "launchTemplate";@@ -27,23 +27,31 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(refused(daylightCopy), "refuses the transposed copy of our launch score (the Daylight fixture)");ok(refused(undefined, /required/), "a missing score is an error, never a default");- // The bed is the score FITTED to the film (fitScore via filmAudio), never the first N seconds cut- // and faded: it is filmAudio's render exactly, times one gain, and its last note lands so the tail- // rings out on the last frame.+ // Sync wins over length: a 120 bpm film with a score whose stretch section is 4 bars plays the+ // score at EXACTLY 120 bpm, and the film is made whole bars of it by the end-card hold. The bed is+ // that render at one gain (never cut and faded, never re-tempoed), every downbeat on the grid.const two = { ...base, asks: [base.asks[0], { prompt: "again", plate, label: "l" }], askBeats: 16, endBeats: 12, score: mine };- const bedFilm = makeLaunchFilm(two), secs = bedFilm.meta.durationFrames / bedFilm.meta.fps, SR = 16000;- const [L, R] = bedFilm.audio!(SR), [fL] = filmAudio(composePiece(mine()), secs)(SR);- let k = 0; for (let i = 0; i < fL.length; i++) if (Math.abs(fL[i]) > Math.abs(fL[k])) k = i;- const g = L[k] / fL[k]; let dev = 0; for (let i = 0; i < L.length; i++) dev = Math.max(dev, Math.abs(L[i] - g * fL[i]));- ok(L.length === Math.round(secs * SR) && dev < 1e-5, `the bed is filmAudio (fitScore) at one gain, exactly the film's ${secs} s (max deviation ${dev.toExponential(1)})`);- const sc = bedFilm.meta.score, f = fitScore(composePiece(mine()), secs), end = perform(f.piece, f.tempo, { expressive: true }).lastOnset + f.piece.tail;- ok(!!sc && sc.form === f.form && Math.abs(sc.tempo - f.tempo) < 1e-9, `meta.score reports the fit (${sc?.tempo.toFixed(1)} bpm, ${sc?.form}) for render to print beside the grid's 120 bpm`);- ok(f.piece.arrangement?.at(-1)?.kind === "outro" && Math.abs(end - secs) < 0.25, `it ends on its outro: last note + tail = ${end.toFixed(2)} s of ${secs} s`);+ const bedFilm = makeLaunchFilm(two), N = bedFilm.meta.durationFrames, secs = N / bedFilm.meta.fps, SR = 16000, sc = bedFilm.meta.score;+ ok(!!sc && sc.tempo === 120 && sc.grid === true, `the score plays at the film's bpm exactly (${sc?.tempo} bpm, ${sc?.form})`);+ ok(N % 60 === 0, `the film is whole bars of the score (${N} frames = ${N / 60} bars of 60 frames)`);+ const endAt = bedFilm.cut.STARTS[bedFilm.cut.SEGS.length - 1];+ ok(bedFilm.cut.STARTS.every((f) => f % 60 === 0) && endAt === 2 * 16 * 15, `every cut sits on a downbeat (${bedFilm.cut.STARTS.join(", ")}; end card at ${endAt})`);+ const played = gridScore(mine, 120, 30, endAt, 12 * 15), perf = perform(played.piece, 120, { expressive: true });+ let worst = 0; for (let b = 0; 4 * b * 0.5 < perf.lastOnset - 3; b++) worst = Math.max(worst, Math.abs(perf.sec(4 * b) - 2 * b));+ ok(worst < 1e-6, `every downbeat before the final ritard lands on its bar, worst ${(worst * 1000).toFixed(3)} ms`);+ ok(played.bars * 60 < N && played.piece.plan.sections.length >= 1, `the score (${played.bars} bars) ends inside the film and rings out on its last frame`);+ const [L, R] = bedFilm.audio!(SR), r = renderPiece(played.piece, SR, { seconds: secs, tempo: 120 });+ let k = 0; for (let i = 0; i < r.L.length; i++) if (Math.abs(r.L[i]) > Math.abs(r.L[k])) k = i;+ const g = L[k] / r.L[k]; let dev = 0; for (let i = 0; i < L.length; i++) dev = Math.max(dev, Math.abs(L[i] - g * r.L[i]));+ ok(L.length === Math.round(secs * SR) && dev < 1e-5, `the bed is that 120 bpm render at one gain, exactly the film's ${secs} s (max deviation ${dev.toExponential(1)})`);+ // no form of a fixed score fits: an error that says what to do, never a tempo change+ let msg = ""; try { makeLaunchFilm({ ...two, score: () => composePiece({ ...mine(), sections: mine().sections.map((x) => ({ ...x, stretch: false, kind: x.kind === "groove" ? "intro" : x.kind })) }) }); } catch (e) { msg = (e as Error).message; }+ ok(/cannot end on a bar.*1-bar stretch section/.test(msg), `a score that cannot fit throws with the fix: ${msg.slice(0, 90)}...`);const lu = loudness([L, R], SR).integrated, tp = truePeak([L, R]).dbtp;ok(tp <= -0.99 && (Math.abs(lu + 14) < 0.3 || tp > -1.05), `bed at -14 LUFS or held by the -1 dBTP ceiling (${lu.toFixed(2)} LUFS, ${tp.toFixed(2)} dBTP)`);// a dynamic bed stops at the peak ceiling; limit: true lets the limiter take those peaks insteadconst long = { ...two, askBeats: 24, endBeats: 16 }, [cL, cR] = makeLaunchFilm(long).audio!(SR), [lL, lR] = makeLaunchFilm({ ...long, limit: true }).audio!(SR);const cu = loudness([cL, cR], SR).integrated, lu2 = loudness([lL, lR], SR).integrated, tp2 = truePeak([lL, lR]).dbtp;- ok(cu < -14.5 && truePeak([cL, cR]).dbtp > -1.05, `without limit the ceiling wins and says so in the loudness (${cu.toFixed(2)} LUFS)`);+ ok(cu < -14.2 && truePeak([cL, cR]).dbtp > -1.05, `without limit the ceiling wins and says so in the loudness (${cu.toFixed(2)} LUFS)`);ok(Math.abs(lu2 + 14) < 0.3 && tp2 <= -1, `limit: true reaches -14 LUFS under -1 dBTP (${lu2.toFixed(2)} LUFS, ${tp2.toFixed(2)} dBTP)`);};diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/render.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/render.mjsindex 58a90d9..3b2448a 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/render.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/render.mjs@@ -68,6 +68,8 @@ if (POSTER !== null && POSTER >= N) { console.error(`--poster-frame ${POSTER} isif (POSTER !== null) console.log(`poster: frame 0 is frame ${POSTER}, dissolving into the opening by frame ${Math.max(1, FADE)}`);const posterAt = (n) => POSTER !== null && n < Math.max(1, FADE); // frames the poster dissolve touchesconst drawAt = (n, w) => (posterAt(n) ? session.poster(n, POSTER, FADE, BLUR, w) : BLUR > 1 ? session.blur(n, BLUR, w) : session.frame(n, w));+// a film whose cuts sit on its beat grid (meta.score.grid) must hear its score at that grid's tempo+if (meta.score?.grid && Math.abs(meta.score.tempo / meta.bpm - 1) > 0.005) { console.error(`render: the score plays at ${meta.score.tempo.toFixed(2)} bpm but this film's cuts sit on a ${meta.bpm} bpm grid (${((meta.score.tempo / meta.bpm - 1) * 100).toFixed(1)} %, limit 0.5 %): the cuts would drift off the downbeats. Play the score at the film's bpm and make the film whole bars of it (launchTemplate does), or compose a 1-bar stretch section`); process.exit(2); }console.log(`film: "${meta.title}" ${meta.W}x${meta.H} @ ${meta.fps} fps, ${N} frames, ${meta.bpm} bpm, scale ${scale}, ${session.workers} page(s)`);if (BLUR > 1) console.log(`motion blur: ${BLUR} subframes per frame, one-frame shutter, linear light`);if (ranged) console.log(`range render: frames [${FROM}, ${TO}) of ${N}, silent by design`);@@ -84,8 +86,8 @@ if (a) { // the audio report: loudness and true peak, and the score's fit againsconsole.log(`audio: ${lu.toFixed(1)} LUFS integrated, ${tp.toFixed(1)} dBTP true peak`);if (lu < -14.5 && tp > -1.1) console.log(` NOTE the -1 dBTP ceiling held the gain ${(-14 - lu).toFixed(1)} dB under -14 LUFS (the cross-platform target): peaks are a composing problem (stagger the bass under the loudest downbeat, roll the big chord); a launch template bed takes \`limit: true\``);if (meta.score) { const off = (meta.score.tempo / meta.bpm - 1) * 100;- console.log(`score: fitted to the film at ${meta.score.tempo.toFixed(1)} bpm (${meta.score.form}); the picture's grid is ${meta.bpm} bpm (${off >= 0 ? "+" : ""}${off.toFixed(1)} %)`);- if (Math.abs(off) > 2) console.log(" NOTE past 2 % the cuts drift off the score's downbeats: a 1-bar stretch section, or the Material's `tail`, lets the fit land nearer the grid"); }+ console.log(`score: ${meta.score.tempo.toFixed(2)} bpm (${meta.score.form}); the picture's grid is ${meta.bpm} bpm (${off >= 0 ? "+" : ""}${off.toFixed(2)} %)`);+ if (!meta.score.grid && Math.abs(off) > 2) console.log(" NOTE past 2 % the score's downbeats drift from meta.bpm: a 1-bar stretch section, or the Material's `tail`, lets the fit land nearer it"); }}mkdirSync(join(out, ".."), { recursive: true });diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.mdindex 1f55174..324d26f 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md@@ -46,13 +46,15 @@ muted), the camera easing out for the press, an ink drop arcing from Generate inand blooming open into a card where the plate draws itself live, the thread keeping earlieranswers and scrolling, a gentle lean onto each new card, full-frame word pages between asks,and the end card blooming open and holding. The corner mark (your name, hand-lettered) steps-aside before any lean. Real holds are declared, so the gate passes. The score is fitted to the-film (`fitScore`: its stretch section repeated or dropped, the tempo trimmed) so it ends on its-outro at the last frame, then set to -14 LUFS with the true peak at or under -1 dBTP-(`musicBed`). Render prints the loudness and the fitted tempo beside the grid's bpm: compose at-the film's bpm with a 1-bar stretch section (or set the Material's `tail`) so they stay within-2 %, or the cuts drift off the downbeats. A dynamic piece stops at the peak ceiling first and-render says how far short; `limit: true` lets a look-ahead limiter take those peaks instead.+aside before any lean. Real holds are declared, so the gate passes. Sync wins over length: the+score plays at the film's bpm exactly, so every cut sits on its downbeats, and the film is made+whole bars of the score (`gridScore`: the stretch section repeated or dropped, then the end-card+hold, which is a hold, grows or shrinks to the bar; the tail rings out in whole bars). A score in+4/4 with no pickup, starting on frame 0. If no form fits, the build throws: compose a 1-bar+stretch section or change askBeats/endBeats. Render refuses a beat-grid film whose score is more+than 0.5 % off its bpm. The bed is set to -14 LUFS with the true peak at or under -1 dBTP+(`musicBed`); a dynamic piece stops at the peak ceiling first and render says how far short;+`limit: true` lets a look-ahead limiter take those peaks instead.**The plates and the score are made for this product, every time.** A style is a recipe appliedto the user's subject (`references/styles.md`): draw their dashboard, their mascot, their