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
own words throughout the machine, site-art and sound docs; clearer scorecard bands; 0.9.1
Alex Greenshpund29ecab5ba1a
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 86e0f4e..84c5d7b 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -13,7 +13,7 @@"name": "anidoodle","source": "./","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",- "version": "0.9.0",+ "version": "0.9.1","author": {"name": "Alex Greenshpun","url": "https://linkedin.com/in/alexgreensh"diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex e3572bf..ccc31d0 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -2,7 +2,7 @@"name": "anidoodle","displayName": "anidoodle","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",- "version": "0.9.0",+ "version": "0.9.1","icon": "./assets/icon.png","author": {"name": "Alex Greenshpun",diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex 150b76d..9cd95da 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "anidoodle",- "version": "0.9.0",+ "version": "0.9.1","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.","skills": "./skills/","interface": {diff --git a/.grok-plugin/marketplace.json b/.grok-plugin/marketplace.jsonindex 28919da..bf91abf 100644--- a/.grok-plugin/marketplace.json+++ b/.grok-plugin/marketplace.json@@ -10,7 +10,7 @@"name": "anidoodle","source": "./plugins/anidoodle","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",- "version": "0.9.0",+ "version": "0.9.1","author": {"name": "Alex Greenshpun","url": "https://linkedin.com/in/alexgreensh"diff --git a/README.fr-FR.md b/README.fr-FR.mdindex 1714dfd..2d1e6c1 100644--- a/README.fr-FR.md+++ b/README.fr-FR.md@@ -162,7 +162,7 @@ Demandez comment dessiner quelque chose, ou apportez un de vos dessins, et anido| **Présentations et documents** | Une famille d'illustrations de section issues d'un seul programme. Une nouvelle graine donne une image sœur dans le même style. || **Récits** | Des storyboards et des animatics qui grandissent jusqu’à devenir un film achevé, de n’importe quelle durée, avec une bande originale. || **Votre propre image** | Apportez un dessin et reprenez son style pour un nouveau sujet, ou apportez une photo et recréez-la dans l’une des 32 manières, chaque trait tracé par le code. |-| **Pages web** | Des illustrations interactives qui suivent le curseur, réagissent aux clics et aux formulaires, ou se dessinent au fil du défilement. Des visuels de une et des spots à côté de votre titre, aux couleurs de votre page et de votre marque, en clair ou en sombre. |+| **Pages web** | Des illustrations interactives qui suivent le curseur, réagissent aux clics et aux formulaires, ou se dessinent au fil du défilement. Des visuels d'en-tête et des spots à côté de votre titre, aux couleurs de votre page et de votre marque, en clair ou en sombre. || **Apprentissage** | Des leçons de dessin en étapes et en accéléré, pour comprendre la construction d’une image, les points à observer et les erreurs courantes. || **Personnages** | Un personnage créé une fois, qui reste identique d’un plan, d’une pose et d’un style à l’autre. || **Votre lancement** | Un film de lancement pour votre produit à partir d'un modèle : vos demandes, vos images, vos mots et vos lignes d'installation, montés sur une musique. |diff --git a/plugins/anidoodle/.claude-plugin/plugin.json b/plugins/anidoodle/.claude-plugin/plugin.jsonindex e3572bf..ccc31d0 100644--- a/plugins/anidoodle/.claude-plugin/plugin.json+++ b/plugins/anidoodle/.claude-plugin/plugin.json@@ -2,7 +2,7 @@"name": "anidoodle","displayName": "anidoodle","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",- "version": "0.9.0",+ "version": "0.9.1","icon": "./assets/icon.png","author": {"name": "Alex Greenshpun",diff --git a/plugins/anidoodle/.codex-plugin/plugin.json b/plugins/anidoodle/.codex-plugin/plugin.jsonindex 150b76d..9cd95da 100644--- a/plugins/anidoodle/.codex-plugin/plugin.json+++ b/plugins/anidoodle/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "anidoodle",- "version": "0.9.0",+ "version": "0.9.1","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.","skills": "./skills/","interface": {diff --git a/plugins/anidoodle/skills/anidoodle/engine/package.json b/plugins/anidoodle/skills/anidoodle/engine/package.jsonindex b0aba70..553afff 100644--- a/plugins/anidoodle/skills/anidoodle/engine/package.json+++ b/plugins/anidoodle/skills/anidoodle/engine/package.json@@ -1,6 +1,6 @@{"name": "anidoodle-engine",- "version": "0.9.0",+ "version": "0.9.1","private": true,"type": "module","description": "Portable art core + backend adapters for illustrations, animations and films drawn entirely in code.",diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/assetKit.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/assetKit.tsindex 558979d..0d3d207 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/assetKit.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/assetKit.ts@@ -2,7 +2,7 @@// a social card. Three things change when a picture leaves its own card and sits on a site:// 1. placement: the art has a region, and the headline has a zone the art must never enter;// 2. ground: the paper IS the page colour, so every neutral moves to suit it, light or dark;-// 3. brand: one hex becomes a whole material (body) or only its marks (ink), in either theme.+// 3. brand: one hex colours a whole part (solid) or just its strokes and dots (lines), light theme or dark.// Placement is plain numbers. Ground and brand are a palette: `setPalette(pagePalette(...))` and every// material the kit paints is moved through it, so a machine is restyled without touching its parts.import type { Material } from "./mechanismKit";@@ -10,24 +10,25 @@ import type { Material } from "./mechanismKit";export type Rect = { x: number; y: number; w: number; h: number };export type Placement = { W: number; H: number; art: Rect; safe?: Rect; pad: number; note: string };-/** canvases by where the art sits. Sizes are about 1 unit per CSS pixel at the size the art is shown. */+/** canvases by where the art sits, in logical units near CSS pixels at the size the art is shown */export const PLACEMENTS: Record<string, Placement> = {- heroRight: { W: 1200, H: 640, art: { x: 520, y: 40, w: 640, h: 560 }, safe: { x: 0, y: 0, w: 480, h: 640 }, pad: 24, note: "headline left, art right; the moment faces the text" },- heroLeft: { W: 1200, H: 640, art: { x: 40, y: 40, w: 640, h: 560 }, safe: { x: 720, y: 0, w: 480, h: 640 }, pad: 24, note: "the mirror of heroRight" },- heroCentre: { W: 1200, H: 720, art: { x: 180, y: 210, w: 840, h: 480 }, safe: { x: 0, y: 0, w: 1200, h: 190 }, pad: 24, note: "headline above, a wide low object below" },- art: { W: 800, H: 600, art: { x: 0, y: 0, w: 800, h: 600 }, pad: 28, note: "the page lays out its own text" },- tile: { W: 640, H: 480, art: { x: 0, y: 0, w: 640, h: 480 }, pad: 32, note: "a feature card" },- spot: { W: 320, H: 320, art: { x: 0, y: 0, w: 320, h: 320 }, pad: 20, note: "one small object; cut detail, never shrink it to mush" },- banner: { W: 1600, H: 400, art: { x: 0, y: 24, w: 1600, h: 352 }, pad: 24, note: "a section divider; may bleed off a clean straight edge" },- social: { W: 1200, H: 630, art: { x: 560, y: 40, w: 600, h: 550 }, safe: { x: 0, y: 0, w: 520, h: 630 }, pad: 24, note: "a share card: words left, object right, carries its own ground" },- slide: { W: 1920, H: 1080, art: { x: 800, y: 80, w: 1060, h: 920 }, safe: { x: 0, y: 0, w: 760, h: 1080 }, pad: 32, note: "a deck slide" },+ heroSide: { W: 1600, H: 900, art: { x: 700, y: 60, w: 840, h: 780 }, safe: { x: 0, y: 0, w: 640, h: 900 }, pad: 32, note: "words on the left, the object on the right, its moment turned toward the words" },+ heroSideLeft: { W: 1600, H: 900, art: { x: 60, y: 60, w: 840, h: 780 }, safe: { x: 960, y: 0, w: 640, h: 900 }, pad: 32, note: "heroSide mirrored" },+ heroStack: { W: 1600, H: 900, art: { x: 200, y: 330, w: 1200, h: 540 }, safe: { x: 0, y: 0, w: 1600, h: 300 }, pad: 32, note: "words above, a long low object under them" },+ art: { W: 1200, H: 900, art: { x: 0, y: 0, w: 1200, h: 900 }, pad: 36, note: "the page sets its own words" },+ card: { W: 800, H: 600, art: { x: 0, y: 0, w: 800, h: 600 }, pad: 36, note: "a feature card" },+ icon: { W: 480, H: 480, art: { x: 0, y: 0, w: 480, h: 480 }, pad: 28, note: "a small single object; simplify the parts rather than shrink them" },+ strip: { W: 1920, H: 480, art: { x: 0, y: 28, w: 1920, h: 424 }, pad: 28, note: "a band between sections; the art may be cropped by a single side of the band, no more" },+ social: { W: 1200, H: 630, art: { x: 600, y: 45, w: 560, h: 540 }, safe: { x: 0, y: 0, w: 560, h: 630 }, pad: 28, note: "a link preview: words left, object right, its own ground" },+ slide: { W: 1920, H: 1080, art: { x: 860, y: 90, w: 1000, h: 900 }, safe: { x: 0, y: 0, w: 800, h: 1080 }, pad: 36, note: "a deck slide" },};/** the art region shrunk by its pad, as the corner box [x0, y0, x1, y1] `Cam.fit` takes */export const fitBox = (p: Placement): [number, number, number, number] => [p.art.x + p.pad, p.art.y + p.pad, p.art.x + p.art.w - p.pad, p.art.y + p.art.h - p.pad];/** where the eye should land: a third of the way into the art region, on the side nearest the text */export const strongPoint = (p: Placement): [number, number] => {- const towardText = p.safe ? (p.safe.x + p.safe.w / 2 < p.art.x + p.art.w / 2 ? 1 / 3 : 2 / 3) : 1 / 2;- return [p.art.x + p.art.w * towardText, p.art.y + p.art.h * (p.safe && p.safe.w === p.W ? 1 / 3 : 0.45)];+ const s = p.safe, above = s !== undefined && s.w >= p.W, cx = s ? s.x + s.w / 2 : 0, ax = p.art.x + p.art.w / 2;+ const fx = !s || above ? 1 / 2 : cx < ax ? 1 / 3 : 2 / 3; // words beside: lean toward them; words above or none: centre+ return [p.art.x + p.art.w * fx, p.art.y + p.art.h * (above ? 1 / 3 : 0.45)];};// ---------------------------------------------------------------- colour in a perceptual space (OKLab)@@ -50,19 +51,20 @@ export const fromLab = (lab: Lab): string => {for (let k = 0; k < 24; k++) { const rgb = labRgb([L, a, b]); if (rgb.every((v) => v >= -1e-4 && v <= 1 + 1e-4)) break; a *= 0.88; b *= 0.88; }return "#" + labRgb([L, a, b]).map((v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).padStart(2, "0")).join("");};-export const isDark = (paper: string) => toLab(paper)[0] < 0.6;+/** a page is dark when white text would read better on it than black: its relative luminance under about 0.18 */+export const isDark = (paper: string) => { const [r, g, b] = hexRgb(paper).map(toLin); return 0.2126 * r + 0.7152 * g + 0.0722 * b < 0.18; };// ---------------------------------------------------------------- the page palette-export type Colour = string | { hex: string; mode?: "body" | "ink" };+export type Colour = string | { hex: string; mode?: "solid" | "lines" };export type PageOpts = {paper: string; // the exact colour of the page the art sits onkitPaper?: string; // the paper the materials were designed on (the kit's cream)- tint?: number; // 0 keeps neutral greys, 1 takes the page's whole colour cast; 0.5 by default+ tint?: number; // how much of the page's hue the greys pick up: 0 none, 1 all of it, 0.5 by defaultaccent?: Colour; // the brand colour of the part to watch (materials with accent: true)colours?: Record<string, Colour>; // per material name: a brand or material colour (brass, walnut, ebony)};-/** one hex as a five-step material ramp in a theme: hue and chroma kept, lightness set where four tones still read */+/** one hex as a five-step material ramp in a theme: the hue and chroma stay, and the lightness sits where every step stays distinct from its neighbour */export const rampFrom = (hex: string, dark: boolean): { ramp: Material["ramp"]; seam: string; pigment: string } => {const [L0, a, b] = toLab(hex), c = dark ? Math.max(0.32, Math.min(0.64, L0 * 0.78)) : Math.max(0.36, Math.min(0.8, L0));const at = (L: number) => fromLab([L, a, b]);@@ -73,8 +75,9 @@ export const rampFrom = (hex: string, dark: boolean): { ramp: Material["ramp"];export const pagePalette = (o: PageOpts): ((m: Material) => Material) => {const dark = isDark(o.paper), P = toLab(o.paper), K = toLab(o.kitPaper ?? "#f3f0e8"), tint = o.tint ?? 0.5;const da = (P[1] - K[1]) * tint, db = (P[2] - K[2]) * tint;- // light page: everything moves by the page's difference in lightness and, by `tint`, in colour.- // dark page: parts sit a little above the page, the lit top lightest, lines lighter than the faces.+ // light page: each colour shifts by how far the page's lightness is from the kit's cream, and picks up+ // a `tint` share of the page's hue. dark page: parts rise just above the page, lit tops brightest, and+ // lines are drawn lighter than the faces they edge.const move = (hex: string, base: number) => {const [L, a, b] = toLab(hex);if (!dark) return fromLab([L + (P[0] - K[0]), a + da, b + db]);@@ -87,9 +90,9 @@ export const pagePalette = (o: PageOpts): ((m: Material) => Material) => {out = { ...m, ramp: m.ramp.map((c) => move(c, base)) as Material["ramp"], seam: dark ? fromLab([P[0] + 0.2, da, db]) : move(m.seam, base), ink: dark ? fromLab([Math.min(0.93, P[0] + 0.62), da, db]) : move(m.ink, base), pigment: m.pigment ? move(m.pigment, base - 0.25) : m.pigment };const want = (m.accent ? o.accent : undefined) ?? (m.name ? o.colours?.[m.name] : undefined);if (want) {- const { hex, mode = "body" } = typeof want === "string" ? { hex: want } : want, r = rampFrom(hex, dark);- // body: the part is made of the colour. ink: the part stays neutral and only its lines and dots take it.- out = mode === "body" ? { ...out, ramp: r.ramp, seam: r.seam, pigment: r.pigment } : { ...out, ink: r.pigment, seam: r.pigment };+ const { hex, mode = "solid" } = typeof want === "string" ? { hex: want } : want, r = rampFrom(hex, dark);+ // solid: the whole part takes the colour. lines: the faces keep their greys and only strokes and dots change.+ out = mode === "solid" ? { ...out, ramp: r.ramp, seam: r.seam, pigment: r.pigment } : { ...out, ink: r.pigment, seam: r.pigment };}cache.set(key, out); return out;};diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.tsindex 061da9a..0e3f804 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/film.ts@@ -21,7 +21,7 @@ export type Film = { meta: {locked?: [from: number, to: number, reason: string][];// a declared hold: the stillness is meant (a word read, an end card); the optional reason is printed by the gateholds?: [from: number, to: number, reason?: string][];- /** silences the film means (a stop-down before a reveal, a held breath), [fromFrame, toFrame, reason]: verify-export does not count them as holes */+ /** silences the film means (a held breath before a reveal, a pause on a beat), [fromFrame, toFrame, reason]: verify-export does not count them as holes */quiet?: [from: number, to: number, reason?: string][];onTwos?: boolean;step?: 1 | 2 | 3;diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanism.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanism.tsindex e89b771..ee8931b 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanism.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanism.ts@@ -97,10 +97,10 @@ export const stateAt = (f: number): State => {const settled = clamp01((f - T.apart) / 40) * (1 - clamp01((f - T.home + 6) / 6));if (settled > 0) PLAN.order.forEach((id, i) => { shares[id] += 0.035 * settled * Math.sin((2 * Math.PI * t) / 2.6 + i * 0.9); });let lit = "drum", read = pl.read;- if (moving) read = f < T.home ? "TAKING APART" : "PUTTING BACK";+ if (moving) read = f < T.home ? "EXPLODING" : "REASSEMBLING";if (apart) {const k = Math.floor(clamp01((f - T.tour[0]) / (T.tour[1] - T.tour[0])) * PLAN.order.length * 0.9999);- lit = PLAN.order[f < T.tour[0] ? PLAN.order.length - 1 : k]; read = f < T.tour[0] ? `${PLAN.order.length} ASSEMBLIES APART` : `${PLAN.order.indexOf(lit) + 1}/${PLAN.order.length} · ${ABOUT[lit]}`;+ lit = PLAN.order[f < T.tour[0] ? PLAN.order.length - 1 : k]; read = f < T.tour[0] ? `${PLAN.order.length} ASSEMBLIES OUT` : `${PLAN.order.indexOf(lit) + 1}/${PLAN.order.length} · ${ABOUT[lit]}`;}return { rot, shares, lit, read, bend: pl.bend, fan: pl.fan, crank: pl.crank };};@@ -196,9 +196,9 @@ const parts = (c: Cam, s: State): Item[] => {const F = frameAlong([60, 12, 19.4], [0, 0, 1]); turned(ctx, c, F, cyl(0, 4, 1.5), M("governor", STEEL), { off: o, lit: lit("governor") });const KS = Math.round(20 / (hand().coarse ?? 1)); for (let i = 0; i < 9; i++) { const z0 = 0.3 + i * 0.42; for (let k = 0; k < KS; k++) { const th0 = (k / KS) * 2 * Math.PI + s.fan * 0.15, th1 = th0 + (2 * Math.PI) / KS, f = facingAt(c, F, (th0 + th1) / 2); if (f < 0.05) continue; const A = c.p(at(F, z0 + (k / KS) * 0.42, 1.5, th0)), B = c.p(at(F, z0 + ((k + 1) / KS) * 0.42, 1.5, th1)); ink(ctx, [[A[0] + o[0], A[1] + o[1]], [B[0] + o[0], B[1] + o[1]]], "seam", STEEL, false, smooth(0.05, 0.5, f)); } }}, "governor");- // the fan turns nine times a drum turn; with `blur` (radians of trail) it reads as spinning, not as a still cut-out- const sweep = (s.blur ?? 0), disc = (ctx: Ctx, o: P2) => () => tone(ctx, hull([...circleAt(c, [60, 12, 24.6], 4.6, o), ...circleAt(c, [60, 12, 28.8], 4.6, o)]), M("governor", ZINC), 4); // one shape: see-through bands would stack into stripes- [1, -1].forEach((side) => { const ring = vane(s.fan, side), mid = ring.reduce((a, q) => [a[0] + q[0] / 4, a[1] + q[1] / 4], [0, 0]); put(`vane${side}`, [mid[0], mid[1], 26.5], (ctx, o) => spin(s.fan, sweep, (ang) => prism(ctx, c, vane(ang, side), 24.6, 4.2, M("governor", ZINC), { off: o, lit: lit("governor") }), { disc: side > 0 ? disc(ctx, o) : undefined }), "governor", 0); });+ // the fan turns nine times a drum turn; with `blur` (radians the echoes spread over) it reads as spinning, not as a still cut-out+ const sweep = (s.blur ?? 0), sweptFan = (ctx: Ctx, o: P2) => () => tone(ctx, hull([...circleAt(c, [60, 12, 24.6], 4.6, o), ...circleAt(c, [60, 12, 28.8], 4.6, o)]), M("governor", ZINC), 4); // one shape: see-through bands would stack into stripes+ [1, -1].forEach((side) => { const ring = vane(s.fan, side), mid = ring.reduce((a, q) => [a[0] + q[0] / 4, a[1] + q[1] / 4], [0, 0]); put(`vane${side}`, [mid[0], mid[1], 26.5], (ctx, o) => spin(s.fan, sweep, (ang) => prism(ctx, c, vane(ang, side), 24.6, 4.2, M("governor", ZINC), { off: o, lit: lit("governor") }), { swept: side > 0 ? sweptFan(ctx, o) : undefined }), "governor", 0); });/** the music box at rest on a page, playing: every part home, the drum turning, the fan a blur */put("hub", [60, 12, 26.7], (ctx, o) => turned(ctx, c, frameAlong([60, 12, 24.4], [0, 0, 1]), cyl(0, 4.6, 0.95), M("governor", STEEL), { off: o }), "governor", 0.05);put("gcap", [60, 12, 30.6], (ctx, o) => turned(ctx, c, frameAlong([60, 12, 30.2], [0, 0, 1]), cyl(0, 0.8, 1.3), STEEL, { off: o }), "governor", 2);diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.tsindex e1ef8fc..e85a1bf 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts@@ -45,7 +45,7 @@ export const mechanismExplorer: Piece = {const shares = Object.fromEntries(PLAN.order.map((id) => [id, Math.max(0, s.spring[id] as number)])), mean = PLAN.order.reduce((a, id) => a + shares[id], 0) / PLAN.order.length;const rot = s.reduced ? 0.4 : ((tick % LOOP) / LOOP) * 2 * Math.PI, pl = play(rot, Math.min(1, mean * 3));const state: State = { rot, shares, lit: "drum", read: pl.read, bend: pl.bend, fan: pl.fan, crank: pl.crank };- if (mean > 0.02 && mean < 0.9) state.read = (s.spring[PLAN.order[0]] as number) > 0.5 ? "TAKING APART" : "PUTTING BACK";+ if (mean > 0.02 && mean < 0.9) state.read = (s.spring[PLAN.order[0]] as number) > 0.5 ? "EXPLODING" : "REASSEMBLING";if (mean >= 0.9 && s.pointer) { // the part under the pointer: the nearest assembly, where it is nowlet best = Infinity;for (const id of PLAN.order) { const q: P2 = CAM.p(add(HOME[id], mul(MOVE[id], shares[id]))), d = Math.hypot(q[0] - s.pointer[0], q[1] - s.pointer[1]); if (d < best) { best = d; state.lit = id; } }diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismKit.tsindex 4dd3c75..0badef9 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts@@ -144,24 +144,26 @@ export const setHand = (h: Hand) => { HAND = h; };let PALETTE: ((m: Material) => Material) | null = null;export const setPalette = (f: ((m: Material) => Material) | null) => { PALETTE = f; };const pal = (m: Material) => (PALETTE ? PALETTE(m) : m);-// a ghost is a part drawn faintly where it just was (a spinning blade's trail): no knock, so what is behind shows-let GHOST = 1;-export const ghost = (alpha: number, draw: () => void) => { const g = GHOST; GHOST = g * alpha; try { draw(); } finally { GHOST = g; } };+// faint: paint a part at reduced strength where it was a moment ago, with no knock, so whatever is behind+// it stays visible through it+let FAINT = 1;+export const faint = (alpha: number, draw: () => void) => { const g = FAINT; FAINT = g * alpha; try { draw(); } finally { FAINT = g; } };/**- * Something that turns fast enough to blur. `draw(angle)` paints the blades at an angle; behind them go- * `trails` fainter copies, spread over `sweep` radians against the direction of travel, and under all of- * it the caller's swept `disc`, if any, as a faint sheen. Slow turns (sweep near 0) draw the blades alone.+ * A part turning too fast to see clearly. `draw(angle)` paints the blades at one angle. Before them come+ * `echoes` fainter copies of the blades, each a little further back along the turn, spaced over `sweep`+ * radians, and below those the caller's `swept` shape, if given, painted very faint. When `sweep` is near+ * 0 the turn is slow and only the blades are drawn.*/-export const spin = (angle: number, sweep: number, draw: (angle: number) => void, o: { trails?: number; disc?: () => void } = {}) => {- const n = o.trails ?? 4, blur = Math.min(1, Math.abs(sweep) / 1.2);- if (blur > 0.02) { if (o.disc) ghost(0.16 * blur, o.disc); for (let k = n; k >= 1; k--) ghost(0.42 * blur * (1 - k / (n + 1)) ** 1.4, () => draw(angle - (sweep * k) / n)); }+export const spin = (angle: number, sweep: number, draw: (angle: number) => void, o: { echoes?: number; swept?: () => void } = {}) => {+ const n = o.echoes ?? 4, blur = Math.min(1, Math.abs(sweep) / 1.2);+ if (blur > 0.02) { if (o.swept) faint(0.16 * blur, o.swept); for (let k = n; k >= 1; k--) faint(0.42 * blur * (1 - k / (n + 1)) ** 1.4, () => draw(angle - (sweep * k) / n)); }draw(angle);};export const hand = () => HAND;/** a toned region in the current hand, honouring the making order (inked, then toned left to right) */export const tone = (ctx: Ctx, pts: P2[], m: Material, q: number, alpha = 1) => {if (pts.length < 3) return; m = pal(m);- if (GHOST < 1) { ctx.save(); ctx.globalAlpha = alpha * GHOST; HAND.region(ctx, pts, q, m, alpha * GHOST); ctx.restore(); return; }+ if (FAINT < 1) { ctx.save(); ctx.globalAlpha = alpha * FAINT; HAND.region(ctx, pts, q, m, alpha * FAINT); ctx.restore(); return; }if (REVEAL.tone >= 1) { if (!(HAND.opaque && alpha >= 1)) HAND.knock(ctx, pts); HAND.region(ctx, pts, q, m, alpha); return; }if (REVEAL.ink < 1) return;HAND.knock(ctx, pts); if (REVEAL.tone <= 0) return;@@ -169,9 +171,9 @@ export const tone = (ctx: Ctx, pts: P2[], m: Material, q: number, alpha = 1) =>ctx.save(); ctx.beginPath(); ctx.rect(x0 - 1, -1e5, (x1 - x0 + 2) * REVEAL.tone, 2e5); ctx.clip(); HAND.region(ctx, pts, q, m, alpha); ctx.restore();};/** paint the ground back over a shape without toning it (the paper inside a hull) */-export const knock = (ctx: Ctx, pts: P2[]) => { if (GHOST >= 1 && pts.length >= 3 && (REVEAL.tone >= 1 || REVEAL.ink >= 1)) HAND.knock(ctx, pts); };-export const ink = (ctx: Ctx, pts: P2[], role: Role, m: Material, close = false, alpha = 1) => { if (pts.length >= 2 && REVEAL.ink > 0) HAND.line(ctx, pts, role, pal(m), close, alpha * GHOST, REVEAL.ink); };-export const inkDot = (ctx: Ctx, at: P2, r: number, m: Material, alpha = 1) => { if (REVEAL.ink >= 1) HAND.dot(ctx, at, r, pal(m), alpha * GHOST); };+export const knock = (ctx: Ctx, pts: P2[]) => { if (FAINT >= 1 && pts.length >= 3 && (REVEAL.tone >= 1 || REVEAL.ink >= 1)) HAND.knock(ctx, pts); };+export const ink = (ctx: Ctx, pts: P2[], role: Role, m: Material, close = false, alpha = 1) => { if (pts.length >= 2 && REVEAL.ink > 0) HAND.line(ctx, pts, role, pal(m), close, alpha * FAINT, REVEAL.ink); };+export const inkDot = (ctx: Ctx, at: P2, r: number, m: Material, alpha = 1) => { if (REVEAL.ink >= 1) HAND.dot(ctx, at, r, pal(m), alpha * FAINT); };const ruleFrame = (ctx: Ctx, W: number, H: number, colour: string, p: number, pad = 34) => {if (p <= 0) return; ctx.strokeStyle = colour; ctx.lineWidth = 1.2; ctx.globalAlpha = 1; ctx.lineCap = "butt"; ctx.setLineDash([]);const L = 2 * (W + H - 4 * pad) * clamp01(p), segs: [P2, P2][] = [[[pad, pad], [W - pad, pad]], [[W - pad, pad], [W - pad, H - pad]], [[W - pad, H - pad], [pad, H - pad]], [[pad, H - pad], [pad, pad]]];diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/delivery.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/delivery.tsindex 5692f01..c6e9f99 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/delivery.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/delivery.ts@@ -1,9 +1,7 @@-// THE DELIVERY MASTER. The last thing a film's whole mix passes through, score and effects together.-// Before this, an effects-only film shipped at -27 LUFS and a scored one landed wherever the sum of its-// parts fell, 4 to 13 LU under its web peers. A film that plays quiet reads unfinished, whatever its timbre.-// One static gain to the target, then the smooth true-peak limiter, whose work is capped: when getting-// to the target would need more than `maxLimitDb` of limiting (a mix of sharp hits on near silence), the-// gain gives way instead of the hits being squashed, and the shortfall is reported, never hidden.+// THE DELIVERY MASTER. The last thing a film's whole mix passes through, score and effects together:+// one static gain to the web loudness target, then the smooth true-peak limiter, whose work is capped.+// When reaching the target would need more than `maxLimitDb` of limiting (sharp hits over near+// silence), the gain gives way instead of the hits being squashed, and the shortfall is reported.import { loudness, truePeak } from "./meter";import { smoothLimiter } from "./mixDsp";import { db } from "./dsp";diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/sampler.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/sampler.tsindex 36a0207..93148ce 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/sampler.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/sampler.ts@@ -8,12 +8,11 @@ import { rng } from "../core";import { pianoVelocity } from "./keysPiano";import { bandWidth } from "./mixDsp";-// Recordings made with spaced microphones can be out of phase between the sides in the body of the-// sound (150 Hz to 2 kHz: some marimba zones measure -0.72 file after file, which is one side's polarity-// flipped; tubular bells sit near 0, a grand piano about 0.3). On a phone or any mono fold the sides-// cancel and the music goes hollow. Each stereo recording is fixed once, when its bank is registered:-// a side whose body is clearly inverted is flipped back, then the body is narrowed (mono under 150 Hz,-// the side at half up to 2 kHz) while the air above 2 kHz keeps its full width.+// Recordings made with spaced microphones can disagree between the sides in the body of the sound+// (150 Hz to 2 kHz), and a phone or any mono fold then cancels part of it. Each stereo recording is+// fixed once, when its bank is registered: a side whose body is clearly inverted is flipped back,+// then the body is narrowed (mono under 150 Hz, the side at half up to 2 kHz) while the air above+// 2 kHz keeps its full width. Pack banks are always 48 kHz (tools/sounds.mjs refuses anything else).export const RECORDING_WIDTH = Object.freeze({ monoHz: 150, splitHz: 2000, mid: 0.5, high: 1, flipBelow: -0.3 });const narrowed = new WeakSet<Float32Array>();const bodyCorr = (L: Float32Array, R: Float32Array) => {diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/soundcheck.tsindex 5744f32..74a100c 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts@@ -1,15 +1,18 @@-// SOUNDCHECK. The film-sound scorecard as pure functions over a decoded stereo mix, so the tool-// (tools/soundcheck.mjs) and the tests read the same numbers. Nothing here needs a model or ears:+// SOUNDCHECK. Pure functions that score a film's decoded stereo mix, shared by tools/soundcheck.mjs and+// the tests so both always see the same numbers. Everything is measured from the samples; no model and+// no listening is involved. What gets measured:// level BS.1770 integrated / LRA / true peak from meter.ts; 10 ms K-weighted powers for the rest-// shape first sound, holes, dead tail, fade, final moment, an 11-point arc, hits, stop-downs-// spectrum six band shares of the mid, centroid, the loudest third-octave in a band (to name a fix)+// shape first sound, holes, dead tail, fade, final moment, an 11-point arc, accents, held breaths+// spectrum five band shares of the mid, centroid, the loudest third-octave in a band (to name a fix)// stereo side vs mid, L/R correlation overall and per band, mono-fold loss beyond the expected 3 dB// picture frame-difference events against onsets, with a chance baseline from shifted events-// Then evaluate() holds every number to a profile and writes the fix a mixer would make.+// evaluate() then checks each number against a profile's range and, where one is out, writes the+// concrete change to the mix that would bring it back.import { loudness, truePeak, onsetsDetail, centroid, fft } from "./meter";import { kWeight } from "./sfxCore";-export const BANDS: Record<string, [number, number]> = { sub: [20, 60], low: [60, 250], lowmid: [250, 1000], mid: [1000, 4000], presence: [4000, 8000], air: [8000, 16000] };+// five listening regions: what you feel, what warms, where notes live, what cuts through, what shines+export const BANDS: Record<string, [number, number]> = { rumble: [20, 80], warmth: [80, 300], body: [300, 1200], bite: [1200, 5000], sparkle: [5000, 16000] };/** Where a stereo mix's body sits: decorrelation here is what a phone's one speaker combs away. */export const BODY: [number, number] = [150, 2000];const HOP = 0.01, BLK = 0.05;@@ -52,14 +55,14 @@ export type Measures = {introLu: number; endLu: number; arc: (number | null)[]; arcDip: number; arcDipAt: number;firstSound: number | null; insideGap: number; insideGapAt: number | null; gaps: Gap[]; endSilence: number; endSilenceFrom: number;fade: number; finalLu: number; tailLu: number; quietAt: number | null; loudAt: number;- onsetRate: number; hitRate: number; stopDowns: { at: number; len: number }[];+ onsetRate: number; accentRate: number; heldBreaths: { at: number; len: number }[];bands: Record<string, number>; centroid: number; peakHz: Record<string, number>;sideMid: number; corr: number; bandCorr: Record<string, number>; bodyCorr: number; monoDrop: number; monoLoss: number;silent: boolean;};-export type Curves = { momentary: number[]; shortTerm: number[]; hopS: number; levels50: number[]; onsets: number[]; hits: number[] };+export type Curves = { momentary: number[]; shortTerm: number[]; hopS: number; levels50: number[]; onsets: number[]; accents: number[] };-/** Every model-free number for one decoded stereo mix. `allow` lists [from, to] seconds where a hole is meant (a declared stop-down). */+/** Every model-free number for one decoded stereo mix. `allow` lists [from, to] seconds where a hole is meant (a declared held breath). */export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow = [] as [number, number][] } = {}): { measures: Measures; curves: Curves } => {const dur = L.length / sr, chans = [L, R];const lo = loudness(chans, sr), tp = truePeak(chans), I = lo.integrated, silent = !(I > -70);@@ -94,16 +97,16 @@ export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow =const fin = lo.momentary.filter((_, i) => i * lo.hopS + 0.2 >= dur - 3);const st = lo.shortTerm; let si = 0; st.forEach((v, i) => { if (v > st[si]) si = i; });let qi = -1; st.forEach((v, i) => { if (v > I - 40 && (qi < 0 || v < st[qi])) qi = i; });- // hits and stop-downs on a 100 ms level every 10 ms+ // accents (sudden jumps) and held breaths (short dips that come back) on a 100 ms level every 10 msconst S = Array.from({ length: nh }, (_, i) => lufsOf(meanOf(p10, i - 5, i + 5)));- const hits: number[] = [];- for (let i = 8; i < nh; i++) if (S[i] - S[i - 8] >= 6 && S[i] >= I - 8 && (!hits.length || i * HOP - hits[hits.length - 1] > 0.3)) hits.push(i * HOP);- const stopDowns: { at: number; len: number }[] = [];+ const accents: number[] = [];+ for (let i = 8; i < nh; i++) if (S[i] - S[i - 8] >= 6 && S[i] >= I - 8 && (!accents.length || i * HOP - accents[accents.length - 1] > 0.3)) accents.push(i * HOP);+ const heldBreaths: { at: number; len: number }[] = [];for (let i = 50; i < nh; i++) {const ref = lufsOf(meanOf(p10, i - 50, i)); if (ref < I - 10 || S[i] >= ref - 10 || S[i - 1] < ref - 10) continue;let j = i; while (j < nh && S[j] < ref - 10) j++;const len = (j - i) * HOP; let back = false; for (let k = j; k < Math.min(nh, j + 30); k++) if (S[k] >= ref - 6) { back = true; break; }- if (len >= 0.15 && len <= 1.5 && back) stopDowns.push({ at: i * HOP, len: +len.toFixed(2) });+ if (len >= 0.15 && len <= 1.5 && back) heldBreaths.push({ at: i * HOP, len: +len.toFixed(2) });i = j;}const on = silent ? [] : onsetsDetail(chans, sr).times;@@ -128,12 +131,12 @@ export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow =firstSound: first >= 0 ? first * BLK : null, insideGap: open[0]?.len ?? 0, insideGapAt: open[0]?.at ?? null, gaps, endSilence: Math.max(0, dur - endFrom), endSilenceFrom: endFrom,fade: lastBody >= 0 && last >= lastBody ? (last - lastBody) * BLK : 0, finalLu: fin.length ? Math.max(...fin) - I : NaN, tailLu: lv.length ? Math.max(lv[lv.length - 1] - Iraw, -70 - I) : NaN,quietAt: qi >= 0 ? qi * lo.hopS + 1.5 : null, loudAt: si * lo.hopS + 1.5,- onsetRate: on.length / dur, hitRate: hits.length / dur, stopDowns,+ onsetRate: on.length / dur, accentRate: accents.length / dur, heldBreaths,bands, centroid: silent ? 0 : centroid(chans, sr).energyWeighted, peakHz,sideMid: 10 * Math.log10(Math.max(sm, 1e-30) / Math.max(mm, 1e-30)), corr: sl > 0 && sr_ > 0 ? slr / Math.sqrt(sl * sr_) : NaN,bandCorr, bodyCorr: corrIn(BODY[0], BODY[1]), monoDrop, monoLoss: monoDrop - 10 * Math.log10(2), silent,};- return { measures, curves: { momentary: lo.momentary, shortTerm: lo.shortTerm, hopS: lo.hopS, levels50: lv, onsets: on, hits } };+ return { measures, curves: { momentary: lo.momentary, shortTerm: lo.shortTerm, hopS: lo.hopS, levels50: lv, onsets: on, accents } };};// ---------------------------------------------------------------- picture against sound@@ -161,19 +164,19 @@ export const visualSync = (events: number[], onsets: number[], dur: number, tolexport type Range = { min?: number; max?: number; tol?: number };export type Status = "PASS" | "WARN" | "FAIL" | "INFO";export type Profile = { name: string; ranges: Record<string, Range>; allow?: [number, number][] };-/** Drawing films, from the study's pro-reference column, tightened where a drawing film should be (no dead tail, no hole, sound from frame 0). */+/** Built-in ranges for drawing films: web loudness, sound from frame 0, no hole, no dead tail, phone-safe mids. */export const DEFAULT_PROFILE: Profile = {name: "built-in: drawing film",ranges: {lufs: { min: -16, max: -13, tol: 1 }, truePeak: { max: -1, tol: 0 }, lra: { max: 9, tol: 3 },firstSound: { max: 0.5, tol: 0.5 }, insideGap: { max: 0.25, tol: 0.25 }, endSilence: { max: 0.5, tol: 0.5 }, arcDip: { min: -10, tol: 6 }, tailLu: { max: -20, tol: 10 },bodyCorr: { min: 0.3, tol: 0.15 }, monoLoss: { max: 1.5, tol: 0.5 }, corr: { min: 0.3, tol: 0.3 }, sideMid: { min: -15, max: -4, tol: 3 },- sub: { max: -6, tol: 2 }, lowmid: { max: -3, tol: 1.5 },+ rumble: { max: -5, tol: 2 }, body: { max: -3, tol: 1.5 },},};/** Delivery limits a reference set never loosens: a profile built from films can only move the taste ranges. */export const HARD = ["truePeak", "firstSound", "insideGap", "endSilence", "monoLoss"];-const TOL: Record<string, number> = { lufs: 1, lra: 3, crest: 2, introLu: 3, endLu: 3, arcDip: 4, tailLu: 6, fade: 0.5, finalLu: 4, onsetRate: 1, hitRate: 0.3, corr: 0.2, bodyCorr: 0.15, sideMid: 3, centroid: 400, sub: 2, low: 2, lowmid: 2, mid: 2, presence: 2, air: 2 };+const TOL: Record<string, number> = { lufs: 1, lra: 3, crest: 2, introLu: 3, endLu: 3, arcDip: 4, tailLu: 6, fade: 0.5, finalLu: 4, onsetRate: 1, accentRate: 0.3, corr: 0.2, bodyCorr: 0.15, sideMid: 3, centroid: 400, rumble: 2, warmth: 2, body: 2, bite: 2, sparkle: 2 };export type Row = { key: string; label: string; value: number | null; text: string; status: Status; range?: Range; fix?: string; at?: number; covered?: boolean };const fmtT = (s: number) => `${Math.floor(s / 60)}:${(s % 60).toFixed(1).padStart(4, "0")}`;@@ -188,26 +191,25 @@ export const grade = (v: number | null, r?: Range): Status => {const rangeText = (r?: Range) => (!r ? "" : r.min !== undefined && r.max !== undefined ? `${r.min}..${r.max}` : r.min !== undefined ? `>= ${r.min}` : r.max !== undefined ? `<= ${r.max}` : "");type Def = { key: string; label: string; get: (m: Measures) => number | null; show: (v: number, m: Measures) => string; fix?: (v: number, m: Measures, r: Range) => string; at?: (m: Measures) => number | undefined };-const BAND_LABEL: Record<string, string> = { sub: "sub 20-60 Hz", low: "low 60-250 Hz", lowmid: "low-mid 250-1k", mid: "mid 1-4k", presence: "presence 4-8k", air: "air 8-16k" };+const BAND_LABEL: Record<string, string> = { rumble: "rumble 20-80 Hz", warmth: "warmth 80-300 Hz", body: "body 300-1200 Hz", bite: "bite 1.2-5 kHz", sparkle: "sparkle 5-16 kHz" };const bandFix = (b: string, v: number, m: Measures, r: Range) => {- const hot = r.max !== undefined && v > r.max, pk = m.peakHz[b];- if (b === "sub") return hot ? `too much 20-60 Hz (${f1(v)} dB of the energy, it eats the headroom): high-pass the effects at 30-40 Hz and pull the sub voice down` : `no weight under 60 Hz (${f1(v)} dB): let a low voice or the impact reach 40-60 Hz`;- if (b === "lowmid") return hot ? `boxy (${f1(v)} dB in 250-1k, loudest around ${pk} Hz): cut ${pk >= 250 && pk <= 800 ? `${Math.round(pk * 0.08) * 10}-${Math.round(pk * 0.125) * 10}` : "300-500"} Hz by 2-3 dB` : `thin (${f1(v)} dB in 250-1k): the body is missing, lift 250-500 Hz 1-2 dB`;- if (b === "low") return hot ? `boomy (${f1(v)} dB in 60-250, around ${pk} Hz): cut ${pk} Hz 2-3 dB or high-pass the pads at 80-100 Hz` : `no low end (${f1(v)} dB in 60-250): bring the bass or the low pad up`;- if (b === "mid") return hot ? `honky (${f1(v)} dB in 1-4k, around ${pk} Hz): cut ${pk} Hz 2 dB` : `recessed mids (${f1(v)} dB in 1-4k): the melody needs 1-3 kHz, lift the lead`;- if (b === "presence") return hot ? `harsh (${f1(v)} dB in 4-8k): cut 4-6 kHz 2 dB or soften the transients` : `dull (${f1(v)} dB in 4-8k): lift 5 kHz 1-2 dB on the lead or the effects' transients`;- return hot ? `fizzy (${f1(v)} dB in 8-16k): a shelf down 2 dB above 10 kHz` : `no air (${f1(v)} dB in 8-16k): a gentle shelf up above 10 kHz`;+ const hot = r.max !== undefined && v > r.max, pk = m.peakHz[b], at = pk ? ` (strongest near ${pk} Hz)` : "";+ if (b === "rumble") return hot ? `the rumble takes ${f1(v)} dB of the energy: little speakers cannot play it and it uses up the loudness; roll off under 40 Hz on the effects and shorten the low tails` : `nothing under 80 Hz (${f1(v)} dB): one low voice or the big hit can carry some weight`;+ if (b === "warmth") return hot ? `woolly, ${f1(v)} dB in the warmth${at}: dip that spot a few dB or clear the pads out from under 100 Hz` : `cold (${f1(v)} dB of warmth): the bass or a low pad can come up`;+ if (b === "body") return hot ? `crowded body, ${f1(v)} dB${at}: notch the strongest spot a couple of dB, or move a part up or down an octave` : `hollow body (${f1(v)} dB): the chords or the melody's lower notes can come forward`;+ if (b === "bite") return hot ? `pushy, ${f1(v)} dB of bite${at}: a small dip there, or a softer attack on the loudest part` : `muffled (${f1(v)} dB of bite): the melody wants to sit in 1.5-3 kHz; bring the lead forward`;+ return hot ? `glassy, ${f1(v)} dB of sparkle: tame the very top with a gentle shelf, or round off the sharpest transients` : `no shine (${f1(v)} dB of sparkle): a touch of top on the effects or the room`;};const DEFS: Def[] = [{ key: "lufs", label: "integrated loudness", get: (m) => m.lufs, show: (v) => `${f1(v)} LUFS`, fix: (v, m, r) => v < (r.min ?? -99) ? `plays at ${f1(v)} LUFS, ${f1(-14 - v)} LU under the web target: master the mix to -14 LUFS (or -16 for a gentle film), a static gain then the limiter` : `too loud at ${f1(v)} LUFS: turn the master down to -14 LUFS` },{ key: "truePeak", label: "true peak", get: (m) => m.truePeak, show: (v) => `${f1(v)} dBTP`, fix: (v) => `true peak ${f1(v)} dBTP: set the limiter ceiling to -1.5 dBTP before the encode, so the AAC overshoot stays under -1` },{ key: "lra", label: "loudness range", get: (m) => m.lra, show: (v) => `${f1(v)} LU`, fix: (v, m) => `level swings ${f1(v)} LU (loudest at ${fmtT(m.loudAt)}${m.quietAt !== null ? `, quietest at ${fmtT(m.quietAt)}` : ""}): lift the quiet passages or keep a bed under them`, at: (m) => m.quietAt ?? undefined },{ key: "firstSound", label: "first sound", get: (m) => m.firstSound, show: (v) => `${f1(v, 2)} s`, fix: (v) => `nothing reaches body level until ${fmtT(v)}: start the bed or a sound on frame 0`, at: (m) => m.firstSound ?? 0 },- { key: "insideGap", label: "longest hole inside", get: (m) => m.insideGap, show: (v, m) => `${f1(v, 2)} s${m.insideGapAt !== null ? ` at ${fmtT(m.insideGapAt)}` : ""}`, fix: (v, m) => `${f1(v)} s hole at ${fmtT(m.insideGapAt ?? 0)}: keep the bed under it, or if it is a deliberate stop-down pass --allow ${f1(m.insideGapAt ?? 0, 2)}:${f1((m.insideGapAt ?? 0) + v, 2)}`, at: (m) => m.insideGapAt ?? undefined },+ { key: "insideGap", label: "longest hole inside", get: (m) => m.insideGap, show: (v, m) => `${f1(v, 2)} s${m.insideGapAt !== null ? ` at ${fmtT(m.insideGapAt)}` : ""}`, fix: (v, m) => `${f1(v)} s hole at ${fmtT(m.insideGapAt ?? 0)}: keep the bed under it, or if the silence is meant as a held breath pass --allow ${f1(m.insideGapAt ?? 0, 2)}:${f1((m.insideGapAt ?? 0) + v, 2)}`, at: (m) => m.insideGapAt ?? undefined },{ key: "endSilence", label: "dead air at the end", get: (m) => m.endSilence, show: (v) => `${f1(v, 2)} s`, fix: (v, m) => `${f1(v)} s of dead air at the end (from ${fmtT(m.endSilenceFrom)}): carry the bed or a tail to the last frame, or end the film sooner`, at: (m) => m.endSilenceFrom },{ key: "arcDip", label: "deepest dip in the arc", get: (m) => (m.silent ? null : m.arcDip), show: (v, m) => `${sign(v)} LU at ${fmtT(m.arcDipAt)}`, fix: (v, m) => `the sound drops ${f1(-v)} LU under the film at ${fmtT(m.arcDipAt)} (${Math.round((100 * m.arcDipAt) / m.durationS)} %): keep the bed or room tone under it`, at: (m) => m.arcDipAt },{ key: "tailLu", label: "level of the last 50 ms", get: (m) => (m.silent ? null : m.tailLu), show: (v, m) => (v + m.lufs <= -70 + 1e-6 ? "silent" : `${sign(v)} LU`), fix: (v) => `ends on a cut (the last 50 ms still at ${sign(v)} LU): end on a tail or fade the last 0.3 s`, at: (m) => m.durationS - 0.05 },- { key: "bodyCorr", label: "L/R correlation 150-2k", get: (m) => m.bodyCorr, show: (v) => f1(v, 2), fix: (v) => `mids decorrelated (150-2k correlation ${f1(v, 2)}): narrow the stereo width below 2 kHz (mixDsp.bandWidth mid at 1.0, or a mono room send)` },+ { key: "bodyCorr", label: "L/R correlation 150-2k", get: (m) => m.bodyCorr, show: (v) => f1(v, 2), fix: (v) => `mids decorrelated (150-2k correlation ${f1(v, 2)}): narrow the stereo width below 2 kHz (mixDsp.bandWidth with mid around 0.5, or a mono room send)` },{ key: "monoLoss", label: "mono fold, extra loss", get: (m) => m.monoLoss, show: (v) => `${f1(v)} dB`, fix: (v) => `folded to mono it loses ${f1(v)} dB more than a centred mix: phones will comb it; narrow the width or check the stereo pair's phase` },{ key: "corr", label: "L/R correlation", get: (m) => m.corr, show: (v) => f1(v, 2), fix: (v) => `L and R barely agree (correlation ${f1(v, 2)}): pan the lead and bass to the centre, keep width for pads and room` },{ key: "sideMid", label: "side vs mid", get: (m) => m.sideMid, show: (v) => `${f1(v)} dB`, fix: (v, m, r) => v > (r.max ?? 99) ? `too wide (side ${f1(v)} dB against the mid): narrow the overall width` : `very narrow (side ${f1(v)} dB): widen the pads or the room a little` },@@ -220,11 +222,11 @@ const DEFS: Def[] = [{ key: "fade", label: "fade / ring-out", get: (m) => m.fade, show: (v) => `${f1(v, 2)} s` },{ key: "finalLu", label: "final moment (last 3 s)", get: (m) => m.finalLu, show: (v) => `${sign(v)} LU` },{ key: "onsetRate", label: "onsets per second", get: (m) => m.onsetRate, show: (v) => f1(v, 2) },- { key: "hitRate", label: "salient hits per second", get: (m) => m.hitRate, show: (v) => f1(v, 2) },- { key: "stopDowns", label: "stop-downs", get: (m) => m.stopDowns.length, show: (v, m) => `${v}${m.stopDowns.length ? ` (${m.stopDowns.slice(0, 4).map((s) => fmtT(s.at)).join(", ")})` : ""}` },+ { key: "accentRate", label: "accents per second", get: (m) => m.accentRate, show: (v) => f1(v, 2) },+ { key: "heldBreaths", label: "held breaths", get: (m) => m.heldBreaths.length, show: (v, m) => `${v}${m.heldBreaths.length ? ` (${m.heldBreaths.slice(0, 4).map((s) => fmtT(s.at)).join(", ")})` : ""}` },];/** Fix order: what most makes a film read unfinished goes first. */-const ORDER = ["lufs", "endSilence", "insideGap", "firstSound", "arcDip", "truePeak", "lra", "bodyCorr", "monoLoss", "sub", "lowmid", "sideMid", "corr", "tailLu"];+const ORDER = ["lufs", "endSilence", "insideGap", "firstSound", "arcDip", "truePeak", "lra", "bodyCorr", "monoLoss", "rumble", "body", "sideMid", "corr", "tailLu"];export const evaluate = (m: Measures, profile: Profile = DEFAULT_PROFILE): Row[] =>DEFS.map((d) => {@@ -237,7 +239,7 @@ export const evaluate = (m: Measures, profile: Profile = DEFAULT_PROFILE): Row[]});/** One fix per cause: the stereo numbers all point at the width, so they fold into the first of them that is out. */const GROUP: Record<string, string> = { bodyCorr: "stereo", monoLoss: "stereo", corr: "stereo", sideMid: "stereo" };-export const fixFirst = (rows: Row[]) => {+export const startHere = (rows: Row[]) => {const out: Row[] = [], seen = new Map<string, Row>();for (const r of rows.filter((x) => x.fix && !x.covered).sort((a, b) => (a.status === b.status ? 0 : a.status === "FAIL" ? -1 : 1) || rank(a.key) - rank(b.key))) {const g = GROUP[r.key], lead = g && seen.get(g);@@ -250,7 +252,7 @@ export const fixFirst = (rows: Row[]) => {const rank = (k: string) => { const i = ORDER.indexOf(k); return i < 0 ? 99 : i; };export { rangeText };-/** Ranges from films Alex picked: min, max and median of every number, per metric. */+/** Ranges from films the user picked: min, max and median of every number, per metric. */export const buildProfile = (name: string, sets: { file: string; measures: Measures }[]) => {const metrics: Record<string, { min: number; max: number; median: number }> = {};for (const d of DEFS) {@@ -263,7 +265,7 @@ export const buildProfile = (name: string, sets: { file: string; measures: Measuexport const profileFrom = (built: { name: string; metrics: Record<string, { min: number; max: number }>; allow?: [number, number][] }): Profile => {const ranges: Record<string, Range> = { ...DEFAULT_PROFILE.ranges };for (const [k, v] of Object.entries(built.metrics ?? {})) {- if (HARD.includes(k) || k === "stopDowns" || k === "peakPos") continue;+ if (HARD.includes(k) || k === "heldBreaths" || k === "peakPos") continue;const tol = TOL[k] ?? DEFAULT_PROFILE.ranges[k]?.tol ?? 1, pad = tol / 2;ranges[k] = { min: +(v.min - pad).toFixed(2), max: +(v.max + pad).toFixed(2), tol };}diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/siteHero.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/siteHero.tsindex 5b3363b..4c2d55c 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/siteHero.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/siteHero.ts@@ -1,8 +1,8 @@-// SITE HERO. The music box as art for a landing page: placed right of a headline (assetKit PLACEMENTS.heroRight),-// on the page's own colour, the part to watch in the brand colour, light and dark from one source. Its motion-// is the object working: the drum plays one full turn, the teeth lift and drop, the air brake spins to a blur.-// One drum turn is the whole loop, so it repeats without a seam; frame 0 is the rest pose a reduced-motion-// visitor sees, so it is composed as the hero frame.+// SITE HERO. The music box as art for a landing page: placed right of a headline (assetKit PLACEMENTS.heroSide),+// on the page's own colour, the part to watch in the brand colour, light and dark from one source. It moves only+// as the real box would: the drum plays one full turn, the teeth lift and drop, the air brake spins to a blur.+// One drum turn is the whole loop, so it repeats without a seam. Frame 0, the resting pose, is all a+// reduced-motion visitor gets, so it is laid out to stand on its own as the finished picture.import type { Ctx, Env } from "./core";import type { Film } from "./film";import { Cam, paintAll, setHand, setPalette, flatHand, hand, freshPen, rrect } from "./mechanismKit";@@ -10,7 +10,7 @@ import { isometricHand } from "./mechanismHands";import { parts, playing, homePoints, MOVE, REV } from "./mechanism";import { PLACEMENTS, fitBox, pagePalette, type Colour } from "./assetKit";-const FPS = 30, N = Math.round(REV * FPS), P = PLACEMENTS.heroRight;+const FPS = 30, N = Math.round(REV * FPS), P = PLACEMENTS.heroSide;// the fan turns nine times a drum turn; a trail of about a fifth of a second of its travel reads as speedconst BLUR = ((2 * Math.PI * 9) / REV) * 0.2;diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/assetKit.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/assetKit.test.tsindex a371bef..0741e77 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/assetKit.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/assetKit.test.ts@@ -2,7 +2,7 @@// its own hue, a page palette keeps every material's light order on a light page and on a dark one, the// brand lands only on the part to watch, and a placement's art region never overlaps its headline zone.// node tools/test.mjs assetKit-import { toLab, fromLab, rampFrom, pagePalette, isDark, PLACEMENTS, fitBox } from "../src/canvas-core/assetKit";+import { toLab, fromLab, rampFrom, pagePalette, isDark, PLACEMENTS, fitBox, strongPoint } from "../src/canvas-core/assetKit";import type { Material } from "../src/canvas-core/mechanismKit";export const name = "assetKit";@@ -34,8 +34,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(!near(p(watch).pigment!, z.pigment!) && Math.abs(hue(p(watch).pigment!) - hue("#3d7bff")) < 0.12, `on ${paper}: the part to watch takes the brand`);ok(near(p({ ...zinc }).ramp[2], z.ramp[2]), `on ${paper}: a plain part does not`);}- const ink = pagePalette({ paper: "#faf7f2", colours: { zinc: { hex: "#e4572e", mode: "ink" } } })(zinc);- ok(Math.abs(hue(ink.ink) - hue("#e4572e")) < 0.12 && near(ink.ramp[2], pagePalette({ paper: "#faf7f2" })(zinc).ramp[2]), "ink mode colours the lines and leaves the body neutral");+ const ink = pagePalette({ paper: "#faf7f2", colours: { zinc: { hex: "#e4572e", mode: "lines" } } })(zinc);+ ok(Math.abs(hue(ink.ink) - hue("#e4572e")) < 0.12 && near(ink.ramp[2], pagePalette({ paper: "#faf7f2" })(zinc).ramp[2]), "lines mode colours the lines and leaves the part neutral");ok(near(pagePalette({ paper: "#f3f0e8" })(zinc).ramp[2], zinc.ramp[2]), "on the kit's own paper nothing moves");// 4. placements@@ -44,4 +44,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(x0 >= 0 && y0 >= 0 && x1 <= p.W && y1 <= p.H && x1 > x0 && y1 > y0, `${id}: the fit box lies inside the canvas`);if (s) ok(x1 <= s.x || x0 >= s.x + s.w || y1 <= s.y || y0 >= s.y + s.h, `${id}: the art never overlaps the headline zone`);}+ const st = PLACEMENTS.heroStack, [sx] = strongPoint(st), side = PLACEMENTS.heroSide, [hx] = strongPoint(side);+ ok(Math.abs(sx - (st.art.x + st.art.w / 2)) < 1e-9, "words above: the moment sits on the centre line");+ ok(Math.abs(hx - (side.art.x + side.art.w / 3)) < 1e-9, "words on the left: the moment leans a third toward them");};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/delivery.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/delivery.test.tsindex 849f9f0..655753a 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/delivery.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/delivery.test.ts@@ -1,6 +1,6 @@// DELIVERY TESTS. The whole film mix lands on its loudness target under the -1 dBTP ceiling, a quiet-// effects-only film is brought up instead of shipping at -27 LUFS, the limiter's work is capped (the gain-// gives way and says so), and "none" leaves the mix alone.+// effects-only film is brought to the target, the limiter's work is capped (the gain gives way and says+// so), and "none" leaves the mix alone.// node tools/test.mjs deliveryimport { deliver, targetOf } from "../src/canvas-core/music/delivery";import { loudness, truePeak } from "../src/canvas-core/music/meter";@@ -25,11 +25,11 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(d3.gainDb === 0 && L3.every((v, i) => v === before[i]), "none leaves the mix untouched");ok(Math.abs(loudness(tone(0.01), sr).integrated - loudness(tone(0.01), sr).integrated) < 1e-12, "the master is deterministic in, deterministic out");- // an effects-only film used to ship wherever its cues fell; now it is delivered at the gentle target+ // an effects-only film is delivered at the gentle targetconst fx = mixSfx(null, { fps: 30, frames: 120, cues: [{ frame: 10, kind: "tick" }, { frame: 40, kind: "pop" }, { frame: 80, kind: "impact" }] } as never, sr);ok(fx.delivered !== undefined && fx.dbtp <= -1 + 1e-6, `effects-only mix: delivered (${fx.lufs.toFixed(1)} LUFS, ${fx.dbtp.toFixed(2)} dBTP, limiter ${fx.limiterDb.toFixed(1)} dB)`);const old = mixSfx(null, { fps: 30, frames: 120, master: "none", cues: [{ frame: 10, kind: "tick" }, { frame: 40, kind: "pop" }, { frame: 80, kind: "impact" }] } as never, sr);- ok(Math.abs(fx.lufs + 16) <= 0.5, `on target, where the old peak-only master left it wherever its cues fell (${old.lufs.toFixed(1)} LUFS)`);+ ok(Math.abs(fx.lufs + 16) <= 0.5, `on target (the peak-only master gives ${old.lufs.toFixed(1)} LUFS)`);void truePeak;// between its cues an effects-only film sits on room tone, never on digital silencediff --git a/plugins/anidoodle/skills/anidoodle/engine/test/filmshape.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/filmshape.test.tsindex dca4263..0a3c069 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/filmshape.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/filmshape.test.ts@@ -15,6 +15,6 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const hole = filmShape(...film(8, (t) => t < 3.1 || t > 6.4), sr);ok(kinds(hole) === "hole" && Math.abs(hole.holeS - 3.3) < 0.15, `a 3.3 s hole in the middle is caught (${hole.holeS.toFixed(1)} s)`);ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 3.3), sr)) === "", "a 0.2 s breath is not a hole");- ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 4.0), sr, { fps: 30, quiet: [[90, 123, "stop-down before the reveal"]] })) === "", "a declared stop-down is not a fault");+ ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 4.0), sr, { fps: 30, quiet: [[90, 123, "a held breath before the reveal"]] })) === "", "a declared held breath is not a fault");ok(kinds(filmShape(...film(4, () => false), sr)) === "silent", "a silent film is caught");};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/mechanism.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/mechanism.test.tsindex 7fccd5c..47f7cdc 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/mechanism.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/mechanism.test.ts@@ -65,8 +65,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(REV > 0 && hand().id === "flat", "the kit's default hand is the plain reference hand");void flatHand;- // 7. spin: a slow turn draws the blades once; a fast one trails fainter copies behind, against the travel+ // 7. spin: a slow turn draws the blades once; a fast one first paints fainter echoes, each further back along the turnconst calls = (sweep: number) => { const a: number[] = []; spin(1, sweep, (ang) => a.push(ang)); return a; };ok(calls(0).length === 1 && calls(0)[0] === 1, "a slow turn draws only the blades");- const fast = calls(1.2); ok(fast.length === 5 && fast[fast.length - 1] === 1 && fast.slice(0, -1).every((v) => v < 1), `a fast turn trails ${fast.length - 1} copies behind the blades, drawn first`);+ const fast = calls(1.2); ok(fast.length === 5 && fast[fast.length - 1] === 1 && fast.slice(0, -1).every((v) => v < 1), `a fast turn paints ${fast.length - 1} fainter echoes before the blades`);};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/sfxHarsh.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/sfxHarsh.test.tsindex c9bfd8e..d8e50d4 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/sfxHarsh.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/sfxHarsh.test.ts@@ -57,8 +57,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {message = ""; try { mixSfx(null, { ...plan, harsh: harsh as SfxHarshOptions }, sr); } catch (e) { message = (e as Error).message; }ok(/harsh\./.test(message), `invalid harsh option rejected: ${JSON.stringify(harsh)}`);}- // Plan 2 re-captured in 0.9.0, when the impact boom's sub tail was shortened (0.6 to 0.38 s decay):- // it rang at 44 Hz for nearly 5 s and ate the headroom. Plans 0 and 1 are untouched.+ // Plan 2's hash covers the impact boom's shorter low tail (0.38 s decay).// Captured from production sources at c1beddfe4264a34d12531dbe931acef611fb0a02,// loaded by git show and bundled with these fixtures before the mixer was edited.const hashes = ["5db7c646b1e61b0016c5dd8a114e875f6cedbaed17f6b702a225ba2dcc187a85", "3064c924f76acb857c509a5c294cf043380451d544fda0b5372ce06d33ef133a", "f2fb798441ecf453b18de3ee2c849810e6fd56f4eaa14fd2002600985fb189f6"];diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/soundcheck.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/soundcheck.test.tsindex 47dd464..51627b8 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/soundcheck.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/soundcheck.test.ts@@ -1,13 +1,13 @@// SOUNDCHECK TESTS. Each fault the scorecard exists to catch, built on purpose in code (a hole, a-// dead tail, a late start, a decorrelated pair, a sub-heavy mix, a boxy mix, a quiet master, a cut+// dead tail, a late start, a decorrelated pair, a rumble-heavy mix, a crowded body, a quiet master, a cut// ending), and each must show up in its own metric, with a fix that names the time or the band.-import { analyze, evaluate, fixFirst, visualEvents, visualSync, buildProfile, profileFrom, grade, DEFAULT_PROFILE } from "../src/canvas-core/music/soundcheck";+import { analyze, evaluate, startHere, visualEvents, visualSync, buildProfile, profileFrom, grade, DEFAULT_PROFILE } from "../src/canvas-core/music/soundcheck";import { loudness } from "../src/canvas-core/music/meter";export const name = "soundcheck";export const run = (ok: (cond: boolean, label: string) => void) => {const sr = 48000;- // mulberry32: a plain LCG's interleaved outputs are correlated per band (it read as a -0.99 low-band correlation)+ // mulberry32, never a plain LCG: an LCG's interleaved left/right outputs are correlated per band and fake a near -1 low-band correlationlet seed = 9; const rnd = () => { seed = (seed + 0x6d2b79f5) | 0; let t = Math.imul(seed ^ (seed >>> 15), 1 | seed); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return (((t ^ (t >>> 14)) >>> 0) / 4294967296) * 2 - 1; };/** A plucked chord every 0.25 s over a soft pad: music-like, steady, correlated (the same in both ears). */const music = (secs: number, { from = 0, to = secs, amp = 0.2 } = {}) => {@@ -26,7 +26,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const clean = at(...music(6));ok(clean.firstSound === 0 && clean.insideGap === 0 && clean.endSilence < 0.06, `clean mix: first sound ${clean.firstSound} s, longest hole ${clean.insideGap} s, end silence ${clean.endSilence.toFixed(2)} s`);ok(Math.abs(clean.monoLoss) < 0.1 && clean.bodyCorr > 0.99 && clean.corr > 0.99, `identical channels fold to mono with ${clean.monoLoss.toFixed(2)} dB extra loss, 150-2k correlation ${clean.bodyCorr.toFixed(2)}`);- ok(["insideGap", "endSilence", "firstSound", "bodyCorr", "monoLoss", "sub"].every((k) => row(clean, k).status === "PASS"), "clean mix passes the shape, stereo and sub checks");+ ok(["insideGap", "endSilence", "firstSound", "bodyCorr", "monoLoss", "rumble"].every((k) => row(clean, k).status === "PASS"), "clean mix passes the shape, stereo and rumble checks");// the loudness number agrees with the meter, and a -27 LUFS master fails with the gain it needsconst [qL, qR] = music(6, { amp: 0.02 }), q = at(qL, qR), ref = loudness([qL, qR], sr).integrated;@@ -39,10 +39,10 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const [hL, hR] = music(6); for (let i = 2 * sr; i < 3 * sr; i++) { hL[i] = 0; hR[i] = 0; }const hole = at(hL, hR);ok(Math.abs(hole.insideGap - 1) <= 0.06 && Math.abs((hole.insideGapAt ?? 0) - 2) <= 0.06, `a 1 s hole at 2.0 s reads ${hole.insideGap.toFixed(2)} s at ${hole.insideGapAt?.toFixed(2)} s`);- const hf = fixFirst(evaluate(hole)).find((r) => r.key === "insideGap");+ const hf = startHere(evaluate(hole)).find((r) => r.key === "insideGap");ok(row(hole, "insideGap").status === "FAIL" && /1\.0 s hole at 0:02\.0/.test(hf?.fix ?? ""), `the fix says where: "${hf?.fix?.slice(0, 40)}..."`);- ok(!fixFirst(evaluate(hole)).some((r) => r.key === "arcDip"), "the arc dip inside that hole is the same fault: one fix, not two");- ok(at(hL, hR, { allow: [[1.9, 3.1]] }).insideGap === 0, "a declared stop-down (--allow 1.9:3.1) is not a hole");+ ok(!startHere(evaluate(hole)).some((r) => r.key === "arcDip"), "the arc dip inside that hole is the same fault: one fix, not two");+ ok(at(hL, hR, { allow: [[1.9, 3.1]] }).insideGap === 0, "a declared held breath (--allow 1.9:3.1) is not a hole");const [sL, sR] = music(6); for (let i = 2 * sr; i < 2.15 * sr; i++) { sL[i] = 0; sR[i] = 0; }ok(row(at(sL, sR), "insideGap").status === "PASS", `a 0.15 s breath is not a hole (${at(sL, sR).insideGap.toFixed(2)} s)`);@@ -59,33 +59,33 @@ export const run = (ok: (cond: boolean, label: string) => void) => {// a decorrelated pair: independent noise in each earconst n = 4 * sr, dL = new Float32Array(n), dR = new Float32Array(n); for (let i = 0; i < n; i++) { dL[i] = 0.1 * rnd(); dR[i] = 0.1 * rnd(); }- const dec = at(dL, dR), df = fixFirst(evaluate(dec));+ const dec = at(dL, dR), df = startHere(evaluate(dec));ok(Math.abs(dec.bodyCorr) < 0.1 && Math.abs(dec.monoLoss - 3) < 0.3, `decorrelated pair: 150-2k correlation ${dec.bodyCorr.toFixed(2)}, mono loses ${dec.monoLoss.toFixed(2)} dB past the expected 3`);ok(row(dec, "bodyCorr").status === "FAIL" && row(dec, "monoLoss").status === "FAIL" && df.filter((r) => ["bodyCorr", "monoLoss", "corr", "sideMid"].includes(r.key)).length === 1 && /below 2 kHz/.test(df.find((r) => r.key === "bodyCorr")?.fix ?? ""), "it fails, and the four stereo numbers make one fix: narrow the width below 2 kHz");// decorrelated only in the body: a 600 Hz tone a quarter-turn apart, a centred 5 kHz toneconst bL = new Float32Array(n), bR = new Float32Array(n); for (let i = 0; i < n; i++) { const t = i / sr, c = 0.1 * Math.sin(2 * Math.PI * 5000 * t); bL[i] = 0.2 * Math.sin(2 * Math.PI * 600 * t) + c; bR[i] = 0.2 * Math.cos(2 * Math.PI * 600 * t) + c; }const body = at(bL, bR);- ok(Math.abs(body.bodyCorr) < 0.1 && body.bandCorr.presence > 0.95, `body-only decorrelation is seen per band (150-2k ${body.bodyCorr.toFixed(2)}, presence ${body.bandCorr.presence.toFixed(2)})`);+ ok(Math.abs(body.bodyCorr) < 0.1 && body.bandCorr.sparkle > 0.95, `body-only decorrelation is seen per band (150-2k ${body.bodyCorr.toFixed(2)}, sparkle ${body.bandCorr.sparkle.toFixed(2)})`);- // a sub-heavy mix and a boxy one, each with a band-specific fix+ // a rumble-heavy mix and a crowded body, each with a band-specific fixconst [uL, uR] = music(4, { amp: 0.05 }); for (let i = 0; i < uL.length; i++) { const v = 0.4 * Math.sin(2 * Math.PI * 40 * (i / sr)); uL[i] += v; uR[i] += v; }const sub = at(uL, uR);- ok(sub.bands.sub > -3 && row(sub, "sub").status === "FAIL" && /30-40 Hz/.test(row(sub, "sub").fix ?? ""), `sub-heavy: ${sub.bands.sub.toFixed(1)} dB of the energy under 60 Hz, FAIL, "high-pass ... 30-40 Hz"`);- ok(clean.bands.sub < -20, `the clean mix keeps ${clean.bands.sub.toFixed(1)} dB under 60 Hz`);+ ok(sub.bands.rumble > -3 && row(sub, "rumble").status === "FAIL" && /under 40 Hz/.test(row(sub, "rumble").fix ?? ""), `rumble-heavy: ${sub.bands.rumble.toFixed(1)} dB of the energy under 80 Hz, FAIL, "roll off under 40 Hz"`);+ ok(clean.bands.rumble < -20, `the clean mix keeps ${clean.bands.rumble.toFixed(1)} dB under 80 Hz`);const [xL, xR] = music(4, { amp: 0.03 }); for (let i = 0; i < xL.length; i++) { const v = 0.3 * Math.sin(2 * Math.PI * 630 * (i / sr)); xL[i] += v; xR[i] += v; }const box = at(xL, xR);- ok(row(box, "lowmid").status === "FAIL" && box.peakHz.lowmid === 630 && /630 Hz/.test(row(box, "lowmid").fix ?? ""), `boxy: low-mid ${box.bands.lowmid.toFixed(1)} dB, loudest third-octave ${box.peakHz.lowmid} Hz named in the fix`);+ ok(row(box, "body").status === "FAIL" && box.peakHz.body === 630 && /630 Hz/.test(row(box, "body").fix ?? ""), `crowded body: ${box.bands.body.toFixed(1)} dB, strongest third-octave ${box.peakHz.body} Hz named in the fix`);- // a stop-down: a steady bed that dips 15 dB for 0.4 s and snaps back+ // a held breath: a steady bed that dips 15 dB for 0.4 s and snaps backconst [pL, pR] = music(6); for (let i = 3 * sr; i < 3.4 * sr; i++) { pL[i] *= 0.18; pR[i] *= 0.18; }const sd = at(pL, pR);- ok(sd.stopDowns.length === 1 && Math.abs(sd.stopDowns[0].at - 3) < 0.1, `a 0.4 s, 15 dB dip reads as one stop-down at ${sd.stopDowns[0]?.at.toFixed(2)} s`);+ ok(sd.heldBreaths.length === 1 && Math.abs(sd.heldBreaths[0].at - 3) < 0.1, `a 0.4 s, 15 dB dip reads as one held breath at ${sd.heldBreaths[0]?.at.toFixed(2)} s`);// the profile: ranges grade PASS / WARN / FAIL, and a built profile moves taste ranges but never the delivery limitsok(grade(-14, { min: -16, max: -13, tol: 1 }) === "PASS" && grade(-16.5, { min: -16, max: -13, tol: 1 }) === "WARN" && grade(-18, { min: -16, max: -13, tol: 1 }) === "FAIL" && grade(5, undefined) === "INFO", "grade: inside PASS, within tolerance WARN, beyond FAIL, no range INFO");const built = buildProfile("test", [{ file: "a", measures: clean }, { file: "b", measures: tgt }]), prof = profileFrom(built);ok(built.metrics.lufs.min <= built.metrics.lufs.median && built.metrics.lufs.median <= built.metrics.lufs.max && built.from.length === 2, `built profile: lufs ${built.metrics.lufs.min}..${built.metrics.lufs.max}, median ${built.metrics.lufs.median}`);- ok(JSON.stringify(prof.ranges.endSilence) === JSON.stringify(DEFAULT_PROFILE.ranges.endSilence) && prof.ranges.lufs.min !== DEFAULT_PROFILE.ranges.lufs.min && prof.ranges.presence !== undefined, "a built profile sets the taste ranges (loudness, bands) and keeps the hard ones (end silence)");+ ok(JSON.stringify(prof.ranges.endSilence) === JSON.stringify(DEFAULT_PROFILE.ranges.endSilence) && prof.ranges.lufs.min !== DEFAULT_PROFILE.ranges.lufs.min && prof.ranges.sparkle !== undefined, "a built profile sets the taste ranges (loudness, bands) and keeps the hard ones (end silence)");// picture against soundconst changed = Array.from({ length: 300 }, (_, i) => (i === 30 || i === 120 || i === 210 ? 0.5 : 0.01));diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/filmshape.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/filmshape.mjsindex 60032e0..65e70f6 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/filmshape.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/filmshape.mjs@@ -1,8 +1,8 @@// FILM SHAPE. Whether a film's sound has the shape of a finished piece: it starts with the picture, it// never drops out mid-film, and it ends with the film instead of stopping early and leaving dead air.// Measured in 100 ms blocks against the mix's own body level (the median of its active blocks), so a-// quiet film and a loud one are judged alike. A silence the film means (a stop-down before a reveal, a-// held breath) is declared in meta.quiet as [fromFrame, toFrame, reason] and is not a fault.+// quiet film and a loud one are judged alike. A silence the film means (a held breath before a reveal, a+// pause on a beat) is declared in meta.quiet as [fromFrame, toFrame, reason] and is not a fault.// import { filmShape } from "./filmshape.mjs"; filmShape(L, R, sr, { fps, quiet })export const SHAPE = Object.freeze({ firstS: 0.5, holeS: 0.25, endS: 0.5, quietDb: 30, bodyDb: 20 });diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/placement.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/placement.mjsindex 8db5d57..83e207d 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/placement.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/placement.mjs@@ -1,5 +1,5 @@// PLACEMENT. Site art has a zone the art must never enter: the headline's. This reads a rendered still-// and fails if anything (a part, a shadow, a sheen) is drawn there, then writes the picture at phone+// and fails if anything (a part, a cast shadow, a highlight) is drawn there, then writes the picture at phone// width so you look at it the size most visitors will.// node tools/placement.mjs out/hero.png --W 1200 --safe 0,0,480,640 [--paper #faf7f2] [--tol 6] [--phone out/hero-390.png]// --W is the film's logical width (meta.W); --safe is in the same units (assetKit PLACEMENTS[...].safe).diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/soundcheck.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/soundcheck.mjsindex 48acb8c..dadf6b8 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/soundcheck.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/soundcheck.mjs@@ -1,7 +1,8 @@-// SOUNDCHECK. A film-sound scorecard for an agent that cannot hear: every model-free number on a-// film's decoded mix, each held to a range, then the fixes in the order that matters, with times.+// SOUNDCHECK. Scores a rendered film's soundtrack from the numbers alone: it decodes the mix, measures+// it without any model, checks each value against a range, and lists the changes to make, most+// important first, each tied to a moment in the film.// node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile references/music/sound-profile.json]-// [--allow 3.1:3.6,...] [--video | --no-video] [--json] [--out f.json]+// [--allow 3.1:3.6,...] [--no-video] [--json] [--out f.json]// node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name "drawing film"]// Decodes what a player would (ffmpeg, stereo float at 48 kHz). The metrics are pure functions in// src/canvas-core/music/soundcheck.ts (unit-tested on synthetic signals); visual sync reuses@@ -54,7 +55,7 @@ export const check = async (C, file, { profile, allow = [], video = "auto" } = {sync = { ...C.visualSync(events, curves.onsets, measures.durationS), times: events, fps: p.video.fps };}const rows = C.evaluate(measures, prof);- return { file, profile: prof.name, measures, curves, sync, rows, fixes: C.fixFirst(rows), video: p.video, L, R };+ return { file, profile: prof.name, measures, curves, sync, rows, fixes: C.startHere(rows), video: p.video, L, R };};const pad = (s, n) => String(s).padEnd(n);@@ -68,10 +69,10 @@ export const report = (C, r) => {if (r.sync) {const s = r.sync, pct = (v) => (Number.isFinite(v) ? `${Math.round(v * 100)} %` : "n/a");o.push(` ${pad("INFO", 7)}${pad("visual events with an onset", 31)}${pad(`${pct(s.share)} of ${s.events}`, 24)}chance ${pct(s.chance)}`);- o.push(` ${pad("INFO", 7)}${pad("median onset offset", 31)}${pad(Number.isFinite(s.medianOffsetMs) ? `${s.medianOffsetMs > 0 ? "+" : ""}${s.medianOffsetMs} ms` : "n/a", 24)}pros: -45..+75 ms`);+ o.push(` ${pad("INFO", 7)}${pad("median onset offset", 31)}${pad(Number.isFinite(s.medianOffsetMs) ? `${s.medianOffsetMs > 0 ? "+" : ""}${s.medianOffsetMs} ms` : "n/a", 24)}a sound may lead its frame a little; a lag reads as late`);if (s.unanswered.length) o.push(` ${pad("INFO", 7)}${pad("events with no sound", 31)}${s.unanswered.slice(0, 8).map(C.fmtT).join(", ")}${s.unanswered.length > 8 ? ` (+${s.unanswered.length - 8})` : ""}`);}- o.push("", r.fixes.length ? "FIX FIRST" : "FIX FIRST: nothing");+ o.push("", r.fixes.length ? "START HERE" : "START HERE: nothing to fix");r.fixes.forEach((x, i) => o.push(` ${i + 1}. [${x.status}] ${x.fix}`));o.push("", "DETAIL", ` arc (LU vs integrated, 0..100 %): ${m.arc.map((v) => (v === null ? "silent" : (v > 0 ? "+" : "") + v.toFixed(1))).join(" ")}`);o.push(` bands (dB share): ${Object.entries(m.bands).map(([k, v]) => `${k} ${v.toFixed(1)}`).join(" ")}`);@@ -82,13 +83,13 @@ export const report = (C, r) => {return o.join("\n");};/** The JSON form: no sample buffers, curves trimmed to what a reader can use. */-export const asJson = (r) => ({ file: r.file, profile: r.profile, verdict: r.rows.some((x) => x.status === "FAIL") ? "FAIL" : "PASS", measures: r.measures, sync: r.sync, rows: r.rows, fixes: r.fixes.map((x) => ({ key: x.key, status: x.status, fix: x.fix, at: x.at })), onsets: r.curves.onsets.map((t) => +t.toFixed(3)), hits: r.curves.hits });+export const asJson = (r) => ({ file: r.file, profile: r.profile, verdict: r.rows.some((x) => x.status === "FAIL") ? "FAIL" : "PASS", measures: r.measures, sync: r.sync, rows: r.rows, fixes: r.fixes.map((x) => ({ key: x.key, status: x.status, fix: x.fix, at: x.at })), onsets: r.curves.onsets.map((t) => +t.toFixed(3)), accents: r.curves.accents });if (isMain(import.meta.url)) {const argv = process.argv.slice(2), flag = (k) => argv.includes(`--${k}`), opt = (...ks) => { for (const k of ks) { const i = argv.indexOf(k); if (i >= 0) return argv[i + 1]; } return undefined; };const VAL = new Set(["--profile", "--out", "--allow", "-o", "--name"]), pos = argv.filter((a, i) => !a.startsWith("-") && !VAL.has(argv[i - 1]));const die = (msg, code = 2) => { console.error(msg); process.exit(code); };- if (!pos.length) die("usage: node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile p.json] [--allow a:b] [--video|--no-video] [--json] [--out f.json]\n node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name \"drawing film\"]");+ if (!pos.length) die("usage: node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile p.json] [--allow a:b] [--no-video] [--json] [--out f.json]\n node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name \"drawing film\"]");const C = await loadCheck();try {if (pos[0] === "profile") {diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/soundsheet.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/soundsheet.mjsindex 1cfed57..70fa46e 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/soundsheet.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/soundsheet.mjs@@ -1,8 +1,8 @@-// SOUNDSHEET. A listening sheet for an agent that cannot hear: one PNG on one time axis with the-// picture (a frame strip), the spectrogram, the waveform, momentary and short-term loudness against-// the integrated level and the -14 LUFS target, onset ticks, salient hits, visual events, and every-// hole and the dead tail shaded. The hole, the dead tail and a late hit are visible before anyone-// listens. Same analysis as soundcheck.mjs (its verdict and first fixes head the sheet).+// SOUNDSHEET. Draws a film's soundtrack as a single PNG, everything stacked on one shared timeline: a+// strip of frames, the spectrogram, the waveform, momentary and short-term loudness with lines for the+// integrated level and the -14 LUFS target, onset ticks, accents, picture events, and shading over+// every hole and over dead air at the end. A gap, a silent ending or a late accent jumps out at a+// glance. It runs the soundcheck.mjs analysis, and that verdict and its top fixes sit at the top.// node tools/soundsheet.mjs <film|file.mp4|file.wav> -o out/<name>-sound.png [--profile p.json] [--allow a:b] [--width 1600]import { execFileSync } from "node:child_process";import { mkdtempSync, readFileSync, rmSync, mkdirSync, existsSync } from "node:fs";@@ -40,11 +40,11 @@ try {const fails = r.rows.filter((x) => x.status === "FAIL").length, warns = r.rows.filter((x) => x.status === "WARN").length;const data = {title: basename(file), dur, I: m.lufs, verdict: fails ? `FAIL: ${fails} fail, ${warns} warn` : warns ? `PASS with ${warns} warning${warns > 1 ? "s" : ""}` : "PASS",- stats: `${m.lufs.toFixed(1)} LUFS · LRA ${m.lra.toFixed(1)} LU · ${m.truePeak.toFixed(1)} dBTP · 150-2k corr ${Number.isFinite(m.bodyCorr) ? m.bodyCorr.toFixed(2) : "n/a"} · sub ${m.bands.sub.toFixed(1)} dB`,+ stats: `${m.lufs.toFixed(1)} LUFS · LRA ${m.lra.toFixed(1)} LU · ${m.truePeak.toFixed(1)} dBTP · 150-2k corr ${Number.isFinite(m.bodyCorr) ? m.bodyCorr.toFixed(2) : "n/a"} · rumble ${m.bands.rumble.toFixed(1)} dB`,fixes: r.fixes.slice(0, 4).map((x) => `${x.status} ${x.fix}`),strip, spec: png64(join(tmp, "spec.png")), env: env_,momentary: r.curves.momentary.map((v, i) => [i * r.curves.hopS + 0.2, v]), shortTerm: r.curves.shortTerm.map((v, i) => [i * r.curves.hopS + 1.5, v]),- onsets: r.curves.onsets, hits: r.curves.hits, events: r.sync?.times ?? [], unanswered: r.sync?.unanswered ?? [],+ onsets: r.curves.onsets, accents: r.curves.accents, events: r.sync?.times ?? [], unanswered: r.sync?.unanswered ?? [],shade: [...m.gaps.filter((g) => g.len >= 0.1).map((g) => ({ a: g.at, b: g.at + g.len, label: g.allowed ? "allowed hole" : `hole ${g.len.toFixed(1)} s` })), ...(m.endSilence >= 0.1 ? [{ a: m.endSilenceFrom, b: dur, label: `dead tail ${m.endSilence.toFixed(1)} s` }] : []), ...(m.firstSound && m.firstSound >= 0.1 ? [{ a: 0, b: m.firstSound, label: "before body level" }] : [])],LEFT, PW, WIDTH,};@@ -61,11 +61,11 @@ try {const css = (k) => getComputedStyle(document.documentElement).getPropertyValue(k).trim();const load = (src) => new Promise((ok) => { if (!src) return ok(null); const i = new Image(); i.onload = () => ok(i); i.src = src; });Promise.all([load(D.strip && D.strip.src), load(D.spec), document.fonts.ready]).then(([strip, spec]) => {- const rows = [["picture", strip ? D.strip.h : 0], ["spectrogram", 240], ["waveform", 130], ["loudness", 210], ["onsets / hits / picture", 64]].filter((r) => r[1]);+ const rows = [["picture", strip ? D.strip.h : 0], ["spectrogram", 240], ["waveform", 130], ["loudness", 210], ["onsets / accents / picture", 64]].filter((r) => r[1]);const GAP = 14, H = rows.reduce((a, r) => a + r[1] + GAP, 0) + 40, cv = document.getElementById("c"); cv.width = D.WIDTH; cv.height = H;const g = cv.getContext("2d"), X = (t) => D.LEFT + (t / D.dur) * D.PW; let y = 4; const top = {};g.font = "500 12px Poppins, Arial, sans-serif"; g.textBaseline = "middle";- for (const [name, h] of rows) { top[name] = [y, h]; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText(name === "onsets / hits / picture" ? "onsets" : name, D.LEFT - 10, name === "onsets / hits / picture" ? y + h / 6 : y + h / 2); if (name === "spectrogram") { g.font = "10px Poppins, Arial, sans-serif"; g.fillText("log Hz", D.LEFT - 10, y + h / 2 + 16); g.font = "500 12px Poppins, Arial, sans-serif"; } g.strokeStyle = css("--line"); g.strokeRect(D.LEFT + 0.5, y + 0.5, D.PW - 1, h - 1); y += h + GAP; }+ for (const [name, h] of rows) { top[name] = [y, h]; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText(name === "onsets / accents / picture" ? "onsets" : name, D.LEFT - 10, name === "onsets / accents / picture" ? y + h / 6 : y + h / 2); if (name === "spectrogram") { g.font = "10px Poppins, Arial, sans-serif"; g.fillText("log Hz", D.LEFT - 10, y + h / 2 + 16); g.font = "500 12px Poppins, Arial, sans-serif"; } g.strokeStyle = css("--line"); g.strokeRect(D.LEFT + 0.5, y + 0.5, D.PW - 1, h - 1); y += h + GAP; }const bottom = y - GAP;// shading first, through every panel: holes, the dead tail, the silent startfor (const s of D.shade) { g.fillStyle = "rgba(192,57,43,0.13)"; g.fillRect(X(s.a), 4, Math.max(2, X(s.b) - X(s.a)), bottom - 4); g.fillStyle = css("--fail"); g.textAlign = "left"; g.fillText(s.label, Math.min(X(s.a) + 4, D.LEFT + D.PW - g.measureText(s.label).width), bottom + 12); }@@ -81,12 +81,12 @@ try {const curve = (pts, col, w) => { g.strokeStyle = col; g.lineWidth = w; g.beginPath(); let pen = false; for (const [tt, l] of pts) { if (!(l > -70)) { pen = false; continue; } pen ? g.lineTo(X(tt), Y(l)) : g.moveTo(X(tt), Y(l)); pen = true; } g.stroke(); g.lineWidth = 1; };curve(D.momentary, "rgba(44,110,155,0.55)", 1); curve(D.shortTerm, css("--ink"), 2);g.fillStyle = css("--ink"); g.textAlign = "left"; g.fillText("momentary (thin), short-term (thick), LUFS", D.LEFT + 6, t + 12); }- { const [t, h] = top["onsets / hits / picture"], third = h / 3;+ { const [t, h] = top["onsets / accents / picture"], third = h / 3;g.strokeStyle = css("--ink"); for (const o of D.onsets) { g.beginPath(); g.moveTo(X(o) + 0.5, t + 2); g.lineTo(X(o) + 0.5, t + third); g.stroke(); }- g.fillStyle = css("--accent"); for (const o of D.hits) { g.beginPath(); g.arc(X(o), t + third * 1.5, 4, 0, 7); g.fill(); }+ g.fillStyle = css("--accent"); for (const o of D.accents) { g.beginPath(); g.arc(X(o), t + third * 1.5, 4, 0, 7); g.fill(); }for (const e of D.events) { const miss = D.unanswered.includes(e); g.strokeStyle = miss ? css("--fail") : "#1e7d4f"; g.lineWidth = 2; g.beginPath(); g.moveTo(X(e), t + third * 2 + 2); g.lineTo(X(e), t + h - 2); g.stroke(); g.lineWidth = 1;g.strokeStyle = miss ? "rgba(192,57,43,0.35)" : "rgba(30,125,79,0.3)"; g.setLineDash([2, 3]); g.beginPath(); g.moveTo(X(e), 4); g.lineTo(X(e), t); g.stroke(); g.setLineDash([]); }- g.font = "10px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText("hits", D.LEFT - 10, t + third * 1.5); g.fillText("picture events", D.LEFT - 10, t + third * 2.5); }+ g.font = "10px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText("accents", D.LEFT - 10, t + third * 1.5); g.fillText("picture events", D.LEFT - 10, t + third * 2.5); }// the time axisg.font = "11px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "center"; const step = D.dur > 40 ? 5 : D.dur > 12 ? 2 : 1;for (let s = 0; s <= D.dur + 1e-6; s += step) g.fillText(Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"), X(s), bottom + 28);diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/verify-export.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/verify-export.mjsindex 8422f01..b7624df 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/verify-export.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/verify-export.mjs@@ -144,7 +144,7 @@ if (isMp4) {if (!Number.isFinite(tp)) note("true peak unreadable from ffmpeg's ebur128", txt.split("\n").slice(-4).join(" "));else if (opt.delivery) {say(tp <= -1.0, `true peak after the encode ${tp.toFixed(2)} dBTP`, `ceiling -1 dBTP; integrated ${Number.isFinite(il) ? il.toFixed(1) : "?"} LUFS`);- // a film that plays quiet reads unfinished: -16 LUFS for gentle films, -14 for dense, a 1 LU window around each+ // a film that plays quiet reads unfinished: pass between -19 and -13 LUFS, warn from -17// -19 is the floor: a gentle score held under -16 by its own peaks (never compressed, by design) may sit near// -17.5; under -19 the film is simply quiet. Warn from -17 so the musical cure ("Peaks", music/README.md) is triedsay(Number.isFinite(il) && il >= -19 && il <= -13, `integrated loudness ${Number.isFinite(il) ? il.toFixed(1) : "?"} LUFS`, "-19..-13 (the delivery master puts gentle films at -16, dense at -14)");diff --git a/plugins/anidoodle/skills/anidoodle/references/craft-bar.md b/plugins/anidoodle/skills/anidoodle/references/craft-bar.mdindex b4021c5..d6f0ad9 100644--- a/plugins/anidoodle/skills/anidoodle/references/craft-bar.md+++ b/plugins/anidoodle/skills/anidoodle/references/craft-bar.md@@ -6,9 +6,9 @@ The test: would a proud human illustrator ship this, or is it mechanical shape-a|---|---|| A subject built from ellipses and capsules | Hand-placed control points over real anatomy || One style recoloured to look like another | The mark, the edge and the order of marks all change |-| Boxes and arrows standing for an idea | A real machine whose working IS the idea, many small parts, each with a job (`machines.md`) |-| A line that stops in the air; a texture cut dead mid-surface | Every line ends on something; a row of ribs or pins fades as the surface turns away |-| Parts floating off or sunk into each other | Every joint flush, tangent or seated, every part held; check the joints at 3x |+| Boxes and arrows standing for an idea | A real machine that does what the idea describes while you watch, built from many small parts that each have a job (`machines.md`) |+| A line that stops in the air; a texture cut dead mid-surface | Lines meet another line or an edge; a row of ribs or pins thins out where the surface turns away |+| Parts floating off or sunk into each other | Parts touch the way real ones do (bolted, resting, butted against), each held by something; zoom to 3x on the joints || Flat colour fields | Wash, then pattern wet-on-damp, then line; one named light; cast shadows || Every stroke the same weight and speed | Long strokes fast, fiddly ones slow, thick-thin, tapered || Even scatter, one flower stamped 200 times | Hand-placed drifts with bare rests; 4-5 authored views per species |@@ -25,9 +25,9 @@ The test: would a proud human illustrator ship this, or is it mechanical shape-a| Words laid over busy art, a face or the UI | Type gets its own frame by default; over the picture only as a composed label or kinetic line on a calm area (`workflows/launch-video.md`, Type) || A loop playing in place and called "alive" | Real travel through a world that changes as the subject moves || An unmatched hard cut or a sharp swoosh between scenes | A gentle move (a bloom, a flip, a push, the card grows into the frame), or a cut matched on shape, position or beat |-| Site art on its own white or cream while the page is another colour | `paper` is the page's exact colour; neutrals moved onto it, light and dark from one source (`workflows/site-art.md`) |-| A part, shadow or sheen creeping under the headline | The headline zone is empty, proved by `tools/placement.mjs` |-| A spinner drawn as still blades turning slowly | A sheen disc and fading trails (`spin`), so it reads as speed |+| Site art that brings its own background, so a pale box shows on a page of a different colour | `paper` is set to the page's exact colour and every neutral shifts to suit it; a light and a dark theme come out of the same code (`workflows/site-art.md`) |+| A part, a cast shadow or a highlight straying into the headline's space | Nothing is drawn in the headline zone, and `tools/placement.mjs` proves it |+| A spinner drawn as still blades turning slowly | Fainter copies of the blades, each a little further back, over a faint swept shape (`spin`), so it reads as speed |**No dead air** in anything that moves: something visibly changes in every second, from frame 0.Check it with the tool AND by eye: a creeping camera changes every pixel and satisfies the tooldiff --git a/plugins/anidoodle/skills/anidoodle/references/music/README.md b/plugins/anidoodle/skills/anidoodle/references/music/README.mdindex f0935ac..2276cae 100644--- a/plugins/anidoodle/skills/anidoodle/references/music/README.md+++ b/plugins/anidoodle/skills/anidoodle/references/music/README.md@@ -113,7 +113,7 @@ MusicPlan + notes (you write) -> perform -> instruments (one stem per part)Struck stems (plucks, plucked basses, piano, mallets and bells, timpani) first go through a transient-awaregain in the mix (only the pick or hammer spike above the note's own body comes down, up to 6 dB, the stem'slevel unchanged), so their attacks don't hold the master under the ceiling. `RenderOpts.gentleGlue` (a <= 1 dB- 2:1 bus glue) exists but is off by default: Alex's call. If the peak still blocks the gain, the loudness goes+ 2:1 bus glue) exists but is off by default. If the peak still blocks the gain, the loudness goesdown. The cure is musical (see "Peaks" below): a solo piano with a 10 LU range (the nocturne demo) masters at -17.5.- **Dense styles** (lofiElectronic, lofi, drive, house, synthwave, hipHop, rock, chiptune): **-14 LUFS** through a look-ahead true-peak limiter, then a static trim if an inter-sample peak still passes -1 dBTP.- **A film's whole mix** (score plus effects, or effects alone) goes through the delivery master last:@@ -131,11 +131,10 @@ The pack is a separate download (about 390 MB), not part of the skill. Once it iacoustic parts play recordings of real instruments and three rooms are recorded impulse responses.Without it every score still plays, on the modelled voices, unchanged.-Every stereo recording is made phone-safe when its bank loads (`RECORDING_WIDTH` in `sampler.ts`):-some were captured with spaced microphones whose sides cancel in the body of the sound (a marimba at--0.72 between 150 Hz and 2 kHz, one side's polarity flipped), so a side clearly inverted there is-flipped back and the body narrowed, while the air above 2 kHz keeps its width. On the cheetah score-this took the mids from -0.15 to 0.85 correlation and the mono-fold loss from 3.5 to 0.6 dB.+Every stereo recording is made phone-safe when its bank loads (`RECORDING_WIDTH` in `sampler.ts`): a+side whose body (150 Hz to 2 kHz) is clearly inverted is flipped back and the body is narrowed, while+the air above 2 kHz keeps its width, so a mono fold keeps the whole instrument.+```bashnode tools/soundfetch.mjs list # the install directory and what is installed; no networkdiff --git a/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md b/plugins/anidoodle/skills/anidoodle/references/music/sound-design.mdindex 04df611..b3cafc4 100644--- a/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md+++ b/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md@@ -89,8 +89,8 @@ export const audio = filmSfx(filmAudio(score, 15), plan); // Film.audio: score## Levels and the audibility rule-A cue nobody hears is a bug, not a subtle choice. (The first effects PR sat 13-19 dB under its-music, and its test only checked that they existed.)+A cue nobody hears is a bug, not a subtle choice. A test that only checks a cue exists proves+nothing: test that it is heard over the music at its own moment.- Every cue is measured against the ducked score **at its own moment**. The yardstick isK-weighted (BS.1770) loudness over the cue's *speaking window*: the 10 ms frames within 10 dB of@@ -120,17 +120,17 @@ music, and its test only checked that they existed.)when it starts the groove and mud anywhere else.- Hear it in context before it ships. Render the kit page (`node tools/sfx.mjs kit <dir>`) and ademo over the real score, and check the audibility table.-- **The numbers that keep it designed.** About five effects per ten seconds. Hard cuts and cursor- drifts get nothing. About two whooshes a film, each starting 100-450 ms before the move and peaking- on its fastest frame. One riser, then 0.1-0.5 s of near silence, then the impact on the reveal frame,- the loudest moment of the film, 30-60% of the way in. One click voice for the whole UI: press, then- release 60-110 ms later, the same level every time. Typing at most about twelve keys a second.-- **Where a cue may land.** A hit's attack no earlier than 45 ms before its frame and its peak no- later than 75 ms after. A whoosh's loudest point within 45 ms of the move's fastest frame. A riser- ends between 250 ms before the hit and 30 ms after it. Later than these reads as lag; earlier reads- as a mistake.-- **The ending.** The music stops on a bar or filters down, 0.2-0.7 s of near silence, one soft note- in key, and its tail rings out to the last frame, 8-20 dB under the film's peak. Never a cut-off.+- **Restraint is the design.** A cue earns its place by marking something the viewer should feel: a+ press, an arrival, a landing, the reveal. Picture changes that are only edits stay silent. Count+ your cues against the film's length; if you cannot say what each one marks, cut it.+- **Land on the frame.** A hit belongs on the frame where the thing happens; within a frame either+ side reads as one event. A soft lead into the hit reads as anticipation. A sound after its picture+ reads as lag, which is the one error a viewer always notices.+- **One voice per job.** Every press of every button is the same click, at the same level, so the UI+ feels like one object. Variety goes to the story moments, not to repeats of the same action.+- **The ending breathes.** The music settles on the tonic or lets its last chord ring, a beat of+ near silence before the final mark if the film has one, and the tail rings out to the last frame.+ Never a cut-off, never dead air after it.## The finished mix@@ -144,36 +144,36 @@ What the whole film's sound must be before it ships, score and effects together:- **Never digital silence.** An effects-only film sits on room tone 22 dB under its cues (`bed`), nearlymono so a phone keeps it, from the first frame to the last.- **A finished shape.** Sound from the first frame (within 0.5 s), no hole over 0.25 s, the last sound- within 0.5 s of the last frame. A silence the film means (a stop-down, a held breath) is declared in+ within 0.5 s of the last frame. A silence the film means (a held breath, a pause on a beat) is declared in`meta.quiet` as `[fromFrame, toFrame, reason]`. `verify-export --delivery` fails the shape, a truepeak over -1 dBTP after the encode, and loudness under -19 LUFS; it warns from -17.-- **Fix one thing at a time, with one fixer.** Read the film through separate lenses (sync, edges and- clicks, masking, tone, the director's arc), each proposing its fix as a variant it has measured.- Then one fixer merges them and re-runs every check, and a fix that breaks another lens is dropped.- Lenses that each edit the mix fight: a tonal cut at 2-6 kHz undoes the masking lens's raised hit.+## Checking the finished film's sound-You cannot hear the film, so measure the delivered mix before anyone listens. Two tools read the-rendered file (a film name means `out/<name>.mp4`; a `.wav` or `.m4a` works too):+Before the film goes to anyone, put numbers on the mix that was actually delivered. Two tools take+the rendered file and do it (give a film name for `out/<name>.mp4`, or point at a `.wav` or `.m4a`):```node tools/soundcheck.mjs <film|file> # the scorecard; exit 1 on any FAILnode tools/soundcheck.mjs <film> --json --out x.json # the same, as data-node tools/soundcheck.mjs <film> --allow 3.1:3.6 # a hole there is a declared stop-down+node tools/soundcheck.mjs <film> --allow 3.1:3.6 # the silence there is a declared held breathnode tools/soundsheet.mjs <film> -o out/<film>-sound.png # one picture of it all```-`soundcheck` prints a status for every metric (PASS, WARN, FAIL against a range, or INFO), then a-**FIX FIRST** list in the order that matters, each with its time and the concrete fix: "3.4 s hole-at 0:03.4", "boxy: cut 500-790 Hz by 2-3 dB", "mids decorrelated: narrow the stereo width below-2 kHz". It measures:+Each metric in `soundcheck` gets a status line: PASS, WARN or FAIL when it has a range, INFO when+it is only reported. Under them comes **START HERE**, the changes to make ranked by importance, and+every one is specific about where and what: "3.4 s hole at 0:03.4", "crowded body, strongest near+630 Hz: notch it a couple of dB", "mids decorrelated: narrow the stereo width below 2 kHz". The+numbers fall into five groups:- level: integrated LUFS, true peak, loudness range, loudest 3 s, intro and end level, an11-point arc, the loudest moment;-- shape: first sound, holes inside the film, dead air at the end, fade, the final moment, a cut- ending, onsets, salient hits, stop-downs;-- spectrum: six band shares (sub 20-60 Hz up to air 8-16 kHz) and the centroid;+- shape: when the first sound arrives, any holes mid-film, dead air after the last sound, the fade,+ the closing moment, an ending that cuts off, how many onsets and accents (sudden jumps in level)+ there are per second, and held breaths (short dips that come straight back);+- spectrum: how the energy splits across five bands (rumble, warmth, body, bite and sparkle,+ 20 Hz to 16 kHz), plus the centroid;- stereo: side vs mid, L/R correlation overall and per band (150 Hz-2 kHz is where phones combthe body away), and how much more than the expected 3 dB the mix loses folded to mono;- picture (any file with video): frame-difference events, the share with an onset within 100 ms@@ -183,17 +183,19 @@ at 0:03.4", "boxy: cut 500-790 Hz by 2-3 dB", "mids decorrelated: narrow the steThe built-in ranges are for drawing films: -16 to -13 LUFS (web target -14, gentle films -16),true peak at or under -1 dBTP, LRA at most 9 LU, sound by 0.5 s, no hole over 0.25 s, at most0.5 s of silence at the end, 150 Hz-2 kHz correlation at least 0.3, at most 1.5 dB of extra mono-loss, and the sub at or under -6 dB of the energy.+loss, and the rumble (under 80 Hz) at or under -5 dB of the energy.-To grade against films the user loves, build a profile from them:+When the user has films whose sound they love, score against those instead:`node tools/soundcheck.mjs profile <films...> -o references/music/sound-profile.json`, then pass-`--profile references/music/sound-profile.json`. A profile moves the taste ranges (loudness,-bands, width); the delivery limits (true peak, first sound, holes, end silence, mono loss) stay.--`soundsheet` draws a frame strip, the spectrogram, the waveform, momentary and short-term-loudness against the integrated level and -14, onset ticks, hits and picture events (red when no-sound answers them), with every hole and the dead tail shaded. Read it before handing the film-over: the hole, the dead tail and a late hit are visible in it.+`--profile references/music/sound-profile.json`. The profile shifts the ranges that are a matter+of taste (loudness, bands, width). The ranges a delivery must meet (true peak, first sound, holes,+end silence, mono loss) do not move.++`soundsheet` lays the whole soundtrack out on one timeline, top to bottom: a strip of frames, the+spectrogram, the waveform, momentary and short-term loudness with the integrated level and -14+marked, then rows of onsets, accents and picture events (a picture event turns red when no sound+lands on it). Holes and dead air at the end are shaded. Look at it before handing the film over;+a gap, a silent ending or a late accent is obvious on the page.The metrics live in `engine/src/canvas-core/music/soundcheck.ts`, tested on synthetic faults in`engine/test/soundcheck.test.ts`.diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/interactive.md b/plugins/anidoodle/skills/anidoodle/references/workflows/interactive.mdindex f5a3041..10f74dd 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/interactive.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/interactive.md@@ -125,10 +125,11 @@ readback, so hashed pages run with `window.__ANI_RASTER__ = "cpu"` from the star| Form mascot | 22/22 | 3.5 ms / 0.3 ms (2.2 on an earlier run) | 2.0 s | 152, 31 MB at scale 1.25 | 51 KB (20 KB gzip) || Scroll hero | 22/22 | 1.8 ms / 0.4 ms | 2.0 s | 4 stages + one patch per stroke, 34 MB at 1.25, 58 MB at 2 | 48 KB (19 KB gzip) |-The budget was 6 ms p95 at DPR 2. The first build measured 7.8 ms, because the head rotated ten face-sprites a frame and the paper multiplied the full canvas every frame. Composing the head once and-baking the paper into the sprites brought it to 2-4 ms (it varies by run on a shared machine). Single frames reach 10-22 ms when a-reaction first needs a cel, or during a rescale swap.+The budget is 6 ms p95 at DPR 2. To stay inside it, compose a multi-part head into one sprite+instead of rotating each face sprite every frame, and bake the paper texture into the sprites rather+than multiplying it over the whole canvas each frame; the demos above run at 2-4 ms that way (it+varies by run on a shared machine). Single frames reach 10-22 ms when a reaction first needs a cel,+or during a rescale swap.## Limitsdiff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/machines.md b/plugins/anidoodle/skills/anidoodle/references/workflows/machines.mdindex 26db3d1..24c7947 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/machines.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/machines.md@@ -7,34 +7,42 @@ Worked example: `mechanism.ts` (the 18-note movement), `mechanismHands.ts`, `mec## 1. Turn the idea into a machine-1. **State the truth.** Ledger the concept's real quantities: counts, sizes, rates, limits (`explainer.md`).-2. **Find its verbs** (fills, waits, matches, rejects, decays) and **its nouns with quantities**.-3. **Find a physical mechanism that performs those verbs on those nouns**, one a general reader can- name: a lock for "every condition must match", drawers sized by bytes, a sluice for a queue.-4. **Say it in one sentence:** "X moves, and its motion means Y." If you cannot, the mapping is wrong.-5. **Give every part a meaning**, and mark where the metaphor stops being literal.-6. **Pick the one part to watch.** It alone gets the accent (`accent: true` on its material).-7. **Add an instrument that reads the quantity** (a dial, a ruler, a counter, a readout corner).-8. **Choose the view** so the mechanism faces the viewer: `Cam.fit(A, E, points, box)`, A 35 to 60.--Two failures, one fix: too abstract (floating slabs, labelled boxes) or too flat (one big plate-with a few lines). Fix both with a recognisable machine of many small, purposeful parts.+1. **Get the facts first.** The idea's real quantities: how many, how big, how fast, the limits (`explainer.md`).+2. **Name what happens** to what: the actions (fills, waits, matches, rejects, decays) and the things they act on.+3. **Find a made object that does those actions,** one a general reader recognises: a turnstile for+ "one at a time", a sieve for a filter, a ratchet for "only forward", a sluice for a queue.+4. **Test the match aloud:** describe the machine running, then the idea; if the two descriptions do+ not line up step for step, pick another object.+5. **Every part means something,** and say where the comparison stops being literal.+6. **One part carries the story.** It alone gets the accent (`accent: true` on its material).+7. **Show the number:** a dial, a ruler, a counter or the readout corner reads the quantity live.+8. **Turn it to face the viewer:** `Cam.fit(A, E, points, box)`. The music box sits at an azimuth of+ 36; most machines look right somewhere between a third and two thirds of a right angle.++The machine has to be something a person could name, with every part doing work. Labelled blocks+hanging in space give the viewer nothing to name, and a big bare panel with a scratch or two of+detail looks like a drawing someone stopped halfway through.## 2. Parts list before geometry-Write the parts by group: base (plate, feet, screws, label, ruler), structure (posts, bridges,-rails, stops), mechanism, controls (crank, knob), and the subject. Every part rests on another-and has a job. A figure is 40 to 80 parts; a hero 80 to 150; past that, propose a smaller version-that keeps the core. Detail comes from structure (a boss under a shaft, holes in a bedplate, a-stop lever), never from texture noise. A bare face or an empty corner is unfinished, not calm.+Write the inventory first, working from the ground up: the bench or feet it rests on, the frame+that carries the motion, the moving parts, the handles and knobs a person would reach for, and+finally the one part the story is about. Nothing floats and nothing is idle: each part rests on+something and earns its place. For scale, the music box runs to 68 parts and spans about 62 percent+of its card. If your machine wants far more than that, build a cut-down version that keeps the+heart of it. Richness should come from construction (a boss where a shaft meets a plate, a row of+drilled holes, a stop lever), not from a pattern painted over the surface. When a face looks empty,+ask what real part belongs there.## 3. One model drives everything-The film's moving parts, the readout and any caption all read one pure model of `(frame)` or of-the input state. In the music box, `play(rot)` places the pins, bends the teeth and names the pin,-the tooth and the pitch in the readout; nothing is typed twice. Read words from where parts ARE-(the readout says "TAKING APART" while any spring is moving), and build counts from the list that-draws them ("8 ASSEMBLIES APART" is `PLAN.order.length`).+Everything that moves, the readout and every caption are computed from a single function of+`(frame)`, or of the input state in an interactive piece, with no side effects. In the music box,+`play(rot)` places the pins and bends the teeth, and the same call names the pin, the tooth and the+pitch for the readout, so nothing is typed twice. Take words from the live state, never from a+script running beside it: the readout names the pin that just struck because it works that out from+the drum angle, not because a timed caption says so. Counts come from the list that draws the parts+("8 ASSEMBLIES OUT" is `PLAN.order.length`).## 4. Build with the kit@@ -48,11 +56,11 @@ draws them ("8 ASSEMBLIES APART" is `PLAN.order.length`).| Screws, pins, ticks, ribs that fade as they turn away | `screw`, `facingAt` + `smooth` for alpha || Many parts in the right order | `paintAll(items)`; each item has `at`, `bias`, `ride` (its assembly) || An exploded view | `ExplodePlan` + `sharesAt(plan, cues, t)`: staggered out, last-out first-home, reversals cancel pending moves |-| A frame in a card with four corners (figure, title, hint, live readout) | `card` |+| A card that frames the figure and gives each corner a job: the title, a hint, the live readout | `card` |Rules that keep it clean: split a part that wraps another (back half, inner, front half); everypart is held by something; explode real assemblies along their true direction, the outside ones-first; draw a chain line along each path of travel; fit the figure to 55 to 65 percent of the card.+first; draw a chain line along each path of travel; leave the card a generous margin round the figure.## 5. Draw it in a style: the hand@@ -78,15 +86,17 @@ Two films, not one: the making (`kind: "drawing"`, each part inked then toned inwith `setReveal(ink, tone, paper)`, then the words) and the run (`kind: "explainer"`: play close onthe part to watch, explode, tour, home). One film holding both fails the dead-air gate, because abuild's slow strokes are measured against an explainer's floor. While apart, let each assembly-breathe a little along its own path, out of step with the others, so the tour never freezes. An interactive piece (`interactive.md`): one-spring per assembly with `zeta` 0.8 to 0.9 so parts land with weight, outer ones faster; a fixed+breathe a little along its own path, out of step with the others, so the tour never freezes. An interactive piece (`interactive.md`): each+assembly rides its own spring, damped with `zeta` 0.8 to 0.9 so it settles with weight, and the+outer assemblies get the quicker springs; a fixedcamera so the card and the bench bake once; the part nearest the pointer lights and the readoutsays what it does; reduced motion holds the drum still.## 7. Check itRender at `--scale 2` or 3 and crop every joint (flange, bridge, crank, wire end, tooth tips); the-fault list, in order: a line that stops in the air, a part sunk into or floating off another, a-nearer part drawn behind, a texture cut at full strength mid-surface, a doubled edge. Then+things to hunt for: a part painted behind something it should sit in front of; two parts that+overlap or hang apart where they should touch; a stroke that ends on nothing; an edge drawn twice;+a pattern that stops abruptly in the middle of a face instead of fading. Then`node tools/test.mjs mechanism` and, for a page, `emit-interactive.mjs` and `replay.mjs` (22 checks,including 6 ms a frame at DPR 2). Measured, not assumed: say which of these you ran.diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/site-art.md b/plugins/anidoodle/skills/anidoodle/references/workflows/site-art.mdindex bf075dc..1391311 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/site-art.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/site-art.md@@ -1,96 +1,99 @@# Site art: a picture that works on someone's page-A hero beside a headline, a feature tile, a row of spots, a share card. The picture no longer owns its-canvas: a headline does, a page colour does, a brand does. Kit: `engine/src/canvas-core/assetKit.ts`.-Worked example: `siteHero.ts` (light page) and `siteHeroDark.ts` (dark page), one source.+A hero beside a headline, a feature card, a row of icons, a link preview. The picture no longer owns+its canvas: the page's words, colour and brand come first, and the art is drawn to live among them.+Kit: `engine/src/canvas-core/assetKit.ts`. Worked example: `siteHero.ts` (a light page) and+`siteHeroDark.ts` (a dark one), both drawn by the same code.-## 1. The brief, before any drawing+## 1. Start from the page, not the picture-Write five lines, from the request or as defaults you say out loud:+Before choosing a subject, write down what the page already decides:-1. **Where it goes:** product, page, section, shown size, what sits beside it.-2. **The one thing it says:** a promise ("ships in a minute"), a feeling ("unhurried"), or a fact ("works offline").-3. **Who looks:** engineers read instruments and machines; a family app wants warm, soft, homely things.-4. **The page:** its exact colour, light or dark or both, and the brand colours.-5. **The style:** any of the 32. Style is free; craft is not.+1. **The slot:** which section, what sits beside or above the art, the size it is shown at.+2. **The page colour,** exactly, and whether the site also has a dark theme.+3. **The brand colour,** as one hex, and any material the brand is known for (walnut, brass, matte black).+4. **The sentence the art must back up:** usually the headline next to it.+5. **The style:** any of the 32. The page constrains placement and colour, never the medium.-## 2. One real object that says it+## 2. Pick an object that does what the product does-Three kinds, and write one concept of each before choosing:+Read the sentence from step 1 and ask what the product *does*, as a verb: sorts, connects, protects,+repeats, measures. Then find a made object that performs that verb visibly, and build it as a machine+(`machines.md`), so its working carries the message without a caption. Put two or three candidates+to the user, a line each, name the one you favour and the reason, and go ahead with it unless they+pick another. When the user has already named the object, skip straight to building it.-- **Literal:** the product as a fine object (a camera for a photo app).-- **Metaphor:** a real thing whose working is the promise. Software has no body, so this is usually the strongest.-- **Scene:** a small world on a tray or a shelf, one hero object among a few supporting ones. Good for wide heroes and for sets.--Choose with five quick tests: **glance** (named in a second at its shown size), **promise** (its working says-it, no caption), **parts** (fifty real parts, not a smooth blob), **page** (its silhouette suits the slot:-wide and low beside a headline, tall in a column), **brand** (material and era match the mood). Say which-you pick and why in one line, then build it. If the user already named the object, skip the round.--| The promise | A thing that does it |+| What the page promises | A made thing that shows it ||---|---|-| Nothing gets lost | A post-office sorting frame, every letter in its slot, one being placed |-| Fast setup | A flat-pack chair half assembled, the last dowel going in |-| Team chat | A switchboard, one cable mid-plug, a lamp lit |-| Privacy | A letterbox with a combination dial, its flap shut |-| Automation | A marble run: one marble on the track, the next waiting at the gate |-| Insights | A weather station: anemometer turning, barometer needle, a logbook |-| Translation | A typewriter with two type baskets, one key mid-strike |-| Savings | A coin sorter with tubes by size, one coin rolling down the ramp |-| Learning | A desk globe on a brass meridian, a pin in one city |-| Music | A cylinder music box, the drum turning, the governor a blur |--## 3. The moment--A picture shown once gets one place for the eye: a drawer half out, a key mid-strike, a lamp lit, a-coin in the slot. Exactly one, carried by the accent, about a third of the way into the art region on-the side nearest the text (`strongPoint`). If the accent lands on structure, the eye lands on structure.+| keeps everything findable | A post-office sorting frame, every letter in its slot, one being placed |+| sets up in minutes | A flat-pack chair half assembled, the last dowel going in |+| connects a team | A switchboard, one cable mid-plug, a lamp lit |+| keeps things private | A letterbox with a combination dial, its flap shut |+| automates a chain of steps | A marble run: one marble on the track, the next waiting at the gate |+| turns data into insight | A weather station: anemometer turning, barometer needle, a logbook |+| translates | A typewriter with two type baskets, one key mid-strike |+| grows savings | A coin sorter with tubes by size, one coin rolling down the ramp |+| teaches | A desk globe on a brass meridian, a pin in one city |+| makes music | A cylinder music box, the drum turning, the governor a blur |++Hold the object's outline up to the space it will fill. Art beside the words suits a broad shape,+art under the words suits a low, stretched one, and an icon wants a single tight thing.++## 3. One place for the eye++Choose the single part that shows the verb happening (the letter going into its slot, the dowel+going in) and give it the accent material (`accent: true`). `strongPoint(p)` gives a good spot for+it: a third of the way in, leaning toward the words, or centred when the words sit above.## 4. Placement-`PLACEMENTS` holds the canvas, the art region and the headline zone for each slot (heroRight, heroLeft,-heroCentre, art, tile, spot, banner, social, slide). `Cam.fit(A, E, points, fitBox(p))` fits the object-into its region; pass every extreme point, lifted parts included. The object leads toward the text: pick-the azimuth that turns its long face and its moment that way. Nothing enters the headline zone, not a-shadow, not a sheen; prove it with `node tools/placement.mjs still.png --W <meta.W> --safe x,y,w,h`.-Keep a few units of air at every edge the object does not deliberately bleed off.--## 5. Page colour, light and dark--`setPalette(pagePalette({ paper, accent, colours, tint }))` moves every material onto the page: on a-light page the neutrals shift by the page's difference in lightness and, by `tint`, its colour cast; on-a dark page the parts sit just above the page, the lit top lightest, the lines lighter than the faces.-The fill colour of the page and of `paper` must be identical, or every part shows a pale halo. A site-with both themes gets both films from one source (`heroOn(title, paper, accent)`).--## 6. Brand colour--`accent: "#hex"` puts the brand on the part to watch (`accent: true`); `colours: { wood: "#7a5536" }`-recolours any material by name, which is also how brass, walnut or ebony are made. Mode **body** makes-the part of the colour (a five-step ramp in its own hue, lightness set so four tones read and nothing-glares on dark). Mode **ink** keeps the part neutral and colours only its lines and dots (an LED, a-pointer, an engraved mark). Default to one brand family: the subject in body, one or two small echoes.-Colour the moment, never the base or the biggest faces, unless the product is that colour.--## 7. Motion is the object working--Loop one full cycle of the machine so it repeats without a seam. Anything that would turn in life turns;-fast spinners get `spin(angle, sweep, draw, { disc })`, a sheen disc and fading trails, because bare blades-read as a paper cut-out. At most three or four kinds of motion, out of step. Beside a headline, calm wins:-if the real machine moves little, declare it with a `meta.holds` reason instead of inventing motion. Frame 0-is what a reduced-motion visitor sees, so compose it as the hero frame.--## 8. Sets and small sizes--Spots in a row share one family of parts (the same screws, feet, bevels, label plates) and similar-weight: add parts to the sparse one, never strip the dense one. Under about 320 px cut detail instead of-shrinking it: bigger screws, fewer ticks, no knurls. Check every piece at its shown size and at 390 px-wide (`placement.mjs --phone out.png`), and look.--| Mood | Shape and parts | Colour |-|---|---|---|-| Precise | Thin plates, fine bevels, rulers, many small screws | Greys and one sharp accent |-| Friendly | Big radii, chunky buttons, rubber feet, few large screws | Warm page, a soft accent on the body |-| Crafted | Wood cheeks, brass fittings, label plates, hinges | Cream page, a deep accent |-| Calm | Few objects with air between, low heights, one slow motion | Low contrast, a muted accent |-| Launch | A diagonal, something lifted or in flight | The accent on the moving thing |+`PLACEMENTS` holds a canvas, an art region and, where there are words, a headline zone for each slot:+heroSide, heroSideLeft, heroStack, art, card, icon, strip, social, slide. Fit the object into its+region with `Cam.fit(A, E, points, fitBox(p))`. Give it every point that could stick out, a raised+or exploded part included, or the fit will crop it. Swing the azimuth until the side where the work+happens looks toward the words. Nothing at all is drawn inside the headline zone, and that includes+a cast shadow or a soft highlight. Check it on a rendered still:+`node tools/placement.mjs still.png --W <meta.W> --safe x,y,w,h`.++## 5. The page's colour, light and dark++`setPalette(pagePalette({ paper, accent, colours, tint }))` carries every material over to the page,+so the machine belongs to it. On a light page each neutral shifts by however much lighter or darker+the page is than the kit's cream, and `tint` (0 to 1) decides how much of the page's hue the greys+pick up as well. On a dark page the parts rise only a little above the page: the lit tops are the+lightest thing, and lines are drawn lighter than the faces they edge. Paint the background in+`paper` and nothing else; a near miss draws a pale rim round every part. A site with a light and a+dark theme gets both pictures from the same code, through `heroOn(title, paper, accent)`.++## 6. The brand's colour++`accent: "#hex"` colours the part from step 3. `colours: { wood: "#7a5536" }` recolours any+material by name, which is also how a brand's signature material is made. Two modes:++- **solid** (default): the whole part takes the brand colour. Its five shades all keep that hue,+ and their lightness is held in a range where each shade is still told apart from the next and+ none of them burns too bright against a dark background;+- **lines**: the faces keep their neutral greys and the colour goes only into the strokes and dots,+ which suits a pointer, a gauge needle or an engraved mark.++Put the brand on the part from step 3, and at most once more somewhere small. A brand colour that+also covers the base and the large panels no longer tells the eye where to go.++## 7. Let it move the way it works++Loop one whole cycle of the machine so it repeats without a seam. Animate the parts the real thing+would move, and nothing else. A part that turns too fast to see clearly gets+`spin(angle, sweep, draw, { swept })`: fainter copies of the blades, each a little further back,+over a faint swept shape, so the eye reads speed rather than slow turning. Next to a headline,+quiet is better: when the real machine barely moves, say so with a `meta.holds` reason instead of+inventing movement. A visitor who asks for reduced motion sees frame 0 and nothing more, so build+frame 0 as a finished picture in its own right.++## 8. Families of pictures, and tiny ones++When several pictures will sit together (a row of cards, a strip of icons), build them all from the+same bin of parts: one screw, one foot, one edge bevel, one camera angle, one accent. Then they+look like siblings. Compare how busy each one is and bring the emptiest up to the others, not the+fullest down. At icon size, use fewer parts and make each one bigger, and leave out fine ticks+altogether. Render each picture at the size the page will actually show it, and again at phone+width (`placement.mjs --phone out.png`), and look at both.diff --git a/skills/anidoodle/engine/package-lock.json b/skills/anidoodle/engine/package-lock.jsonindex edfa6ab..65209b0 100644--- a/skills/anidoodle/engine/package-lock.json+++ b/skills/anidoodle/engine/package-lock.json@@ -1,12 +1,12 @@{"name": "anidoodle-engine",- "version": "0.9.0",+ "version": "0.9.1","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "anidoodle-engine",- "version": "0.9.0",+ "version": "0.9.1","dependencies": {"esbuild": "0.25.12"},diff --git a/skills/anidoodle/engine/package.json b/skills/anidoodle/engine/package.jsonindex b0aba70..553afff 100644--- a/skills/anidoodle/engine/package.json+++ b/skills/anidoodle/engine/package.json@@ -1,6 +1,6 @@{"name": "anidoodle-engine",- "version": "0.9.0",+ "version": "0.9.1","private": true,"type": "module","description": "Portable art core + backend adapters for illustrations, animations and films drawn entirely in code.",diff --git a/skills/anidoodle/engine/src/canvas-core/assetKit.ts b/skills/anidoodle/engine/src/canvas-core/assetKit.tsindex 558979d..0d3d207 100644--- a/skills/anidoodle/engine/src/canvas-core/assetKit.ts+++ b/skills/anidoodle/engine/src/canvas-core/assetKit.ts@@ -2,7 +2,7 @@// a social card. Three things change when a picture leaves its own card and sits on a site:// 1. placement: the art has a region, and the headline has a zone the art must never enter;// 2. ground: the paper IS the page colour, so every neutral moves to suit it, light or dark;-// 3. brand: one hex becomes a whole material (body) or only its marks (ink), in either theme.+// 3. brand: one hex colours a whole part (solid) or just its strokes and dots (lines), light theme or dark.// Placement is plain numbers. Ground and brand are a palette: `setPalette(pagePalette(...))` and every// material the kit paints is moved through it, so a machine is restyled without touching its parts.import type { Material } from "./mechanismKit";@@ -10,24 +10,25 @@ import type { Material } from "./mechanismKit";export type Rect = { x: number; y: number; w: number; h: number };export type Placement = { W: number; H: number; art: Rect; safe?: Rect; pad: number; note: string };-/** canvases by where the art sits. Sizes are about 1 unit per CSS pixel at the size the art is shown. */+/** canvases by where the art sits, in logical units near CSS pixels at the size the art is shown */export const PLACEMENTS: Record<string, Placement> = {- heroRight: { W: 1200, H: 640, art: { x: 520, y: 40, w: 640, h: 560 }, safe: { x: 0, y: 0, w: 480, h: 640 }, pad: 24, note: "headline left, art right; the moment faces the text" },- heroLeft: { W: 1200, H: 640, art: { x: 40, y: 40, w: 640, h: 560 }, safe: { x: 720, y: 0, w: 480, h: 640 }, pad: 24, note: "the mirror of heroRight" },- heroCentre: { W: 1200, H: 720, art: { x: 180, y: 210, w: 840, h: 480 }, safe: { x: 0, y: 0, w: 1200, h: 190 }, pad: 24, note: "headline above, a wide low object below" },- art: { W: 800, H: 600, art: { x: 0, y: 0, w: 800, h: 600 }, pad: 28, note: "the page lays out its own text" },- tile: { W: 640, H: 480, art: { x: 0, y: 0, w: 640, h: 480 }, pad: 32, note: "a feature card" },- spot: { W: 320, H: 320, art: { x: 0, y: 0, w: 320, h: 320 }, pad: 20, note: "one small object; cut detail, never shrink it to mush" },- banner: { W: 1600, H: 400, art: { x: 0, y: 24, w: 1600, h: 352 }, pad: 24, note: "a section divider; may bleed off a clean straight edge" },- social: { W: 1200, H: 630, art: { x: 560, y: 40, w: 600, h: 550 }, safe: { x: 0, y: 0, w: 520, h: 630 }, pad: 24, note: "a share card: words left, object right, carries its own ground" },- slide: { W: 1920, H: 1080, art: { x: 800, y: 80, w: 1060, h: 920 }, safe: { x: 0, y: 0, w: 760, h: 1080 }, pad: 32, note: "a deck slide" },+ heroSide: { W: 1600, H: 900, art: { x: 700, y: 60, w: 840, h: 780 }, safe: { x: 0, y: 0, w: 640, h: 900 }, pad: 32, note: "words on the left, the object on the right, its moment turned toward the words" },+ heroSideLeft: { W: 1600, H: 900, art: { x: 60, y: 60, w: 840, h: 780 }, safe: { x: 960, y: 0, w: 640, h: 900 }, pad: 32, note: "heroSide mirrored" },+ heroStack: { W: 1600, H: 900, art: { x: 200, y: 330, w: 1200, h: 540 }, safe: { x: 0, y: 0, w: 1600, h: 300 }, pad: 32, note: "words above, a long low object under them" },+ art: { W: 1200, H: 900, art: { x: 0, y: 0, w: 1200, h: 900 }, pad: 36, note: "the page sets its own words" },+ card: { W: 800, H: 600, art: { x: 0, y: 0, w: 800, h: 600 }, pad: 36, note: "a feature card" },+ icon: { W: 480, H: 480, art: { x: 0, y: 0, w: 480, h: 480 }, pad: 28, note: "a small single object; simplify the parts rather than shrink them" },+ strip: { W: 1920, H: 480, art: { x: 0, y: 28, w: 1920, h: 424 }, pad: 28, note: "a band between sections; the art may be cropped by a single side of the band, no more" },+ social: { W: 1200, H: 630, art: { x: 600, y: 45, w: 560, h: 540 }, safe: { x: 0, y: 0, w: 560, h: 630 }, pad: 28, note: "a link preview: words left, object right, its own ground" },+ slide: { W: 1920, H: 1080, art: { x: 860, y: 90, w: 1000, h: 900 }, safe: { x: 0, y: 0, w: 800, h: 1080 }, pad: 36, note: "a deck slide" },};/** the art region shrunk by its pad, as the corner box [x0, y0, x1, y1] `Cam.fit` takes */export const fitBox = (p: Placement): [number, number, number, number] => [p.art.x + p.pad, p.art.y + p.pad, p.art.x + p.art.w - p.pad, p.art.y + p.art.h - p.pad];/** where the eye should land: a third of the way into the art region, on the side nearest the text */export const strongPoint = (p: Placement): [number, number] => {- const towardText = p.safe ? (p.safe.x + p.safe.w / 2 < p.art.x + p.art.w / 2 ? 1 / 3 : 2 / 3) : 1 / 2;- return [p.art.x + p.art.w * towardText, p.art.y + p.art.h * (p.safe && p.safe.w === p.W ? 1 / 3 : 0.45)];+ const s = p.safe, above = s !== undefined && s.w >= p.W, cx = s ? s.x + s.w / 2 : 0, ax = p.art.x + p.art.w / 2;+ const fx = !s || above ? 1 / 2 : cx < ax ? 1 / 3 : 2 / 3; // words beside: lean toward them; words above or none: centre+ return [p.art.x + p.art.w * fx, p.art.y + p.art.h * (above ? 1 / 3 : 0.45)];};// ---------------------------------------------------------------- colour in a perceptual space (OKLab)@@ -50,19 +51,20 @@ export const fromLab = (lab: Lab): string => {for (let k = 0; k < 24; k++) { const rgb = labRgb([L, a, b]); if (rgb.every((v) => v >= -1e-4 && v <= 1 + 1e-4)) break; a *= 0.88; b *= 0.88; }return "#" + labRgb([L, a, b]).map((v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).padStart(2, "0")).join("");};-export const isDark = (paper: string) => toLab(paper)[0] < 0.6;+/** a page is dark when white text would read better on it than black: its relative luminance under about 0.18 */+export const isDark = (paper: string) => { const [r, g, b] = hexRgb(paper).map(toLin); return 0.2126 * r + 0.7152 * g + 0.0722 * b < 0.18; };// ---------------------------------------------------------------- the page palette-export type Colour = string | { hex: string; mode?: "body" | "ink" };+export type Colour = string | { hex: string; mode?: "solid" | "lines" };export type PageOpts = {paper: string; // the exact colour of the page the art sits onkitPaper?: string; // the paper the materials were designed on (the kit's cream)- tint?: number; // 0 keeps neutral greys, 1 takes the page's whole colour cast; 0.5 by default+ tint?: number; // how much of the page's hue the greys pick up: 0 none, 1 all of it, 0.5 by defaultaccent?: Colour; // the brand colour of the part to watch (materials with accent: true)colours?: Record<string, Colour>; // per material name: a brand or material colour (brass, walnut, ebony)};-/** one hex as a five-step material ramp in a theme: hue and chroma kept, lightness set where four tones still read */+/** one hex as a five-step material ramp in a theme: the hue and chroma stay, and the lightness sits where every step stays distinct from its neighbour */export const rampFrom = (hex: string, dark: boolean): { ramp: Material["ramp"]; seam: string; pigment: string } => {const [L0, a, b] = toLab(hex), c = dark ? Math.max(0.32, Math.min(0.64, L0 * 0.78)) : Math.max(0.36, Math.min(0.8, L0));const at = (L: number) => fromLab([L, a, b]);@@ -73,8 +75,9 @@ export const rampFrom = (hex: string, dark: boolean): { ramp: Material["ramp"];export const pagePalette = (o: PageOpts): ((m: Material) => Material) => {const dark = isDark(o.paper), P = toLab(o.paper), K = toLab(o.kitPaper ?? "#f3f0e8"), tint = o.tint ?? 0.5;const da = (P[1] - K[1]) * tint, db = (P[2] - K[2]) * tint;- // light page: everything moves by the page's difference in lightness and, by `tint`, in colour.- // dark page: parts sit a little above the page, the lit top lightest, lines lighter than the faces.+ // light page: each colour shifts by how far the page's lightness is from the kit's cream, and picks up+ // a `tint` share of the page's hue. dark page: parts rise just above the page, lit tops brightest, and+ // lines are drawn lighter than the faces they edge.const move = (hex: string, base: number) => {const [L, a, b] = toLab(hex);if (!dark) return fromLab([L + (P[0] - K[0]), a + da, b + db]);@@ -87,9 +90,9 @@ export const pagePalette = (o: PageOpts): ((m: Material) => Material) => {out = { ...m, ramp: m.ramp.map((c) => move(c, base)) as Material["ramp"], seam: dark ? fromLab([P[0] + 0.2, da, db]) : move(m.seam, base), ink: dark ? fromLab([Math.min(0.93, P[0] + 0.62), da, db]) : move(m.ink, base), pigment: m.pigment ? move(m.pigment, base - 0.25) : m.pigment };const want = (m.accent ? o.accent : undefined) ?? (m.name ? o.colours?.[m.name] : undefined);if (want) {- const { hex, mode = "body" } = typeof want === "string" ? { hex: want } : want, r = rampFrom(hex, dark);- // body: the part is made of the colour. ink: the part stays neutral and only its lines and dots take it.- out = mode === "body" ? { ...out, ramp: r.ramp, seam: r.seam, pigment: r.pigment } : { ...out, ink: r.pigment, seam: r.pigment };+ const { hex, mode = "solid" } = typeof want === "string" ? { hex: want } : want, r = rampFrom(hex, dark);+ // solid: the whole part takes the colour. lines: the faces keep their greys and only strokes and dots change.+ out = mode === "solid" ? { ...out, ramp: r.ramp, seam: r.seam, pigment: r.pigment } : { ...out, ink: r.pigment, seam: r.pigment };}cache.set(key, out); return out;};diff --git a/skills/anidoodle/engine/src/canvas-core/film.ts b/skills/anidoodle/engine/src/canvas-core/film.tsindex 061da9a..0e3f804 100644--- a/skills/anidoodle/engine/src/canvas-core/film.ts+++ b/skills/anidoodle/engine/src/canvas-core/film.ts@@ -21,7 +21,7 @@ export type Film = { meta: {locked?: [from: number, to: number, reason: string][];// a declared hold: the stillness is meant (a word read, an end card); the optional reason is printed by the gateholds?: [from: number, to: number, reason?: string][];- /** silences the film means (a stop-down before a reveal, a held breath), [fromFrame, toFrame, reason]: verify-export does not count them as holes */+ /** silences the film means (a held breath before a reveal, a pause on a beat), [fromFrame, toFrame, reason]: verify-export does not count them as holes */quiet?: [from: number, to: number, reason?: string][];onTwos?: boolean;step?: 1 | 2 | 3;diff --git a/skills/anidoodle/engine/src/canvas-core/mechanism.ts b/skills/anidoodle/engine/src/canvas-core/mechanism.tsindex e89b771..ee8931b 100644--- a/skills/anidoodle/engine/src/canvas-core/mechanism.ts+++ b/skills/anidoodle/engine/src/canvas-core/mechanism.ts@@ -97,10 +97,10 @@ export const stateAt = (f: number): State => {const settled = clamp01((f - T.apart) / 40) * (1 - clamp01((f - T.home + 6) / 6));if (settled > 0) PLAN.order.forEach((id, i) => { shares[id] += 0.035 * settled * Math.sin((2 * Math.PI * t) / 2.6 + i * 0.9); });let lit = "drum", read = pl.read;- if (moving) read = f < T.home ? "TAKING APART" : "PUTTING BACK";+ if (moving) read = f < T.home ? "EXPLODING" : "REASSEMBLING";if (apart) {const k = Math.floor(clamp01((f - T.tour[0]) / (T.tour[1] - T.tour[0])) * PLAN.order.length * 0.9999);- lit = PLAN.order[f < T.tour[0] ? PLAN.order.length - 1 : k]; read = f < T.tour[0] ? `${PLAN.order.length} ASSEMBLIES APART` : `${PLAN.order.indexOf(lit) + 1}/${PLAN.order.length} · ${ABOUT[lit]}`;+ lit = PLAN.order[f < T.tour[0] ? PLAN.order.length - 1 : k]; read = f < T.tour[0] ? `${PLAN.order.length} ASSEMBLIES OUT` : `${PLAN.order.indexOf(lit) + 1}/${PLAN.order.length} · ${ABOUT[lit]}`;}return { rot, shares, lit, read, bend: pl.bend, fan: pl.fan, crank: pl.crank };};@@ -196,9 +196,9 @@ const parts = (c: Cam, s: State): Item[] => {const F = frameAlong([60, 12, 19.4], [0, 0, 1]); turned(ctx, c, F, cyl(0, 4, 1.5), M("governor", STEEL), { off: o, lit: lit("governor") });const KS = Math.round(20 / (hand().coarse ?? 1)); for (let i = 0; i < 9; i++) { const z0 = 0.3 + i * 0.42; for (let k = 0; k < KS; k++) { const th0 = (k / KS) * 2 * Math.PI + s.fan * 0.15, th1 = th0 + (2 * Math.PI) / KS, f = facingAt(c, F, (th0 + th1) / 2); if (f < 0.05) continue; const A = c.p(at(F, z0 + (k / KS) * 0.42, 1.5, th0)), B = c.p(at(F, z0 + ((k + 1) / KS) * 0.42, 1.5, th1)); ink(ctx, [[A[0] + o[0], A[1] + o[1]], [B[0] + o[0], B[1] + o[1]]], "seam", STEEL, false, smooth(0.05, 0.5, f)); } }}, "governor");- // the fan turns nine times a drum turn; with `blur` (radians of trail) it reads as spinning, not as a still cut-out- const sweep = (s.blur ?? 0), disc = (ctx: Ctx, o: P2) => () => tone(ctx, hull([...circleAt(c, [60, 12, 24.6], 4.6, o), ...circleAt(c, [60, 12, 28.8], 4.6, o)]), M("governor", ZINC), 4); // one shape: see-through bands would stack into stripes- [1, -1].forEach((side) => { const ring = vane(s.fan, side), mid = ring.reduce((a, q) => [a[0] + q[0] / 4, a[1] + q[1] / 4], [0, 0]); put(`vane${side}`, [mid[0], mid[1], 26.5], (ctx, o) => spin(s.fan, sweep, (ang) => prism(ctx, c, vane(ang, side), 24.6, 4.2, M("governor", ZINC), { off: o, lit: lit("governor") }), { disc: side > 0 ? disc(ctx, o) : undefined }), "governor", 0); });+ // the fan turns nine times a drum turn; with `blur` (radians the echoes spread over) it reads as spinning, not as a still cut-out+ const sweep = (s.blur ?? 0), sweptFan = (ctx: Ctx, o: P2) => () => tone(ctx, hull([...circleAt(c, [60, 12, 24.6], 4.6, o), ...circleAt(c, [60, 12, 28.8], 4.6, o)]), M("governor", ZINC), 4); // one shape: see-through bands would stack into stripes+ [1, -1].forEach((side) => { const ring = vane(s.fan, side), mid = ring.reduce((a, q) => [a[0] + q[0] / 4, a[1] + q[1] / 4], [0, 0]); put(`vane${side}`, [mid[0], mid[1], 26.5], (ctx, o) => spin(s.fan, sweep, (ang) => prism(ctx, c, vane(ang, side), 24.6, 4.2, M("governor", ZINC), { off: o, lit: lit("governor") }), { swept: side > 0 ? sweptFan(ctx, o) : undefined }), "governor", 0); });/** the music box at rest on a page, playing: every part home, the drum turning, the fan a blur */put("hub", [60, 12, 26.7], (ctx, o) => turned(ctx, c, frameAlong([60, 12, 24.4], [0, 0, 1]), cyl(0, 4.6, 0.95), M("governor", STEEL), { off: o }), "governor", 0.05);put("gcap", [60, 12, 30.6], (ctx, o) => turned(ctx, c, frameAlong([60, 12, 30.2], [0, 0, 1]), cyl(0, 0.8, 1.3), STEEL, { off: o }), "governor", 2);diff --git a/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts b/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.tsindex e1ef8fc..e85a1bf 100644--- a/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts+++ b/skills/anidoodle/engine/src/canvas-core/mechanismExplorer.ts@@ -45,7 +45,7 @@ export const mechanismExplorer: Piece = {const shares = Object.fromEntries(PLAN.order.map((id) => [id, Math.max(0, s.spring[id] as number)])), mean = PLAN.order.reduce((a, id) => a + shares[id], 0) / PLAN.order.length;const rot = s.reduced ? 0.4 : ((tick % LOOP) / LOOP) * 2 * Math.PI, pl = play(rot, Math.min(1, mean * 3));const state: State = { rot, shares, lit: "drum", read: pl.read, bend: pl.bend, fan: pl.fan, crank: pl.crank };- if (mean > 0.02 && mean < 0.9) state.read = (s.spring[PLAN.order[0]] as number) > 0.5 ? "TAKING APART" : "PUTTING BACK";+ if (mean > 0.02 && mean < 0.9) state.read = (s.spring[PLAN.order[0]] as number) > 0.5 ? "EXPLODING" : "REASSEMBLING";if (mean >= 0.9 && s.pointer) { // the part under the pointer: the nearest assembly, where it is nowlet best = Infinity;for (const id of PLAN.order) { const q: P2 = CAM.p(add(HOME[id], mul(MOVE[id], shares[id]))), d = Math.hypot(q[0] - s.pointer[0], q[1] - s.pointer[1]); if (d < best) { best = d; state.lit = id; } }diff --git a/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts b/skills/anidoodle/engine/src/canvas-core/mechanismKit.tsindex 4dd3c75..0badef9 100644--- a/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts+++ b/skills/anidoodle/engine/src/canvas-core/mechanismKit.ts@@ -144,24 +144,26 @@ export const setHand = (h: Hand) => { HAND = h; };let PALETTE: ((m: Material) => Material) | null = null;export const setPalette = (f: ((m: Material) => Material) | null) => { PALETTE = f; };const pal = (m: Material) => (PALETTE ? PALETTE(m) : m);-// a ghost is a part drawn faintly where it just was (a spinning blade's trail): no knock, so what is behind shows-let GHOST = 1;-export const ghost = (alpha: number, draw: () => void) => { const g = GHOST; GHOST = g * alpha; try { draw(); } finally { GHOST = g; } };+// faint: paint a part at reduced strength where it was a moment ago, with no knock, so whatever is behind+// it stays visible through it+let FAINT = 1;+export const faint = (alpha: number, draw: () => void) => { const g = FAINT; FAINT = g * alpha; try { draw(); } finally { FAINT = g; } };/**- * Something that turns fast enough to blur. `draw(angle)` paints the blades at an angle; behind them go- * `trails` fainter copies, spread over `sweep` radians against the direction of travel, and under all of- * it the caller's swept `disc`, if any, as a faint sheen. Slow turns (sweep near 0) draw the blades alone.+ * A part turning too fast to see clearly. `draw(angle)` paints the blades at one angle. Before them come+ * `echoes` fainter copies of the blades, each a little further back along the turn, spaced over `sweep`+ * radians, and below those the caller's `swept` shape, if given, painted very faint. When `sweep` is near+ * 0 the turn is slow and only the blades are drawn.*/-export const spin = (angle: number, sweep: number, draw: (angle: number) => void, o: { trails?: number; disc?: () => void } = {}) => {- const n = o.trails ?? 4, blur = Math.min(1, Math.abs(sweep) / 1.2);- if (blur > 0.02) { if (o.disc) ghost(0.16 * blur, o.disc); for (let k = n; k >= 1; k--) ghost(0.42 * blur * (1 - k / (n + 1)) ** 1.4, () => draw(angle - (sweep * k) / n)); }+export const spin = (angle: number, sweep: number, draw: (angle: number) => void, o: { echoes?: number; swept?: () => void } = {}) => {+ const n = o.echoes ?? 4, blur = Math.min(1, Math.abs(sweep) / 1.2);+ if (blur > 0.02) { if (o.swept) faint(0.16 * blur, o.swept); for (let k = n; k >= 1; k--) faint(0.42 * blur * (1 - k / (n + 1)) ** 1.4, () => draw(angle - (sweep * k) / n)); }draw(angle);};export const hand = () => HAND;/** a toned region in the current hand, honouring the making order (inked, then toned left to right) */export const tone = (ctx: Ctx, pts: P2[], m: Material, q: number, alpha = 1) => {if (pts.length < 3) return; m = pal(m);- if (GHOST < 1) { ctx.save(); ctx.globalAlpha = alpha * GHOST; HAND.region(ctx, pts, q, m, alpha * GHOST); ctx.restore(); return; }+ if (FAINT < 1) { ctx.save(); ctx.globalAlpha = alpha * FAINT; HAND.region(ctx, pts, q, m, alpha * FAINT); ctx.restore(); return; }if (REVEAL.tone >= 1) { if (!(HAND.opaque && alpha >= 1)) HAND.knock(ctx, pts); HAND.region(ctx, pts, q, m, alpha); return; }if (REVEAL.ink < 1) return;HAND.knock(ctx, pts); if (REVEAL.tone <= 0) return;@@ -169,9 +171,9 @@ export const tone = (ctx: Ctx, pts: P2[], m: Material, q: number, alpha = 1) =>ctx.save(); ctx.beginPath(); ctx.rect(x0 - 1, -1e5, (x1 - x0 + 2) * REVEAL.tone, 2e5); ctx.clip(); HAND.region(ctx, pts, q, m, alpha); ctx.restore();};/** paint the ground back over a shape without toning it (the paper inside a hull) */-export const knock = (ctx: Ctx, pts: P2[]) => { if (GHOST >= 1 && pts.length >= 3 && (REVEAL.tone >= 1 || REVEAL.ink >= 1)) HAND.knock(ctx, pts); };-export const ink = (ctx: Ctx, pts: P2[], role: Role, m: Material, close = false, alpha = 1) => { if (pts.length >= 2 && REVEAL.ink > 0) HAND.line(ctx, pts, role, pal(m), close, alpha * GHOST, REVEAL.ink); };-export const inkDot = (ctx: Ctx, at: P2, r: number, m: Material, alpha = 1) => { if (REVEAL.ink >= 1) HAND.dot(ctx, at, r, pal(m), alpha * GHOST); };+export const knock = (ctx: Ctx, pts: P2[]) => { if (FAINT >= 1 && pts.length >= 3 && (REVEAL.tone >= 1 || REVEAL.ink >= 1)) HAND.knock(ctx, pts); };+export const ink = (ctx: Ctx, pts: P2[], role: Role, m: Material, close = false, alpha = 1) => { if (pts.length >= 2 && REVEAL.ink > 0) HAND.line(ctx, pts, role, pal(m), close, alpha * FAINT, REVEAL.ink); };+export const inkDot = (ctx: Ctx, at: P2, r: number, m: Material, alpha = 1) => { if (REVEAL.ink >= 1) HAND.dot(ctx, at, r, pal(m), alpha * FAINT); };const ruleFrame = (ctx: Ctx, W: number, H: number, colour: string, p: number, pad = 34) => {if (p <= 0) return; ctx.strokeStyle = colour; ctx.lineWidth = 1.2; ctx.globalAlpha = 1; ctx.lineCap = "butt"; ctx.setLineDash([]);const L = 2 * (W + H - 4 * pad) * clamp01(p), segs: [P2, P2][] = [[[pad, pad], [W - pad, pad]], [[W - pad, pad], [W - pad, H - pad]], [[W - pad, H - pad], [pad, H - pad]], [[pad, H - pad], [pad, pad]]];diff --git a/skills/anidoodle/engine/src/canvas-core/music/delivery.ts b/skills/anidoodle/engine/src/canvas-core/music/delivery.tsindex 5692f01..c6e9f99 100644--- a/skills/anidoodle/engine/src/canvas-core/music/delivery.ts+++ b/skills/anidoodle/engine/src/canvas-core/music/delivery.ts@@ -1,9 +1,7 @@-// THE DELIVERY MASTER. The last thing a film's whole mix passes through, score and effects together.-// Before this, an effects-only film shipped at -27 LUFS and a scored one landed wherever the sum of its-// parts fell, 4 to 13 LU under its web peers. A film that plays quiet reads unfinished, whatever its timbre.-// One static gain to the target, then the smooth true-peak limiter, whose work is capped: when getting-// to the target would need more than `maxLimitDb` of limiting (a mix of sharp hits on near silence), the-// gain gives way instead of the hits being squashed, and the shortfall is reported, never hidden.+// THE DELIVERY MASTER. The last thing a film's whole mix passes through, score and effects together:+// one static gain to the web loudness target, then the smooth true-peak limiter, whose work is capped.+// When reaching the target would need more than `maxLimitDb` of limiting (sharp hits over near+// silence), the gain gives way instead of the hits being squashed, and the shortfall is reported.import { loudness, truePeak } from "./meter";import { smoothLimiter } from "./mixDsp";import { db } from "./dsp";diff --git a/skills/anidoodle/engine/src/canvas-core/music/sampler.ts b/skills/anidoodle/engine/src/canvas-core/music/sampler.tsindex 36a0207..93148ce 100644--- a/skills/anidoodle/engine/src/canvas-core/music/sampler.ts+++ b/skills/anidoodle/engine/src/canvas-core/music/sampler.ts@@ -8,12 +8,11 @@ import { rng } from "../core";import { pianoVelocity } from "./keysPiano";import { bandWidth } from "./mixDsp";-// Recordings made with spaced microphones can be out of phase between the sides in the body of the-// sound (150 Hz to 2 kHz: some marimba zones measure -0.72 file after file, which is one side's polarity-// flipped; tubular bells sit near 0, a grand piano about 0.3). On a phone or any mono fold the sides-// cancel and the music goes hollow. Each stereo recording is fixed once, when its bank is registered:-// a side whose body is clearly inverted is flipped back, then the body is narrowed (mono under 150 Hz,-// the side at half up to 2 kHz) while the air above 2 kHz keeps its full width.+// Recordings made with spaced microphones can disagree between the sides in the body of the sound+// (150 Hz to 2 kHz), and a phone or any mono fold then cancels part of it. Each stereo recording is+// fixed once, when its bank is registered: a side whose body is clearly inverted is flipped back,+// then the body is narrowed (mono under 150 Hz, the side at half up to 2 kHz) while the air above+// 2 kHz keeps its full width. Pack banks are always 48 kHz (tools/sounds.mjs refuses anything else).export const RECORDING_WIDTH = Object.freeze({ monoHz: 150, splitHz: 2000, mid: 0.5, high: 1, flipBelow: -0.3 });const narrowed = new WeakSet<Float32Array>();const bodyCorr = (L: Float32Array, R: Float32Array) => {diff --git a/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts b/skills/anidoodle/engine/src/canvas-core/music/soundcheck.tsindex 5744f32..74a100c 100644--- a/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts+++ b/skills/anidoodle/engine/src/canvas-core/music/soundcheck.ts@@ -1,15 +1,18 @@-// SOUNDCHECK. The film-sound scorecard as pure functions over a decoded stereo mix, so the tool-// (tools/soundcheck.mjs) and the tests read the same numbers. Nothing here needs a model or ears:+// SOUNDCHECK. Pure functions that score a film's decoded stereo mix, shared by tools/soundcheck.mjs and+// the tests so both always see the same numbers. Everything is measured from the samples; no model and+// no listening is involved. What gets measured:// level BS.1770 integrated / LRA / true peak from meter.ts; 10 ms K-weighted powers for the rest-// shape first sound, holes, dead tail, fade, final moment, an 11-point arc, hits, stop-downs-// spectrum six band shares of the mid, centroid, the loudest third-octave in a band (to name a fix)+// shape first sound, holes, dead tail, fade, final moment, an 11-point arc, accents, held breaths+// spectrum five band shares of the mid, centroid, the loudest third-octave in a band (to name a fix)// stereo side vs mid, L/R correlation overall and per band, mono-fold loss beyond the expected 3 dB// picture frame-difference events against onsets, with a chance baseline from shifted events-// Then evaluate() holds every number to a profile and writes the fix a mixer would make.+// evaluate() then checks each number against a profile's range and, where one is out, writes the+// concrete change to the mix that would bring it back.import { loudness, truePeak, onsetsDetail, centroid, fft } from "./meter";import { kWeight } from "./sfxCore";-export const BANDS: Record<string, [number, number]> = { sub: [20, 60], low: [60, 250], lowmid: [250, 1000], mid: [1000, 4000], presence: [4000, 8000], air: [8000, 16000] };+// five listening regions: what you feel, what warms, where notes live, what cuts through, what shines+export const BANDS: Record<string, [number, number]> = { rumble: [20, 80], warmth: [80, 300], body: [300, 1200], bite: [1200, 5000], sparkle: [5000, 16000] };/** Where a stereo mix's body sits: decorrelation here is what a phone's one speaker combs away. */export const BODY: [number, number] = [150, 2000];const HOP = 0.01, BLK = 0.05;@@ -52,14 +55,14 @@ export type Measures = {introLu: number; endLu: number; arc: (number | null)[]; arcDip: number; arcDipAt: number;firstSound: number | null; insideGap: number; insideGapAt: number | null; gaps: Gap[]; endSilence: number; endSilenceFrom: number;fade: number; finalLu: number; tailLu: number; quietAt: number | null; loudAt: number;- onsetRate: number; hitRate: number; stopDowns: { at: number; len: number }[];+ onsetRate: number; accentRate: number; heldBreaths: { at: number; len: number }[];bands: Record<string, number>; centroid: number; peakHz: Record<string, number>;sideMid: number; corr: number; bandCorr: Record<string, number>; bodyCorr: number; monoDrop: number; monoLoss: number;silent: boolean;};-export type Curves = { momentary: number[]; shortTerm: number[]; hopS: number; levels50: number[]; onsets: number[]; hits: number[] };+export type Curves = { momentary: number[]; shortTerm: number[]; hopS: number; levels50: number[]; onsets: number[]; accents: number[] };-/** Every model-free number for one decoded stereo mix. `allow` lists [from, to] seconds where a hole is meant (a declared stop-down). */+/** Every model-free number for one decoded stereo mix. `allow` lists [from, to] seconds where a hole is meant (a declared held breath). */export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow = [] as [number, number][] } = {}): { measures: Measures; curves: Curves } => {const dur = L.length / sr, chans = [L, R];const lo = loudness(chans, sr), tp = truePeak(chans), I = lo.integrated, silent = !(I > -70);@@ -94,16 +97,16 @@ export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow =const fin = lo.momentary.filter((_, i) => i * lo.hopS + 0.2 >= dur - 3);const st = lo.shortTerm; let si = 0; st.forEach((v, i) => { if (v > st[si]) si = i; });let qi = -1; st.forEach((v, i) => { if (v > I - 40 && (qi < 0 || v < st[qi])) qi = i; });- // hits and stop-downs on a 100 ms level every 10 ms+ // accents (sudden jumps) and held breaths (short dips that come back) on a 100 ms level every 10 msconst S = Array.from({ length: nh }, (_, i) => lufsOf(meanOf(p10, i - 5, i + 5)));- const hits: number[] = [];- for (let i = 8; i < nh; i++) if (S[i] - S[i - 8] >= 6 && S[i] >= I - 8 && (!hits.length || i * HOP - hits[hits.length - 1] > 0.3)) hits.push(i * HOP);- const stopDowns: { at: number; len: number }[] = [];+ const accents: number[] = [];+ for (let i = 8; i < nh; i++) if (S[i] - S[i - 8] >= 6 && S[i] >= I - 8 && (!accents.length || i * HOP - accents[accents.length - 1] > 0.3)) accents.push(i * HOP);+ const heldBreaths: { at: number; len: number }[] = [];for (let i = 50; i < nh; i++) {const ref = lufsOf(meanOf(p10, i - 50, i)); if (ref < I - 10 || S[i] >= ref - 10 || S[i - 1] < ref - 10) continue;let j = i; while (j < nh && S[j] < ref - 10) j++;const len = (j - i) * HOP; let back = false; for (let k = j; k < Math.min(nh, j + 30); k++) if (S[k] >= ref - 6) { back = true; break; }- if (len >= 0.15 && len <= 1.5 && back) stopDowns.push({ at: i * HOP, len: +len.toFixed(2) });+ if (len >= 0.15 && len <= 1.5 && back) heldBreaths.push({ at: i * HOP, len: +len.toFixed(2) });i = j;}const on = silent ? [] : onsetsDetail(chans, sr).times;@@ -128,12 +131,12 @@ export const analyze = (L: Float32Array, R: Float32Array, sr: number, { allow =firstSound: first >= 0 ? first * BLK : null, insideGap: open[0]?.len ?? 0, insideGapAt: open[0]?.at ?? null, gaps, endSilence: Math.max(0, dur - endFrom), endSilenceFrom: endFrom,fade: lastBody >= 0 && last >= lastBody ? (last - lastBody) * BLK : 0, finalLu: fin.length ? Math.max(...fin) - I : NaN, tailLu: lv.length ? Math.max(lv[lv.length - 1] - Iraw, -70 - I) : NaN,quietAt: qi >= 0 ? qi * lo.hopS + 1.5 : null, loudAt: si * lo.hopS + 1.5,- onsetRate: on.length / dur, hitRate: hits.length / dur, stopDowns,+ onsetRate: on.length / dur, accentRate: accents.length / dur, heldBreaths,bands, centroid: silent ? 0 : centroid(chans, sr).energyWeighted, peakHz,sideMid: 10 * Math.log10(Math.max(sm, 1e-30) / Math.max(mm, 1e-30)), corr: sl > 0 && sr_ > 0 ? slr / Math.sqrt(sl * sr_) : NaN,bandCorr, bodyCorr: corrIn(BODY[0], BODY[1]), monoDrop, monoLoss: monoDrop - 10 * Math.log10(2), silent,};- return { measures, curves: { momentary: lo.momentary, shortTerm: lo.shortTerm, hopS: lo.hopS, levels50: lv, onsets: on, hits } };+ return { measures, curves: { momentary: lo.momentary, shortTerm: lo.shortTerm, hopS: lo.hopS, levels50: lv, onsets: on, accents } };};// ---------------------------------------------------------------- picture against sound@@ -161,19 +164,19 @@ export const visualSync = (events: number[], onsets: number[], dur: number, tolexport type Range = { min?: number; max?: number; tol?: number };export type Status = "PASS" | "WARN" | "FAIL" | "INFO";export type Profile = { name: string; ranges: Record<string, Range>; allow?: [number, number][] };-/** Drawing films, from the study's pro-reference column, tightened where a drawing film should be (no dead tail, no hole, sound from frame 0). */+/** Built-in ranges for drawing films: web loudness, sound from frame 0, no hole, no dead tail, phone-safe mids. */export const DEFAULT_PROFILE: Profile = {name: "built-in: drawing film",ranges: {lufs: { min: -16, max: -13, tol: 1 }, truePeak: { max: -1, tol: 0 }, lra: { max: 9, tol: 3 },firstSound: { max: 0.5, tol: 0.5 }, insideGap: { max: 0.25, tol: 0.25 }, endSilence: { max: 0.5, tol: 0.5 }, arcDip: { min: -10, tol: 6 }, tailLu: { max: -20, tol: 10 },bodyCorr: { min: 0.3, tol: 0.15 }, monoLoss: { max: 1.5, tol: 0.5 }, corr: { min: 0.3, tol: 0.3 }, sideMid: { min: -15, max: -4, tol: 3 },- sub: { max: -6, tol: 2 }, lowmid: { max: -3, tol: 1.5 },+ rumble: { max: -5, tol: 2 }, body: { max: -3, tol: 1.5 },},};/** Delivery limits a reference set never loosens: a profile built from films can only move the taste ranges. */export const HARD = ["truePeak", "firstSound", "insideGap", "endSilence", "monoLoss"];-const TOL: Record<string, number> = { lufs: 1, lra: 3, crest: 2, introLu: 3, endLu: 3, arcDip: 4, tailLu: 6, fade: 0.5, finalLu: 4, onsetRate: 1, hitRate: 0.3, corr: 0.2, bodyCorr: 0.15, sideMid: 3, centroid: 400, sub: 2, low: 2, lowmid: 2, mid: 2, presence: 2, air: 2 };+const TOL: Record<string, number> = { lufs: 1, lra: 3, crest: 2, introLu: 3, endLu: 3, arcDip: 4, tailLu: 6, fade: 0.5, finalLu: 4, onsetRate: 1, accentRate: 0.3, corr: 0.2, bodyCorr: 0.15, sideMid: 3, centroid: 400, rumble: 2, warmth: 2, body: 2, bite: 2, sparkle: 2 };export type Row = { key: string; label: string; value: number | null; text: string; status: Status; range?: Range; fix?: string; at?: number; covered?: boolean };const fmtT = (s: number) => `${Math.floor(s / 60)}:${(s % 60).toFixed(1).padStart(4, "0")}`;@@ -188,26 +191,25 @@ export const grade = (v: number | null, r?: Range): Status => {const rangeText = (r?: Range) => (!r ? "" : r.min !== undefined && r.max !== undefined ? `${r.min}..${r.max}` : r.min !== undefined ? `>= ${r.min}` : r.max !== undefined ? `<= ${r.max}` : "");type Def = { key: string; label: string; get: (m: Measures) => number | null; show: (v: number, m: Measures) => string; fix?: (v: number, m: Measures, r: Range) => string; at?: (m: Measures) => number | undefined };-const BAND_LABEL: Record<string, string> = { sub: "sub 20-60 Hz", low: "low 60-250 Hz", lowmid: "low-mid 250-1k", mid: "mid 1-4k", presence: "presence 4-8k", air: "air 8-16k" };+const BAND_LABEL: Record<string, string> = { rumble: "rumble 20-80 Hz", warmth: "warmth 80-300 Hz", body: "body 300-1200 Hz", bite: "bite 1.2-5 kHz", sparkle: "sparkle 5-16 kHz" };const bandFix = (b: string, v: number, m: Measures, r: Range) => {- const hot = r.max !== undefined && v > r.max, pk = m.peakHz[b];- if (b === "sub") return hot ? `too much 20-60 Hz (${f1(v)} dB of the energy, it eats the headroom): high-pass the effects at 30-40 Hz and pull the sub voice down` : `no weight under 60 Hz (${f1(v)} dB): let a low voice or the impact reach 40-60 Hz`;- if (b === "lowmid") return hot ? `boxy (${f1(v)} dB in 250-1k, loudest around ${pk} Hz): cut ${pk >= 250 && pk <= 800 ? `${Math.round(pk * 0.08) * 10}-${Math.round(pk * 0.125) * 10}` : "300-500"} Hz by 2-3 dB` : `thin (${f1(v)} dB in 250-1k): the body is missing, lift 250-500 Hz 1-2 dB`;- if (b === "low") return hot ? `boomy (${f1(v)} dB in 60-250, around ${pk} Hz): cut ${pk} Hz 2-3 dB or high-pass the pads at 80-100 Hz` : `no low end (${f1(v)} dB in 60-250): bring the bass or the low pad up`;- if (b === "mid") return hot ? `honky (${f1(v)} dB in 1-4k, around ${pk} Hz): cut ${pk} Hz 2 dB` : `recessed mids (${f1(v)} dB in 1-4k): the melody needs 1-3 kHz, lift the lead`;- if (b === "presence") return hot ? `harsh (${f1(v)} dB in 4-8k): cut 4-6 kHz 2 dB or soften the transients` : `dull (${f1(v)} dB in 4-8k): lift 5 kHz 1-2 dB on the lead or the effects' transients`;- return hot ? `fizzy (${f1(v)} dB in 8-16k): a shelf down 2 dB above 10 kHz` : `no air (${f1(v)} dB in 8-16k): a gentle shelf up above 10 kHz`;+ const hot = r.max !== undefined && v > r.max, pk = m.peakHz[b], at = pk ? ` (strongest near ${pk} Hz)` : "";+ if (b === "rumble") return hot ? `the rumble takes ${f1(v)} dB of the energy: little speakers cannot play it and it uses up the loudness; roll off under 40 Hz on the effects and shorten the low tails` : `nothing under 80 Hz (${f1(v)} dB): one low voice or the big hit can carry some weight`;+ if (b === "warmth") return hot ? `woolly, ${f1(v)} dB in the warmth${at}: dip that spot a few dB or clear the pads out from under 100 Hz` : `cold (${f1(v)} dB of warmth): the bass or a low pad can come up`;+ if (b === "body") return hot ? `crowded body, ${f1(v)} dB${at}: notch the strongest spot a couple of dB, or move a part up or down an octave` : `hollow body (${f1(v)} dB): the chords or the melody's lower notes can come forward`;+ if (b === "bite") return hot ? `pushy, ${f1(v)} dB of bite${at}: a small dip there, or a softer attack on the loudest part` : `muffled (${f1(v)} dB of bite): the melody wants to sit in 1.5-3 kHz; bring the lead forward`;+ return hot ? `glassy, ${f1(v)} dB of sparkle: tame the very top with a gentle shelf, or round off the sharpest transients` : `no shine (${f1(v)} dB of sparkle): a touch of top on the effects or the room`;};const DEFS: Def[] = [{ key: "lufs", label: "integrated loudness", get: (m) => m.lufs, show: (v) => `${f1(v)} LUFS`, fix: (v, m, r) => v < (r.min ?? -99) ? `plays at ${f1(v)} LUFS, ${f1(-14 - v)} LU under the web target: master the mix to -14 LUFS (or -16 for a gentle film), a static gain then the limiter` : `too loud at ${f1(v)} LUFS: turn the master down to -14 LUFS` },{ key: "truePeak", label: "true peak", get: (m) => m.truePeak, show: (v) => `${f1(v)} dBTP`, fix: (v) => `true peak ${f1(v)} dBTP: set the limiter ceiling to -1.5 dBTP before the encode, so the AAC overshoot stays under -1` },{ key: "lra", label: "loudness range", get: (m) => m.lra, show: (v) => `${f1(v)} LU`, fix: (v, m) => `level swings ${f1(v)} LU (loudest at ${fmtT(m.loudAt)}${m.quietAt !== null ? `, quietest at ${fmtT(m.quietAt)}` : ""}): lift the quiet passages or keep a bed under them`, at: (m) => m.quietAt ?? undefined },{ key: "firstSound", label: "first sound", get: (m) => m.firstSound, show: (v) => `${f1(v, 2)} s`, fix: (v) => `nothing reaches body level until ${fmtT(v)}: start the bed or a sound on frame 0`, at: (m) => m.firstSound ?? 0 },- { key: "insideGap", label: "longest hole inside", get: (m) => m.insideGap, show: (v, m) => `${f1(v, 2)} s${m.insideGapAt !== null ? ` at ${fmtT(m.insideGapAt)}` : ""}`, fix: (v, m) => `${f1(v)} s hole at ${fmtT(m.insideGapAt ?? 0)}: keep the bed under it, or if it is a deliberate stop-down pass --allow ${f1(m.insideGapAt ?? 0, 2)}:${f1((m.insideGapAt ?? 0) + v, 2)}`, at: (m) => m.insideGapAt ?? undefined },+ { key: "insideGap", label: "longest hole inside", get: (m) => m.insideGap, show: (v, m) => `${f1(v, 2)} s${m.insideGapAt !== null ? ` at ${fmtT(m.insideGapAt)}` : ""}`, fix: (v, m) => `${f1(v)} s hole at ${fmtT(m.insideGapAt ?? 0)}: keep the bed under it, or if the silence is meant as a held breath pass --allow ${f1(m.insideGapAt ?? 0, 2)}:${f1((m.insideGapAt ?? 0) + v, 2)}`, at: (m) => m.insideGapAt ?? undefined },{ key: "endSilence", label: "dead air at the end", get: (m) => m.endSilence, show: (v) => `${f1(v, 2)} s`, fix: (v, m) => `${f1(v)} s of dead air at the end (from ${fmtT(m.endSilenceFrom)}): carry the bed or a tail to the last frame, or end the film sooner`, at: (m) => m.endSilenceFrom },{ key: "arcDip", label: "deepest dip in the arc", get: (m) => (m.silent ? null : m.arcDip), show: (v, m) => `${sign(v)} LU at ${fmtT(m.arcDipAt)}`, fix: (v, m) => `the sound drops ${f1(-v)} LU under the film at ${fmtT(m.arcDipAt)} (${Math.round((100 * m.arcDipAt) / m.durationS)} %): keep the bed or room tone under it`, at: (m) => m.arcDipAt },{ key: "tailLu", label: "level of the last 50 ms", get: (m) => (m.silent ? null : m.tailLu), show: (v, m) => (v + m.lufs <= -70 + 1e-6 ? "silent" : `${sign(v)} LU`), fix: (v) => `ends on a cut (the last 50 ms still at ${sign(v)} LU): end on a tail or fade the last 0.3 s`, at: (m) => m.durationS - 0.05 },- { key: "bodyCorr", label: "L/R correlation 150-2k", get: (m) => m.bodyCorr, show: (v) => f1(v, 2), fix: (v) => `mids decorrelated (150-2k correlation ${f1(v, 2)}): narrow the stereo width below 2 kHz (mixDsp.bandWidth mid at 1.0, or a mono room send)` },+ { key: "bodyCorr", label: "L/R correlation 150-2k", get: (m) => m.bodyCorr, show: (v) => f1(v, 2), fix: (v) => `mids decorrelated (150-2k correlation ${f1(v, 2)}): narrow the stereo width below 2 kHz (mixDsp.bandWidth with mid around 0.5, or a mono room send)` },{ key: "monoLoss", label: "mono fold, extra loss", get: (m) => m.monoLoss, show: (v) => `${f1(v)} dB`, fix: (v) => `folded to mono it loses ${f1(v)} dB more than a centred mix: phones will comb it; narrow the width or check the stereo pair's phase` },{ key: "corr", label: "L/R correlation", get: (m) => m.corr, show: (v) => f1(v, 2), fix: (v) => `L and R barely agree (correlation ${f1(v, 2)}): pan the lead and bass to the centre, keep width for pads and room` },{ key: "sideMid", label: "side vs mid", get: (m) => m.sideMid, show: (v) => `${f1(v)} dB`, fix: (v, m, r) => v > (r.max ?? 99) ? `too wide (side ${f1(v)} dB against the mid): narrow the overall width` : `very narrow (side ${f1(v)} dB): widen the pads or the room a little` },@@ -220,11 +222,11 @@ const DEFS: Def[] = [{ key: "fade", label: "fade / ring-out", get: (m) => m.fade, show: (v) => `${f1(v, 2)} s` },{ key: "finalLu", label: "final moment (last 3 s)", get: (m) => m.finalLu, show: (v) => `${sign(v)} LU` },{ key: "onsetRate", label: "onsets per second", get: (m) => m.onsetRate, show: (v) => f1(v, 2) },- { key: "hitRate", label: "salient hits per second", get: (m) => m.hitRate, show: (v) => f1(v, 2) },- { key: "stopDowns", label: "stop-downs", get: (m) => m.stopDowns.length, show: (v, m) => `${v}${m.stopDowns.length ? ` (${m.stopDowns.slice(0, 4).map((s) => fmtT(s.at)).join(", ")})` : ""}` },+ { key: "accentRate", label: "accents per second", get: (m) => m.accentRate, show: (v) => f1(v, 2) },+ { key: "heldBreaths", label: "held breaths", get: (m) => m.heldBreaths.length, show: (v, m) => `${v}${m.heldBreaths.length ? ` (${m.heldBreaths.slice(0, 4).map((s) => fmtT(s.at)).join(", ")})` : ""}` },];/** Fix order: what most makes a film read unfinished goes first. */-const ORDER = ["lufs", "endSilence", "insideGap", "firstSound", "arcDip", "truePeak", "lra", "bodyCorr", "monoLoss", "sub", "lowmid", "sideMid", "corr", "tailLu"];+const ORDER = ["lufs", "endSilence", "insideGap", "firstSound", "arcDip", "truePeak", "lra", "bodyCorr", "monoLoss", "rumble", "body", "sideMid", "corr", "tailLu"];export const evaluate = (m: Measures, profile: Profile = DEFAULT_PROFILE): Row[] =>DEFS.map((d) => {@@ -237,7 +239,7 @@ export const evaluate = (m: Measures, profile: Profile = DEFAULT_PROFILE): Row[]});/** One fix per cause: the stereo numbers all point at the width, so they fold into the first of them that is out. */const GROUP: Record<string, string> = { bodyCorr: "stereo", monoLoss: "stereo", corr: "stereo", sideMid: "stereo" };-export const fixFirst = (rows: Row[]) => {+export const startHere = (rows: Row[]) => {const out: Row[] = [], seen = new Map<string, Row>();for (const r of rows.filter((x) => x.fix && !x.covered).sort((a, b) => (a.status === b.status ? 0 : a.status === "FAIL" ? -1 : 1) || rank(a.key) - rank(b.key))) {const g = GROUP[r.key], lead = g && seen.get(g);@@ -250,7 +252,7 @@ export const fixFirst = (rows: Row[]) => {const rank = (k: string) => { const i = ORDER.indexOf(k); return i < 0 ? 99 : i; };export { rangeText };-/** Ranges from films Alex picked: min, max and median of every number, per metric. */+/** Ranges from films the user picked: min, max and median of every number, per metric. */export const buildProfile = (name: string, sets: { file: string; measures: Measures }[]) => {const metrics: Record<string, { min: number; max: number; median: number }> = {};for (const d of DEFS) {@@ -263,7 +265,7 @@ export const buildProfile = (name: string, sets: { file: string; measures: Measuexport const profileFrom = (built: { name: string; metrics: Record<string, { min: number; max: number }>; allow?: [number, number][] }): Profile => {const ranges: Record<string, Range> = { ...DEFAULT_PROFILE.ranges };for (const [k, v] of Object.entries(built.metrics ?? {})) {- if (HARD.includes(k) || k === "stopDowns" || k === "peakPos") continue;+ if (HARD.includes(k) || k === "heldBreaths" || k === "peakPos") continue;const tol = TOL[k] ?? DEFAULT_PROFILE.ranges[k]?.tol ?? 1, pad = tol / 2;ranges[k] = { min: +(v.min - pad).toFixed(2), max: +(v.max + pad).toFixed(2), tol };}diff --git a/skills/anidoodle/engine/src/canvas-core/siteHero.ts b/skills/anidoodle/engine/src/canvas-core/siteHero.tsindex 5b3363b..4c2d55c 100644--- a/skills/anidoodle/engine/src/canvas-core/siteHero.ts+++ b/skills/anidoodle/engine/src/canvas-core/siteHero.ts@@ -1,8 +1,8 @@-// SITE HERO. The music box as art for a landing page: placed right of a headline (assetKit PLACEMENTS.heroRight),-// on the page's own colour, the part to watch in the brand colour, light and dark from one source. Its motion-// is the object working: the drum plays one full turn, the teeth lift and drop, the air brake spins to a blur.-// One drum turn is the whole loop, so it repeats without a seam; frame 0 is the rest pose a reduced-motion-// visitor sees, so it is composed as the hero frame.+// SITE HERO. The music box as art for a landing page: placed right of a headline (assetKit PLACEMENTS.heroSide),+// on the page's own colour, the part to watch in the brand colour, light and dark from one source. It moves only+// as the real box would: the drum plays one full turn, the teeth lift and drop, the air brake spins to a blur.+// One drum turn is the whole loop, so it repeats without a seam. Frame 0, the resting pose, is all a+// reduced-motion visitor gets, so it is laid out to stand on its own as the finished picture.import type { Ctx, Env } from "./core";import type { Film } from "./film";import { Cam, paintAll, setHand, setPalette, flatHand, hand, freshPen, rrect } from "./mechanismKit";@@ -10,7 +10,7 @@ import { isometricHand } from "./mechanismHands";import { parts, playing, homePoints, MOVE, REV } from "./mechanism";import { PLACEMENTS, fitBox, pagePalette, type Colour } from "./assetKit";-const FPS = 30, N = Math.round(REV * FPS), P = PLACEMENTS.heroRight;+const FPS = 30, N = Math.round(REV * FPS), P = PLACEMENTS.heroSide;// the fan turns nine times a drum turn; a trail of about a fifth of a second of its travel reads as speedconst BLUR = ((2 * Math.PI * 9) / REV) * 0.2;diff --git a/skills/anidoodle/engine/test/assetKit.test.ts b/skills/anidoodle/engine/test/assetKit.test.tsindex a371bef..0741e77 100644--- a/skills/anidoodle/engine/test/assetKit.test.ts+++ b/skills/anidoodle/engine/test/assetKit.test.ts@@ -2,7 +2,7 @@// its own hue, a page palette keeps every material's light order on a light page and on a dark one, the// brand lands only on the part to watch, and a placement's art region never overlaps its headline zone.// node tools/test.mjs assetKit-import { toLab, fromLab, rampFrom, pagePalette, isDark, PLACEMENTS, fitBox } from "../src/canvas-core/assetKit";+import { toLab, fromLab, rampFrom, pagePalette, isDark, PLACEMENTS, fitBox, strongPoint } from "../src/canvas-core/assetKit";import type { Material } from "../src/canvas-core/mechanismKit";export const name = "assetKit";@@ -34,8 +34,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(!near(p(watch).pigment!, z.pigment!) && Math.abs(hue(p(watch).pigment!) - hue("#3d7bff")) < 0.12, `on ${paper}: the part to watch takes the brand`);ok(near(p({ ...zinc }).ramp[2], z.ramp[2]), `on ${paper}: a plain part does not`);}- const ink = pagePalette({ paper: "#faf7f2", colours: { zinc: { hex: "#e4572e", mode: "ink" } } })(zinc);- ok(Math.abs(hue(ink.ink) - hue("#e4572e")) < 0.12 && near(ink.ramp[2], pagePalette({ paper: "#faf7f2" })(zinc).ramp[2]), "ink mode colours the lines and leaves the body neutral");+ const ink = pagePalette({ paper: "#faf7f2", colours: { zinc: { hex: "#e4572e", mode: "lines" } } })(zinc);+ ok(Math.abs(hue(ink.ink) - hue("#e4572e")) < 0.12 && near(ink.ramp[2], pagePalette({ paper: "#faf7f2" })(zinc).ramp[2]), "lines mode colours the lines and leaves the part neutral");ok(near(pagePalette({ paper: "#f3f0e8" })(zinc).ramp[2], zinc.ramp[2]), "on the kit's own paper nothing moves");// 4. placements@@ -44,4 +44,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(x0 >= 0 && y0 >= 0 && x1 <= p.W && y1 <= p.H && x1 > x0 && y1 > y0, `${id}: the fit box lies inside the canvas`);if (s) ok(x1 <= s.x || x0 >= s.x + s.w || y1 <= s.y || y0 >= s.y + s.h, `${id}: the art never overlaps the headline zone`);}+ const st = PLACEMENTS.heroStack, [sx] = strongPoint(st), side = PLACEMENTS.heroSide, [hx] = strongPoint(side);+ ok(Math.abs(sx - (st.art.x + st.art.w / 2)) < 1e-9, "words above: the moment sits on the centre line");+ ok(Math.abs(hx - (side.art.x + side.art.w / 3)) < 1e-9, "words on the left: the moment leans a third toward them");};diff --git a/skills/anidoodle/engine/test/delivery.test.ts b/skills/anidoodle/engine/test/delivery.test.tsindex 849f9f0..655753a 100644--- a/skills/anidoodle/engine/test/delivery.test.ts+++ b/skills/anidoodle/engine/test/delivery.test.ts@@ -1,6 +1,6 @@// DELIVERY TESTS. The whole film mix lands on its loudness target under the -1 dBTP ceiling, a quiet-// effects-only film is brought up instead of shipping at -27 LUFS, the limiter's work is capped (the gain-// gives way and says so), and "none" leaves the mix alone.+// effects-only film is brought to the target, the limiter's work is capped (the gain gives way and says+// so), and "none" leaves the mix alone.// node tools/test.mjs deliveryimport { deliver, targetOf } from "../src/canvas-core/music/delivery";import { loudness, truePeak } from "../src/canvas-core/music/meter";@@ -25,11 +25,11 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(d3.gainDb === 0 && L3.every((v, i) => v === before[i]), "none leaves the mix untouched");ok(Math.abs(loudness(tone(0.01), sr).integrated - loudness(tone(0.01), sr).integrated) < 1e-12, "the master is deterministic in, deterministic out");- // an effects-only film used to ship wherever its cues fell; now it is delivered at the gentle target+ // an effects-only film is delivered at the gentle targetconst fx = mixSfx(null, { fps: 30, frames: 120, cues: [{ frame: 10, kind: "tick" }, { frame: 40, kind: "pop" }, { frame: 80, kind: "impact" }] } as never, sr);ok(fx.delivered !== undefined && fx.dbtp <= -1 + 1e-6, `effects-only mix: delivered (${fx.lufs.toFixed(1)} LUFS, ${fx.dbtp.toFixed(2)} dBTP, limiter ${fx.limiterDb.toFixed(1)} dB)`);const old = mixSfx(null, { fps: 30, frames: 120, master: "none", cues: [{ frame: 10, kind: "tick" }, { frame: 40, kind: "pop" }, { frame: 80, kind: "impact" }] } as never, sr);- ok(Math.abs(fx.lufs + 16) <= 0.5, `on target, where the old peak-only master left it wherever its cues fell (${old.lufs.toFixed(1)} LUFS)`);+ ok(Math.abs(fx.lufs + 16) <= 0.5, `on target (the peak-only master gives ${old.lufs.toFixed(1)} LUFS)`);void truePeak;// between its cues an effects-only film sits on room tone, never on digital silencediff --git a/skills/anidoodle/engine/test/filmshape.test.ts b/skills/anidoodle/engine/test/filmshape.test.tsindex dca4263..0a3c069 100644--- a/skills/anidoodle/engine/test/filmshape.test.ts+++ b/skills/anidoodle/engine/test/filmshape.test.ts@@ -15,6 +15,6 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const hole = filmShape(...film(8, (t) => t < 3.1 || t > 6.4), sr);ok(kinds(hole) === "hole" && Math.abs(hole.holeS - 3.3) < 0.15, `a 3.3 s hole in the middle is caught (${hole.holeS.toFixed(1)} s)`);ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 3.3), sr)) === "", "a 0.2 s breath is not a hole");- ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 4.0), sr, { fps: 30, quiet: [[90, 123, "stop-down before the reveal"]] })) === "", "a declared stop-down is not a fault");+ ok(kinds(filmShape(...film(8, (t) => t < 3.1 || t > 4.0), sr, { fps: 30, quiet: [[90, 123, "a held breath before the reveal"]] })) === "", "a declared held breath is not a fault");ok(kinds(filmShape(...film(4, () => false), sr)) === "silent", "a silent film is caught");};diff --git a/skills/anidoodle/engine/test/mechanism.test.ts b/skills/anidoodle/engine/test/mechanism.test.tsindex 7fccd5c..47f7cdc 100644--- a/skills/anidoodle/engine/test/mechanism.test.ts+++ b/skills/anidoodle/engine/test/mechanism.test.ts@@ -65,8 +65,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(REV > 0 && hand().id === "flat", "the kit's default hand is the plain reference hand");void flatHand;- // 7. spin: a slow turn draws the blades once; a fast one trails fainter copies behind, against the travel+ // 7. spin: a slow turn draws the blades once; a fast one first paints fainter echoes, each further back along the turnconst calls = (sweep: number) => { const a: number[] = []; spin(1, sweep, (ang) => a.push(ang)); return a; };ok(calls(0).length === 1 && calls(0)[0] === 1, "a slow turn draws only the blades");- const fast = calls(1.2); ok(fast.length === 5 && fast[fast.length - 1] === 1 && fast.slice(0, -1).every((v) => v < 1), `a fast turn trails ${fast.length - 1} copies behind the blades, drawn first`);+ const fast = calls(1.2); ok(fast.length === 5 && fast[fast.length - 1] === 1 && fast.slice(0, -1).every((v) => v < 1), `a fast turn paints ${fast.length - 1} fainter echoes before the blades`);};diff --git a/skills/anidoodle/engine/test/sfxHarsh.test.ts b/skills/anidoodle/engine/test/sfxHarsh.test.tsindex c9bfd8e..d8e50d4 100644--- a/skills/anidoodle/engine/test/sfxHarsh.test.ts+++ b/skills/anidoodle/engine/test/sfxHarsh.test.ts@@ -57,8 +57,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {message = ""; try { mixSfx(null, { ...plan, harsh: harsh as SfxHarshOptions }, sr); } catch (e) { message = (e as Error).message; }ok(/harsh\./.test(message), `invalid harsh option rejected: ${JSON.stringify(harsh)}`);}- // Plan 2 re-captured in 0.9.0, when the impact boom's sub tail was shortened (0.6 to 0.38 s decay):- // it rang at 44 Hz for nearly 5 s and ate the headroom. Plans 0 and 1 are untouched.+ // Plan 2's hash covers the impact boom's shorter low tail (0.38 s decay).// Captured from production sources at c1beddfe4264a34d12531dbe931acef611fb0a02,// loaded by git show and bundled with these fixtures before the mixer was edited.const hashes = ["5db7c646b1e61b0016c5dd8a114e875f6cedbaed17f6b702a225ba2dcc187a85", "3064c924f76acb857c509a5c294cf043380451d544fda0b5372ce06d33ef133a", "f2fb798441ecf453b18de3ee2c849810e6fd56f4eaa14fd2002600985fb189f6"];diff --git a/skills/anidoodle/engine/test/soundcheck.test.ts b/skills/anidoodle/engine/test/soundcheck.test.tsindex 47dd464..51627b8 100644--- a/skills/anidoodle/engine/test/soundcheck.test.ts+++ b/skills/anidoodle/engine/test/soundcheck.test.ts@@ -1,13 +1,13 @@// SOUNDCHECK TESTS. Each fault the scorecard exists to catch, built on purpose in code (a hole, a-// dead tail, a late start, a decorrelated pair, a sub-heavy mix, a boxy mix, a quiet master, a cut+// dead tail, a late start, a decorrelated pair, a rumble-heavy mix, a crowded body, a quiet master, a cut// ending), and each must show up in its own metric, with a fix that names the time or the band.-import { analyze, evaluate, fixFirst, visualEvents, visualSync, buildProfile, profileFrom, grade, DEFAULT_PROFILE } from "../src/canvas-core/music/soundcheck";+import { analyze, evaluate, startHere, visualEvents, visualSync, buildProfile, profileFrom, grade, DEFAULT_PROFILE } from "../src/canvas-core/music/soundcheck";import { loudness } from "../src/canvas-core/music/meter";export const name = "soundcheck";export const run = (ok: (cond: boolean, label: string) => void) => {const sr = 48000;- // mulberry32: a plain LCG's interleaved outputs are correlated per band (it read as a -0.99 low-band correlation)+ // mulberry32, never a plain LCG: an LCG's interleaved left/right outputs are correlated per band and fake a near -1 low-band correlationlet seed = 9; const rnd = () => { seed = (seed + 0x6d2b79f5) | 0; let t = Math.imul(seed ^ (seed >>> 15), 1 | seed); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return (((t ^ (t >>> 14)) >>> 0) / 4294967296) * 2 - 1; };/** A plucked chord every 0.25 s over a soft pad: music-like, steady, correlated (the same in both ears). */const music = (secs: number, { from = 0, to = secs, amp = 0.2 } = {}) => {@@ -26,7 +26,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const clean = at(...music(6));ok(clean.firstSound === 0 && clean.insideGap === 0 && clean.endSilence < 0.06, `clean mix: first sound ${clean.firstSound} s, longest hole ${clean.insideGap} s, end silence ${clean.endSilence.toFixed(2)} s`);ok(Math.abs(clean.monoLoss) < 0.1 && clean.bodyCorr > 0.99 && clean.corr > 0.99, `identical channels fold to mono with ${clean.monoLoss.toFixed(2)} dB extra loss, 150-2k correlation ${clean.bodyCorr.toFixed(2)}`);- ok(["insideGap", "endSilence", "firstSound", "bodyCorr", "monoLoss", "sub"].every((k) => row(clean, k).status === "PASS"), "clean mix passes the shape, stereo and sub checks");+ ok(["insideGap", "endSilence", "firstSound", "bodyCorr", "monoLoss", "rumble"].every((k) => row(clean, k).status === "PASS"), "clean mix passes the shape, stereo and rumble checks");// the loudness number agrees with the meter, and a -27 LUFS master fails with the gain it needsconst [qL, qR] = music(6, { amp: 0.02 }), q = at(qL, qR), ref = loudness([qL, qR], sr).integrated;@@ -39,10 +39,10 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const [hL, hR] = music(6); for (let i = 2 * sr; i < 3 * sr; i++) { hL[i] = 0; hR[i] = 0; }const hole = at(hL, hR);ok(Math.abs(hole.insideGap - 1) <= 0.06 && Math.abs((hole.insideGapAt ?? 0) - 2) <= 0.06, `a 1 s hole at 2.0 s reads ${hole.insideGap.toFixed(2)} s at ${hole.insideGapAt?.toFixed(2)} s`);- const hf = fixFirst(evaluate(hole)).find((r) => r.key === "insideGap");+ const hf = startHere(evaluate(hole)).find((r) => r.key === "insideGap");ok(row(hole, "insideGap").status === "FAIL" && /1\.0 s hole at 0:02\.0/.test(hf?.fix ?? ""), `the fix says where: "${hf?.fix?.slice(0, 40)}..."`);- ok(!fixFirst(evaluate(hole)).some((r) => r.key === "arcDip"), "the arc dip inside that hole is the same fault: one fix, not two");- ok(at(hL, hR, { allow: [[1.9, 3.1]] }).insideGap === 0, "a declared stop-down (--allow 1.9:3.1) is not a hole");+ ok(!startHere(evaluate(hole)).some((r) => r.key === "arcDip"), "the arc dip inside that hole is the same fault: one fix, not two");+ ok(at(hL, hR, { allow: [[1.9, 3.1]] }).insideGap === 0, "a declared held breath (--allow 1.9:3.1) is not a hole");const [sL, sR] = music(6); for (let i = 2 * sr; i < 2.15 * sr; i++) { sL[i] = 0; sR[i] = 0; }ok(row(at(sL, sR), "insideGap").status === "PASS", `a 0.15 s breath is not a hole (${at(sL, sR).insideGap.toFixed(2)} s)`);@@ -59,33 +59,33 @@ export const run = (ok: (cond: boolean, label: string) => void) => {// a decorrelated pair: independent noise in each earconst n = 4 * sr, dL = new Float32Array(n), dR = new Float32Array(n); for (let i = 0; i < n; i++) { dL[i] = 0.1 * rnd(); dR[i] = 0.1 * rnd(); }- const dec = at(dL, dR), df = fixFirst(evaluate(dec));+ const dec = at(dL, dR), df = startHere(evaluate(dec));ok(Math.abs(dec.bodyCorr) < 0.1 && Math.abs(dec.monoLoss - 3) < 0.3, `decorrelated pair: 150-2k correlation ${dec.bodyCorr.toFixed(2)}, mono loses ${dec.monoLoss.toFixed(2)} dB past the expected 3`);ok(row(dec, "bodyCorr").status === "FAIL" && row(dec, "monoLoss").status === "FAIL" && df.filter((r) => ["bodyCorr", "monoLoss", "corr", "sideMid"].includes(r.key)).length === 1 && /below 2 kHz/.test(df.find((r) => r.key === "bodyCorr")?.fix ?? ""), "it fails, and the four stereo numbers make one fix: narrow the width below 2 kHz");// decorrelated only in the body: a 600 Hz tone a quarter-turn apart, a centred 5 kHz toneconst bL = new Float32Array(n), bR = new Float32Array(n); for (let i = 0; i < n; i++) { const t = i / sr, c = 0.1 * Math.sin(2 * Math.PI * 5000 * t); bL[i] = 0.2 * Math.sin(2 * Math.PI * 600 * t) + c; bR[i] = 0.2 * Math.cos(2 * Math.PI * 600 * t) + c; }const body = at(bL, bR);- ok(Math.abs(body.bodyCorr) < 0.1 && body.bandCorr.presence > 0.95, `body-only decorrelation is seen per band (150-2k ${body.bodyCorr.toFixed(2)}, presence ${body.bandCorr.presence.toFixed(2)})`);+ ok(Math.abs(body.bodyCorr) < 0.1 && body.bandCorr.sparkle > 0.95, `body-only decorrelation is seen per band (150-2k ${body.bodyCorr.toFixed(2)}, sparkle ${body.bandCorr.sparkle.toFixed(2)})`);- // a sub-heavy mix and a boxy one, each with a band-specific fix+ // a rumble-heavy mix and a crowded body, each with a band-specific fixconst [uL, uR] = music(4, { amp: 0.05 }); for (let i = 0; i < uL.length; i++) { const v = 0.4 * Math.sin(2 * Math.PI * 40 * (i / sr)); uL[i] += v; uR[i] += v; }const sub = at(uL, uR);- ok(sub.bands.sub > -3 && row(sub, "sub").status === "FAIL" && /30-40 Hz/.test(row(sub, "sub").fix ?? ""), `sub-heavy: ${sub.bands.sub.toFixed(1)} dB of the energy under 60 Hz, FAIL, "high-pass ... 30-40 Hz"`);- ok(clean.bands.sub < -20, `the clean mix keeps ${clean.bands.sub.toFixed(1)} dB under 60 Hz`);+ ok(sub.bands.rumble > -3 && row(sub, "rumble").status === "FAIL" && /under 40 Hz/.test(row(sub, "rumble").fix ?? ""), `rumble-heavy: ${sub.bands.rumble.toFixed(1)} dB of the energy under 80 Hz, FAIL, "roll off under 40 Hz"`);+ ok(clean.bands.rumble < -20, `the clean mix keeps ${clean.bands.rumble.toFixed(1)} dB under 80 Hz`);const [xL, xR] = music(4, { amp: 0.03 }); for (let i = 0; i < xL.length; i++) { const v = 0.3 * Math.sin(2 * Math.PI * 630 * (i / sr)); xL[i] += v; xR[i] += v; }const box = at(xL, xR);- ok(row(box, "lowmid").status === "FAIL" && box.peakHz.lowmid === 630 && /630 Hz/.test(row(box, "lowmid").fix ?? ""), `boxy: low-mid ${box.bands.lowmid.toFixed(1)} dB, loudest third-octave ${box.peakHz.lowmid} Hz named in the fix`);+ ok(row(box, "body").status === "FAIL" && box.peakHz.body === 630 && /630 Hz/.test(row(box, "body").fix ?? ""), `crowded body: ${box.bands.body.toFixed(1)} dB, strongest third-octave ${box.peakHz.body} Hz named in the fix`);- // a stop-down: a steady bed that dips 15 dB for 0.4 s and snaps back+ // a held breath: a steady bed that dips 15 dB for 0.4 s and snaps backconst [pL, pR] = music(6); for (let i = 3 * sr; i < 3.4 * sr; i++) { pL[i] *= 0.18; pR[i] *= 0.18; }const sd = at(pL, pR);- ok(sd.stopDowns.length === 1 && Math.abs(sd.stopDowns[0].at - 3) < 0.1, `a 0.4 s, 15 dB dip reads as one stop-down at ${sd.stopDowns[0]?.at.toFixed(2)} s`);+ ok(sd.heldBreaths.length === 1 && Math.abs(sd.heldBreaths[0].at - 3) < 0.1, `a 0.4 s, 15 dB dip reads as one held breath at ${sd.heldBreaths[0]?.at.toFixed(2)} s`);// the profile: ranges grade PASS / WARN / FAIL, and a built profile moves taste ranges but never the delivery limitsok(grade(-14, { min: -16, max: -13, tol: 1 }) === "PASS" && grade(-16.5, { min: -16, max: -13, tol: 1 }) === "WARN" && grade(-18, { min: -16, max: -13, tol: 1 }) === "FAIL" && grade(5, undefined) === "INFO", "grade: inside PASS, within tolerance WARN, beyond FAIL, no range INFO");const built = buildProfile("test", [{ file: "a", measures: clean }, { file: "b", measures: tgt }]), prof = profileFrom(built);ok(built.metrics.lufs.min <= built.metrics.lufs.median && built.metrics.lufs.median <= built.metrics.lufs.max && built.from.length === 2, `built profile: lufs ${built.metrics.lufs.min}..${built.metrics.lufs.max}, median ${built.metrics.lufs.median}`);- ok(JSON.stringify(prof.ranges.endSilence) === JSON.stringify(DEFAULT_PROFILE.ranges.endSilence) && prof.ranges.lufs.min !== DEFAULT_PROFILE.ranges.lufs.min && prof.ranges.presence !== undefined, "a built profile sets the taste ranges (loudness, bands) and keeps the hard ones (end silence)");+ ok(JSON.stringify(prof.ranges.endSilence) === JSON.stringify(DEFAULT_PROFILE.ranges.endSilence) && prof.ranges.lufs.min !== DEFAULT_PROFILE.ranges.lufs.min && prof.ranges.sparkle !== undefined, "a built profile sets the taste ranges (loudness, bands) and keeps the hard ones (end silence)");// picture against soundconst changed = Array.from({ length: 300 }, (_, i) => (i === 30 || i === 120 || i === 210 ? 0.5 : 0.01));diff --git a/skills/anidoodle/engine/tools/filmshape.mjs b/skills/anidoodle/engine/tools/filmshape.mjsindex 60032e0..65e70f6 100644--- a/skills/anidoodle/engine/tools/filmshape.mjs+++ b/skills/anidoodle/engine/tools/filmshape.mjs@@ -1,8 +1,8 @@// FILM SHAPE. Whether a film's sound has the shape of a finished piece: it starts with the picture, it// never drops out mid-film, and it ends with the film instead of stopping early and leaving dead air.// Measured in 100 ms blocks against the mix's own body level (the median of its active blocks), so a-// quiet film and a loud one are judged alike. A silence the film means (a stop-down before a reveal, a-// held breath) is declared in meta.quiet as [fromFrame, toFrame, reason] and is not a fault.+// quiet film and a loud one are judged alike. A silence the film means (a held breath before a reveal, a+// pause on a beat) is declared in meta.quiet as [fromFrame, toFrame, reason] and is not a fault.// import { filmShape } from "./filmshape.mjs"; filmShape(L, R, sr, { fps, quiet })export const SHAPE = Object.freeze({ firstS: 0.5, holeS: 0.25, endS: 0.5, quietDb: 30, bodyDb: 20 });diff --git a/skills/anidoodle/engine/tools/placement.mjs b/skills/anidoodle/engine/tools/placement.mjsindex 8db5d57..83e207d 100644--- a/skills/anidoodle/engine/tools/placement.mjs+++ b/skills/anidoodle/engine/tools/placement.mjs@@ -1,5 +1,5 @@// PLACEMENT. Site art has a zone the art must never enter: the headline's. This reads a rendered still-// and fails if anything (a part, a shadow, a sheen) is drawn there, then writes the picture at phone+// and fails if anything (a part, a cast shadow, a highlight) is drawn there, then writes the picture at phone// width so you look at it the size most visitors will.// node tools/placement.mjs out/hero.png --W 1200 --safe 0,0,480,640 [--paper #faf7f2] [--tol 6] [--phone out/hero-390.png]// --W is the film's logical width (meta.W); --safe is in the same units (assetKit PLACEMENTS[...].safe).diff --git a/skills/anidoodle/engine/tools/soundcheck.mjs b/skills/anidoodle/engine/tools/soundcheck.mjsindex 48acb8c..dadf6b8 100644--- a/skills/anidoodle/engine/tools/soundcheck.mjs+++ b/skills/anidoodle/engine/tools/soundcheck.mjs@@ -1,7 +1,8 @@-// SOUNDCHECK. A film-sound scorecard for an agent that cannot hear: every model-free number on a-// film's decoded mix, each held to a range, then the fixes in the order that matters, with times.+// SOUNDCHECK. Scores a rendered film's soundtrack from the numbers alone: it decodes the mix, measures+// it without any model, checks each value against a range, and lists the changes to make, most+// important first, each tied to a moment in the film.// node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile references/music/sound-profile.json]-// [--allow 3.1:3.6,...] [--video | --no-video] [--json] [--out f.json]+// [--allow 3.1:3.6,...] [--no-video] [--json] [--out f.json]// node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name "drawing film"]// Decodes what a player would (ffmpeg, stereo float at 48 kHz). The metrics are pure functions in// src/canvas-core/music/soundcheck.ts (unit-tested on synthetic signals); visual sync reuses@@ -54,7 +55,7 @@ export const check = async (C, file, { profile, allow = [], video = "auto" } = {sync = { ...C.visualSync(events, curves.onsets, measures.durationS), times: events, fps: p.video.fps };}const rows = C.evaluate(measures, prof);- return { file, profile: prof.name, measures, curves, sync, rows, fixes: C.fixFirst(rows), video: p.video, L, R };+ return { file, profile: prof.name, measures, curves, sync, rows, fixes: C.startHere(rows), video: p.video, L, R };};const pad = (s, n) => String(s).padEnd(n);@@ -68,10 +69,10 @@ export const report = (C, r) => {if (r.sync) {const s = r.sync, pct = (v) => (Number.isFinite(v) ? `${Math.round(v * 100)} %` : "n/a");o.push(` ${pad("INFO", 7)}${pad("visual events with an onset", 31)}${pad(`${pct(s.share)} of ${s.events}`, 24)}chance ${pct(s.chance)}`);- o.push(` ${pad("INFO", 7)}${pad("median onset offset", 31)}${pad(Number.isFinite(s.medianOffsetMs) ? `${s.medianOffsetMs > 0 ? "+" : ""}${s.medianOffsetMs} ms` : "n/a", 24)}pros: -45..+75 ms`);+ o.push(` ${pad("INFO", 7)}${pad("median onset offset", 31)}${pad(Number.isFinite(s.medianOffsetMs) ? `${s.medianOffsetMs > 0 ? "+" : ""}${s.medianOffsetMs} ms` : "n/a", 24)}a sound may lead its frame a little; a lag reads as late`);if (s.unanswered.length) o.push(` ${pad("INFO", 7)}${pad("events with no sound", 31)}${s.unanswered.slice(0, 8).map(C.fmtT).join(", ")}${s.unanswered.length > 8 ? ` (+${s.unanswered.length - 8})` : ""}`);}- o.push("", r.fixes.length ? "FIX FIRST" : "FIX FIRST: nothing");+ o.push("", r.fixes.length ? "START HERE" : "START HERE: nothing to fix");r.fixes.forEach((x, i) => o.push(` ${i + 1}. [${x.status}] ${x.fix}`));o.push("", "DETAIL", ` arc (LU vs integrated, 0..100 %): ${m.arc.map((v) => (v === null ? "silent" : (v > 0 ? "+" : "") + v.toFixed(1))).join(" ")}`);o.push(` bands (dB share): ${Object.entries(m.bands).map(([k, v]) => `${k} ${v.toFixed(1)}`).join(" ")}`);@@ -82,13 +83,13 @@ export const report = (C, r) => {return o.join("\n");};/** The JSON form: no sample buffers, curves trimmed to what a reader can use. */-export const asJson = (r) => ({ file: r.file, profile: r.profile, verdict: r.rows.some((x) => x.status === "FAIL") ? "FAIL" : "PASS", measures: r.measures, sync: r.sync, rows: r.rows, fixes: r.fixes.map((x) => ({ key: x.key, status: x.status, fix: x.fix, at: x.at })), onsets: r.curves.onsets.map((t) => +t.toFixed(3)), hits: r.curves.hits });+export const asJson = (r) => ({ file: r.file, profile: r.profile, verdict: r.rows.some((x) => x.status === "FAIL") ? "FAIL" : "PASS", measures: r.measures, sync: r.sync, rows: r.rows, fixes: r.fixes.map((x) => ({ key: x.key, status: x.status, fix: x.fix, at: x.at })), onsets: r.curves.onsets.map((t) => +t.toFixed(3)), accents: r.curves.accents });if (isMain(import.meta.url)) {const argv = process.argv.slice(2), flag = (k) => argv.includes(`--${k}`), opt = (...ks) => { for (const k of ks) { const i = argv.indexOf(k); if (i >= 0) return argv[i + 1]; } return undefined; };const VAL = new Set(["--profile", "--out", "--allow", "-o", "--name"]), pos = argv.filter((a, i) => !a.startsWith("-") && !VAL.has(argv[i - 1]));const die = (msg, code = 2) => { console.error(msg); process.exit(code); };- if (!pos.length) die("usage: node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile p.json] [--allow a:b] [--video|--no-video] [--json] [--out f.json]\n node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name \"drawing film\"]");+ if (!pos.length) die("usage: node tools/soundcheck.mjs <film|file.mp4|file.wav> [--profile p.json] [--allow a:b] [--no-video] [--json] [--out f.json]\n node tools/soundcheck.mjs profile <files...> -o references/music/sound-profile.json [--name \"drawing film\"]");const C = await loadCheck();try {if (pos[0] === "profile") {diff --git a/skills/anidoodle/engine/tools/soundsheet.mjs b/skills/anidoodle/engine/tools/soundsheet.mjsindex 1cfed57..70fa46e 100644--- a/skills/anidoodle/engine/tools/soundsheet.mjs+++ b/skills/anidoodle/engine/tools/soundsheet.mjs@@ -1,8 +1,8 @@-// SOUNDSHEET. A listening sheet for an agent that cannot hear: one PNG on one time axis with the-// picture (a frame strip), the spectrogram, the waveform, momentary and short-term loudness against-// the integrated level and the -14 LUFS target, onset ticks, salient hits, visual events, and every-// hole and the dead tail shaded. The hole, the dead tail and a late hit are visible before anyone-// listens. Same analysis as soundcheck.mjs (its verdict and first fixes head the sheet).+// SOUNDSHEET. Draws a film's soundtrack as a single PNG, everything stacked on one shared timeline: a+// strip of frames, the spectrogram, the waveform, momentary and short-term loudness with lines for the+// integrated level and the -14 LUFS target, onset ticks, accents, picture events, and shading over+// every hole and over dead air at the end. A gap, a silent ending or a late accent jumps out at a+// glance. It runs the soundcheck.mjs analysis, and that verdict and its top fixes sit at the top.// node tools/soundsheet.mjs <film|file.mp4|file.wav> -o out/<name>-sound.png [--profile p.json] [--allow a:b] [--width 1600]import { execFileSync } from "node:child_process";import { mkdtempSync, readFileSync, rmSync, mkdirSync, existsSync } from "node:fs";@@ -40,11 +40,11 @@ try {const fails = r.rows.filter((x) => x.status === "FAIL").length, warns = r.rows.filter((x) => x.status === "WARN").length;const data = {title: basename(file), dur, I: m.lufs, verdict: fails ? `FAIL: ${fails} fail, ${warns} warn` : warns ? `PASS with ${warns} warning${warns > 1 ? "s" : ""}` : "PASS",- stats: `${m.lufs.toFixed(1)} LUFS · LRA ${m.lra.toFixed(1)} LU · ${m.truePeak.toFixed(1)} dBTP · 150-2k corr ${Number.isFinite(m.bodyCorr) ? m.bodyCorr.toFixed(2) : "n/a"} · sub ${m.bands.sub.toFixed(1)} dB`,+ stats: `${m.lufs.toFixed(1)} LUFS · LRA ${m.lra.toFixed(1)} LU · ${m.truePeak.toFixed(1)} dBTP · 150-2k corr ${Number.isFinite(m.bodyCorr) ? m.bodyCorr.toFixed(2) : "n/a"} · rumble ${m.bands.rumble.toFixed(1)} dB`,fixes: r.fixes.slice(0, 4).map((x) => `${x.status} ${x.fix}`),strip, spec: png64(join(tmp, "spec.png")), env: env_,momentary: r.curves.momentary.map((v, i) => [i * r.curves.hopS + 0.2, v]), shortTerm: r.curves.shortTerm.map((v, i) => [i * r.curves.hopS + 1.5, v]),- onsets: r.curves.onsets, hits: r.curves.hits, events: r.sync?.times ?? [], unanswered: r.sync?.unanswered ?? [],+ onsets: r.curves.onsets, accents: r.curves.accents, events: r.sync?.times ?? [], unanswered: r.sync?.unanswered ?? [],shade: [...m.gaps.filter((g) => g.len >= 0.1).map((g) => ({ a: g.at, b: g.at + g.len, label: g.allowed ? "allowed hole" : `hole ${g.len.toFixed(1)} s` })), ...(m.endSilence >= 0.1 ? [{ a: m.endSilenceFrom, b: dur, label: `dead tail ${m.endSilence.toFixed(1)} s` }] : []), ...(m.firstSound && m.firstSound >= 0.1 ? [{ a: 0, b: m.firstSound, label: "before body level" }] : [])],LEFT, PW, WIDTH,};@@ -61,11 +61,11 @@ try {const css = (k) => getComputedStyle(document.documentElement).getPropertyValue(k).trim();const load = (src) => new Promise((ok) => { if (!src) return ok(null); const i = new Image(); i.onload = () => ok(i); i.src = src; });Promise.all([load(D.strip && D.strip.src), load(D.spec), document.fonts.ready]).then(([strip, spec]) => {- const rows = [["picture", strip ? D.strip.h : 0], ["spectrogram", 240], ["waveform", 130], ["loudness", 210], ["onsets / hits / picture", 64]].filter((r) => r[1]);+ const rows = [["picture", strip ? D.strip.h : 0], ["spectrogram", 240], ["waveform", 130], ["loudness", 210], ["onsets / accents / picture", 64]].filter((r) => r[1]);const GAP = 14, H = rows.reduce((a, r) => a + r[1] + GAP, 0) + 40, cv = document.getElementById("c"); cv.width = D.WIDTH; cv.height = H;const g = cv.getContext("2d"), X = (t) => D.LEFT + (t / D.dur) * D.PW; let y = 4; const top = {};g.font = "500 12px Poppins, Arial, sans-serif"; g.textBaseline = "middle";- for (const [name, h] of rows) { top[name] = [y, h]; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText(name === "onsets / hits / picture" ? "onsets" : name, D.LEFT - 10, name === "onsets / hits / picture" ? y + h / 6 : y + h / 2); if (name === "spectrogram") { g.font = "10px Poppins, Arial, sans-serif"; g.fillText("log Hz", D.LEFT - 10, y + h / 2 + 16); g.font = "500 12px Poppins, Arial, sans-serif"; } g.strokeStyle = css("--line"); g.strokeRect(D.LEFT + 0.5, y + 0.5, D.PW - 1, h - 1); y += h + GAP; }+ for (const [name, h] of rows) { top[name] = [y, h]; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText(name === "onsets / accents / picture" ? "onsets" : name, D.LEFT - 10, name === "onsets / accents / picture" ? y + h / 6 : y + h / 2); if (name === "spectrogram") { g.font = "10px Poppins, Arial, sans-serif"; g.fillText("log Hz", D.LEFT - 10, y + h / 2 + 16); g.font = "500 12px Poppins, Arial, sans-serif"; } g.strokeStyle = css("--line"); g.strokeRect(D.LEFT + 0.5, y + 0.5, D.PW - 1, h - 1); y += h + GAP; }const bottom = y - GAP;// shading first, through every panel: holes, the dead tail, the silent startfor (const s of D.shade) { g.fillStyle = "rgba(192,57,43,0.13)"; g.fillRect(X(s.a), 4, Math.max(2, X(s.b) - X(s.a)), bottom - 4); g.fillStyle = css("--fail"); g.textAlign = "left"; g.fillText(s.label, Math.min(X(s.a) + 4, D.LEFT + D.PW - g.measureText(s.label).width), bottom + 12); }@@ -81,12 +81,12 @@ try {const curve = (pts, col, w) => { g.strokeStyle = col; g.lineWidth = w; g.beginPath(); let pen = false; for (const [tt, l] of pts) { if (!(l > -70)) { pen = false; continue; } pen ? g.lineTo(X(tt), Y(l)) : g.moveTo(X(tt), Y(l)); pen = true; } g.stroke(); g.lineWidth = 1; };curve(D.momentary, "rgba(44,110,155,0.55)", 1); curve(D.shortTerm, css("--ink"), 2);g.fillStyle = css("--ink"); g.textAlign = "left"; g.fillText("momentary (thin), short-term (thick), LUFS", D.LEFT + 6, t + 12); }- { const [t, h] = top["onsets / hits / picture"], third = h / 3;+ { const [t, h] = top["onsets / accents / picture"], third = h / 3;g.strokeStyle = css("--ink"); for (const o of D.onsets) { g.beginPath(); g.moveTo(X(o) + 0.5, t + 2); g.lineTo(X(o) + 0.5, t + third); g.stroke(); }- g.fillStyle = css("--accent"); for (const o of D.hits) { g.beginPath(); g.arc(X(o), t + third * 1.5, 4, 0, 7); g.fill(); }+ g.fillStyle = css("--accent"); for (const o of D.accents) { g.beginPath(); g.arc(X(o), t + third * 1.5, 4, 0, 7); g.fill(); }for (const e of D.events) { const miss = D.unanswered.includes(e); g.strokeStyle = miss ? css("--fail") : "#1e7d4f"; g.lineWidth = 2; g.beginPath(); g.moveTo(X(e), t + third * 2 + 2); g.lineTo(X(e), t + h - 2); g.stroke(); g.lineWidth = 1;g.strokeStyle = miss ? "rgba(192,57,43,0.35)" : "rgba(30,125,79,0.3)"; g.setLineDash([2, 3]); g.beginPath(); g.moveTo(X(e), 4); g.lineTo(X(e), t); g.stroke(); g.setLineDash([]); }- g.font = "10px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText("hits", D.LEFT - 10, t + third * 1.5); g.fillText("picture events", D.LEFT - 10, t + third * 2.5); }+ g.font = "10px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "right"; g.fillText("accents", D.LEFT - 10, t + third * 1.5); g.fillText("picture events", D.LEFT - 10, t + third * 2.5); }// the time axisg.font = "11px Poppins, Arial, sans-serif"; g.fillStyle = css("--ink"); g.textAlign = "center"; const step = D.dur > 40 ? 5 : D.dur > 12 ? 2 : 1;for (let s = 0; s <= D.dur + 1e-6; s += step) g.fillText(Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"), X(s), bottom + 28);diff --git a/skills/anidoodle/engine/tools/verify-export.mjs b/skills/anidoodle/engine/tools/verify-export.mjsindex 8422f01..b7624df 100644--- a/skills/anidoodle/engine/tools/verify-export.mjs+++ b/skills/anidoodle/engine/tools/verify-export.mjs@@ -144,7 +144,7 @@ if (isMp4) {if (!Number.isFinite(tp)) note("true peak unreadable from ffmpeg's ebur128", txt.split("\n").slice(-4).join(" "));else if (opt.delivery) {say(tp <= -1.0, `true peak after the encode ${tp.toFixed(2)} dBTP`, `ceiling -1 dBTP; integrated ${Number.isFinite(il) ? il.toFixed(1) : "?"} LUFS`);- // a film that plays quiet reads unfinished: -16 LUFS for gentle films, -14 for dense, a 1 LU window around each+ // a film that plays quiet reads unfinished: pass between -19 and -13 LUFS, warn from -17// -19 is the floor: a gentle score held under -16 by its own peaks (never compressed, by design) may sit near// -17.5; under -19 the film is simply quiet. Warn from -17 so the musical cure ("Peaks", music/README.md) is triedsay(Number.isFinite(il) && il >= -19 && il <= -13, `integrated loudness ${Number.isFinite(il) ? il.toFixed(1) : "?"} LUFS`, "-19..-13 (the delivery master puts gentle films at -16, dense at -14)");diff --git a/skills/anidoodle/references/craft-bar.md b/skills/anidoodle/references/craft-bar.mdindex b4021c5..d6f0ad9 100644--- a/skills/anidoodle/references/craft-bar.md+++ b/skills/anidoodle/references/craft-bar.md@@ -6,9 +6,9 @@ The test: would a proud human illustrator ship this, or is it mechanical shape-a|---|---|| A subject built from ellipses and capsules | Hand-placed control points over real anatomy || One style recoloured to look like another | The mark, the edge and the order of marks all change |-| Boxes and arrows standing for an idea | A real machine whose working IS the idea, many small parts, each with a job (`machines.md`) |-| A line that stops in the air; a texture cut dead mid-surface | Every line ends on something; a row of ribs or pins fades as the surface turns away |-| Parts floating off or sunk into each other | Every joint flush, tangent or seated, every part held; check the joints at 3x |+| Boxes and arrows standing for an idea | A real machine that does what the idea describes while you watch, built from many small parts that each have a job (`machines.md`) |+| A line that stops in the air; a texture cut dead mid-surface | Lines meet another line or an edge; a row of ribs or pins thins out where the surface turns away |+| Parts floating off or sunk into each other | Parts touch the way real ones do (bolted, resting, butted against), each held by something; zoom to 3x on the joints || Flat colour fields | Wash, then pattern wet-on-damp, then line; one named light; cast shadows || Every stroke the same weight and speed | Long strokes fast, fiddly ones slow, thick-thin, tapered || Even scatter, one flower stamped 200 times | Hand-placed drifts with bare rests; 4-5 authored views per species |@@ -25,9 +25,9 @@ The test: would a proud human illustrator ship this, or is it mechanical shape-a| Words laid over busy art, a face or the UI | Type gets its own frame by default; over the picture only as a composed label or kinetic line on a calm area (`workflows/launch-video.md`, Type) || A loop playing in place and called "alive" | Real travel through a world that changes as the subject moves || An unmatched hard cut or a sharp swoosh between scenes | A gentle move (a bloom, a flip, a push, the card grows into the frame), or a cut matched on shape, position or beat |-| Site art on its own white or cream while the page is another colour | `paper` is the page's exact colour; neutrals moved onto it, light and dark from one source (`workflows/site-art.md`) |-| A part, shadow or sheen creeping under the headline | The headline zone is empty, proved by `tools/placement.mjs` |-| A spinner drawn as still blades turning slowly | A sheen disc and fading trails (`spin`), so it reads as speed |+| Site art that brings its own background, so a pale box shows on a page of a different colour | `paper` is set to the page's exact colour and every neutral shifts to suit it; a light and a dark theme come out of the same code (`workflows/site-art.md`) |+| A part, a cast shadow or a highlight straying into the headline's space | Nothing is drawn in the headline zone, and `tools/placement.mjs` proves it |+| A spinner drawn as still blades turning slowly | Fainter copies of the blades, each a little further back, over a faint swept shape (`spin`), so it reads as speed |**No dead air** in anything that moves: something visibly changes in every second, from frame 0.Check it with the tool AND by eye: a creeping camera changes every pixel and satisfies the tooldiff --git a/skills/anidoodle/references/music/README.md b/skills/anidoodle/references/music/README.mdindex f0935ac..2276cae 100644--- a/skills/anidoodle/references/music/README.md+++ b/skills/anidoodle/references/music/README.md@@ -113,7 +113,7 @@ MusicPlan + notes (you write) -> perform -> instruments (one stem per part)Struck stems (plucks, plucked basses, piano, mallets and bells, timpani) first go through a transient-awaregain in the mix (only the pick or hammer spike above the note's own body comes down, up to 6 dB, the stem'slevel unchanged), so their attacks don't hold the master under the ceiling. `RenderOpts.gentleGlue` (a <= 1 dB- 2:1 bus glue) exists but is off by default: Alex's call. If the peak still blocks the gain, the loudness goes+ 2:1 bus glue) exists but is off by default. If the peak still blocks the gain, the loudness goesdown. The cure is musical (see "Peaks" below): a solo piano with a 10 LU range (the nocturne demo) masters at -17.5.- **Dense styles** (lofiElectronic, lofi, drive, house, synthwave, hipHop, rock, chiptune): **-14 LUFS** through a look-ahead true-peak limiter, then a static trim if an inter-sample peak still passes -1 dBTP.- **A film's whole mix** (score plus effects, or effects alone) goes through the delivery master last:@@ -131,11 +131,10 @@ The pack is a separate download (about 390 MB), not part of the skill. Once it iacoustic parts play recordings of real instruments and three rooms are recorded impulse responses.Without it every score still plays, on the modelled voices, unchanged.-Every stereo recording is made phone-safe when its bank loads (`RECORDING_WIDTH` in `sampler.ts`):-some were captured with spaced microphones whose sides cancel in the body of the sound (a marimba at--0.72 between 150 Hz and 2 kHz, one side's polarity flipped), so a side clearly inverted there is-flipped back and the body narrowed, while the air above 2 kHz keeps its width. On the cheetah score-this took the mids from -0.15 to 0.85 correlation and the mono-fold loss from 3.5 to 0.6 dB.+Every stereo recording is made phone-safe when its bank loads (`RECORDING_WIDTH` in `sampler.ts`): a+side whose body (150 Hz to 2 kHz) is clearly inverted is flipped back and the body is narrowed, while+the air above 2 kHz keeps its width, so a mono fold keeps the whole instrument.+```bashnode tools/soundfetch.mjs list # the install directory and what is installed; no networkdiff --git a/skills/anidoodle/references/music/sound-design.md b/skills/anidoodle/references/music/sound-design.mdindex 04df611..b3cafc4 100644--- a/skills/anidoodle/references/music/sound-design.md+++ b/skills/anidoodle/references/music/sound-design.md@@ -89,8 +89,8 @@ export const audio = filmSfx(filmAudio(score, 15), plan); // Film.audio: score## Levels and the audibility rule-A cue nobody hears is a bug, not a subtle choice. (The first effects PR sat 13-19 dB under its-music, and its test only checked that they existed.)+A cue nobody hears is a bug, not a subtle choice. A test that only checks a cue exists proves+nothing: test that it is heard over the music at its own moment.- Every cue is measured against the ducked score **at its own moment**. The yardstick isK-weighted (BS.1770) loudness over the cue's *speaking window*: the 10 ms frames within 10 dB of@@ -120,17 +120,17 @@ music, and its test only checked that they existed.)when it starts the groove and mud anywhere else.- Hear it in context before it ships. Render the kit page (`node tools/sfx.mjs kit <dir>`) and ademo over the real score, and check the audibility table.-- **The numbers that keep it designed.** About five effects per ten seconds. Hard cuts and cursor- drifts get nothing. About two whooshes a film, each starting 100-450 ms before the move and peaking- on its fastest frame. One riser, then 0.1-0.5 s of near silence, then the impact on the reveal frame,- the loudest moment of the film, 30-60% of the way in. One click voice for the whole UI: press, then- release 60-110 ms later, the same level every time. Typing at most about twelve keys a second.-- **Where a cue may land.** A hit's attack no earlier than 45 ms before its frame and its peak no- later than 75 ms after. A whoosh's loudest point within 45 ms of the move's fastest frame. A riser- ends between 250 ms before the hit and 30 ms after it. Later than these reads as lag; earlier reads- as a mistake.-- **The ending.** The music stops on a bar or filters down, 0.2-0.7 s of near silence, one soft note- in key, and its tail rings out to the last frame, 8-20 dB under the film's peak. Never a cut-off.+- **Restraint is the design.** A cue earns its place by marking something the viewer should feel: a+ press, an arrival, a landing, the reveal. Picture changes that are only edits stay silent. Count+ your cues against the film's length; if you cannot say what each one marks, cut it.+- **Land on the frame.** A hit belongs on the frame where the thing happens; within a frame either+ side reads as one event. A soft lead into the hit reads as anticipation. A sound after its picture+ reads as lag, which is the one error a viewer always notices.+- **One voice per job.** Every press of every button is the same click, at the same level, so the UI+ feels like one object. Variety goes to the story moments, not to repeats of the same action.+- **The ending breathes.** The music settles on the tonic or lets its last chord ring, a beat of+ near silence before the final mark if the film has one, and the tail rings out to the last frame.+ Never a cut-off, never dead air after it.## The finished mix@@ -144,36 +144,36 @@ What the whole film's sound must be before it ships, score and effects together:- **Never digital silence.** An effects-only film sits on room tone 22 dB under its cues (`bed`), nearlymono so a phone keeps it, from the first frame to the last.- **A finished shape.** Sound from the first frame (within 0.5 s), no hole over 0.25 s, the last sound- within 0.5 s of the last frame. A silence the film means (a stop-down, a held breath) is declared in+ within 0.5 s of the last frame. A silence the film means (a held breath, a pause on a beat) is declared in`meta.quiet` as `[fromFrame, toFrame, reason]`. `verify-export --delivery` fails the shape, a truepeak over -1 dBTP after the encode, and loudness under -19 LUFS; it warns from -17.-- **Fix one thing at a time, with one fixer.** Read the film through separate lenses (sync, edges and- clicks, masking, tone, the director's arc), each proposing its fix as a variant it has measured.- Then one fixer merges them and re-runs every check, and a fix that breaks another lens is dropped.- Lenses that each edit the mix fight: a tonal cut at 2-6 kHz undoes the masking lens's raised hit.+## Checking the finished film's sound-You cannot hear the film, so measure the delivered mix before anyone listens. Two tools read the-rendered file (a film name means `out/<name>.mp4`; a `.wav` or `.m4a` works too):+Before the film goes to anyone, put numbers on the mix that was actually delivered. Two tools take+the rendered file and do it (give a film name for `out/<name>.mp4`, or point at a `.wav` or `.m4a`):```node tools/soundcheck.mjs <film|file> # the scorecard; exit 1 on any FAILnode tools/soundcheck.mjs <film> --json --out x.json # the same, as data-node tools/soundcheck.mjs <film> --allow 3.1:3.6 # a hole there is a declared stop-down+node tools/soundcheck.mjs <film> --allow 3.1:3.6 # the silence there is a declared held breathnode tools/soundsheet.mjs <film> -o out/<film>-sound.png # one picture of it all```-`soundcheck` prints a status for every metric (PASS, WARN, FAIL against a range, or INFO), then a-**FIX FIRST** list in the order that matters, each with its time and the concrete fix: "3.4 s hole-at 0:03.4", "boxy: cut 500-790 Hz by 2-3 dB", "mids decorrelated: narrow the stereo width below-2 kHz". It measures:+Each metric in `soundcheck` gets a status line: PASS, WARN or FAIL when it has a range, INFO when+it is only reported. Under them comes **START HERE**, the changes to make ranked by importance, and+every one is specific about where and what: "3.4 s hole at 0:03.4", "crowded body, strongest near+630 Hz: notch it a couple of dB", "mids decorrelated: narrow the stereo width below 2 kHz". The+numbers fall into five groups:- level: integrated LUFS, true peak, loudness range, loudest 3 s, intro and end level, an11-point arc, the loudest moment;-- shape: first sound, holes inside the film, dead air at the end, fade, the final moment, a cut- ending, onsets, salient hits, stop-downs;-- spectrum: six band shares (sub 20-60 Hz up to air 8-16 kHz) and the centroid;+- shape: when the first sound arrives, any holes mid-film, dead air after the last sound, the fade,+ the closing moment, an ending that cuts off, how many onsets and accents (sudden jumps in level)+ there are per second, and held breaths (short dips that come straight back);+- spectrum: how the energy splits across five bands (rumble, warmth, body, bite and sparkle,+ 20 Hz to 16 kHz), plus the centroid;- stereo: side vs mid, L/R correlation overall and per band (150 Hz-2 kHz is where phones combthe body away), and how much more than the expected 3 dB the mix loses folded to mono;- picture (any file with video): frame-difference events, the share with an onset within 100 ms@@ -183,17 +183,19 @@ at 0:03.4", "boxy: cut 500-790 Hz by 2-3 dB", "mids decorrelated: narrow the steThe built-in ranges are for drawing films: -16 to -13 LUFS (web target -14, gentle films -16),true peak at or under -1 dBTP, LRA at most 9 LU, sound by 0.5 s, no hole over 0.25 s, at most0.5 s of silence at the end, 150 Hz-2 kHz correlation at least 0.3, at most 1.5 dB of extra mono-loss, and the sub at or under -6 dB of the energy.+loss, and the rumble (under 80 Hz) at or under -5 dB of the energy.-To grade against films the user loves, build a profile from them:+When the user has films whose sound they love, score against those instead:`node tools/soundcheck.mjs profile <films...> -o references/music/sound-profile.json`, then pass-`--profile references/music/sound-profile.json`. A profile moves the taste ranges (loudness,-bands, width); the delivery limits (true peak, first sound, holes, end silence, mono loss) stay.--`soundsheet` draws a frame strip, the spectrogram, the waveform, momentary and short-term-loudness against the integrated level and -14, onset ticks, hits and picture events (red when no-sound answers them), with every hole and the dead tail shaded. Read it before handing the film-over: the hole, the dead tail and a late hit are visible in it.+`--profile references/music/sound-profile.json`. The profile shifts the ranges that are a matter+of taste (loudness, bands, width). The ranges a delivery must meet (true peak, first sound, holes,+end silence, mono loss) do not move.++`soundsheet` lays the whole soundtrack out on one timeline, top to bottom: a strip of frames, the+spectrogram, the waveform, momentary and short-term loudness with the integrated level and -14+marked, then rows of onsets, accents and picture events (a picture event turns red when no sound+lands on it). Holes and dead air at the end are shaded. Look at it before handing the film over;+a gap, a silent ending or a late accent is obvious on the page.The metrics live in `engine/src/canvas-core/music/soundcheck.ts`, tested on synthetic faults in`engine/test/soundcheck.test.ts`.diff --git a/skills/anidoodle/references/workflows/interactive.md b/skills/anidoodle/references/workflows/interactive.mdindex f5a3041..10f74dd 100644--- a/skills/anidoodle/references/workflows/interactive.md+++ b/skills/anidoodle/references/workflows/interactive.md@@ -125,10 +125,11 @@ readback, so hashed pages run with `window.__ANI_RASTER__ = "cpu"` from the star| Form mascot | 22/22 | 3.5 ms / 0.3 ms (2.2 on an earlier run) | 2.0 s | 152, 31 MB at scale 1.25 | 51 KB (20 KB gzip) || Scroll hero | 22/22 | 1.8 ms / 0.4 ms | 2.0 s | 4 stages + one patch per stroke, 34 MB at 1.25, 58 MB at 2 | 48 KB (19 KB gzip) |-The budget was 6 ms p95 at DPR 2. The first build measured 7.8 ms, because the head rotated ten face-sprites a frame and the paper multiplied the full canvas every frame. Composing the head once and-baking the paper into the sprites brought it to 2-4 ms (it varies by run on a shared machine). Single frames reach 10-22 ms when a-reaction first needs a cel, or during a rescale swap.+The budget is 6 ms p95 at DPR 2. To stay inside it, compose a multi-part head into one sprite+instead of rotating each face sprite every frame, and bake the paper texture into the sprites rather+than multiplying it over the whole canvas each frame; the demos above run at 2-4 ms that way (it+varies by run on a shared machine). Single frames reach 10-22 ms when a reaction first needs a cel,+or during a rescale swap.## Limitsdiff --git a/skills/anidoodle/references/workflows/machines.md b/skills/anidoodle/references/workflows/machines.mdindex 26db3d1..24c7947 100644--- a/skills/anidoodle/references/workflows/machines.md+++ b/skills/anidoodle/references/workflows/machines.md@@ -7,34 +7,42 @@ Worked example: `mechanism.ts` (the 18-note movement), `mechanismHands.ts`, `mec## 1. Turn the idea into a machine-1. **State the truth.** Ledger the concept's real quantities: counts, sizes, rates, limits (`explainer.md`).-2. **Find its verbs** (fills, waits, matches, rejects, decays) and **its nouns with quantities**.-3. **Find a physical mechanism that performs those verbs on those nouns**, one a general reader can- name: a lock for "every condition must match", drawers sized by bytes, a sluice for a queue.-4. **Say it in one sentence:** "X moves, and its motion means Y." If you cannot, the mapping is wrong.-5. **Give every part a meaning**, and mark where the metaphor stops being literal.-6. **Pick the one part to watch.** It alone gets the accent (`accent: true` on its material).-7. **Add an instrument that reads the quantity** (a dial, a ruler, a counter, a readout corner).-8. **Choose the view** so the mechanism faces the viewer: `Cam.fit(A, E, points, box)`, A 35 to 60.--Two failures, one fix: too abstract (floating slabs, labelled boxes) or too flat (one big plate-with a few lines). Fix both with a recognisable machine of many small, purposeful parts.+1. **Get the facts first.** The idea's real quantities: how many, how big, how fast, the limits (`explainer.md`).+2. **Name what happens** to what: the actions (fills, waits, matches, rejects, decays) and the things they act on.+3. **Find a made object that does those actions,** one a general reader recognises: a turnstile for+ "one at a time", a sieve for a filter, a ratchet for "only forward", a sluice for a queue.+4. **Test the match aloud:** describe the machine running, then the idea; if the two descriptions do+ not line up step for step, pick another object.+5. **Every part means something,** and say where the comparison stops being literal.+6. **One part carries the story.** It alone gets the accent (`accent: true` on its material).+7. **Show the number:** a dial, a ruler, a counter or the readout corner reads the quantity live.+8. **Turn it to face the viewer:** `Cam.fit(A, E, points, box)`. The music box sits at an azimuth of+ 36; most machines look right somewhere between a third and two thirds of a right angle.++The machine has to be something a person could name, with every part doing work. Labelled blocks+hanging in space give the viewer nothing to name, and a big bare panel with a scratch or two of+detail looks like a drawing someone stopped halfway through.## 2. Parts list before geometry-Write the parts by group: base (plate, feet, screws, label, ruler), structure (posts, bridges,-rails, stops), mechanism, controls (crank, knob), and the subject. Every part rests on another-and has a job. A figure is 40 to 80 parts; a hero 80 to 150; past that, propose a smaller version-that keeps the core. Detail comes from structure (a boss under a shaft, holes in a bedplate, a-stop lever), never from texture noise. A bare face or an empty corner is unfinished, not calm.+Write the inventory first, working from the ground up: the bench or feet it rests on, the frame+that carries the motion, the moving parts, the handles and knobs a person would reach for, and+finally the one part the story is about. Nothing floats and nothing is idle: each part rests on+something and earns its place. For scale, the music box runs to 68 parts and spans about 62 percent+of its card. If your machine wants far more than that, build a cut-down version that keeps the+heart of it. Richness should come from construction (a boss where a shaft meets a plate, a row of+drilled holes, a stop lever), not from a pattern painted over the surface. When a face looks empty,+ask what real part belongs there.## 3. One model drives everything-The film's moving parts, the readout and any caption all read one pure model of `(frame)` or of-the input state. In the music box, `play(rot)` places the pins, bends the teeth and names the pin,-the tooth and the pitch in the readout; nothing is typed twice. Read words from where parts ARE-(the readout says "TAKING APART" while any spring is moving), and build counts from the list that-draws them ("8 ASSEMBLIES APART" is `PLAN.order.length`).+Everything that moves, the readout and every caption are computed from a single function of+`(frame)`, or of the input state in an interactive piece, with no side effects. In the music box,+`play(rot)` places the pins and bends the teeth, and the same call names the pin, the tooth and the+pitch for the readout, so nothing is typed twice. Take words from the live state, never from a+script running beside it: the readout names the pin that just struck because it works that out from+the drum angle, not because a timed caption says so. Counts come from the list that draws the parts+("8 ASSEMBLIES OUT" is `PLAN.order.length`).## 4. Build with the kit@@ -48,11 +56,11 @@ draws them ("8 ASSEMBLIES APART" is `PLAN.order.length`).| Screws, pins, ticks, ribs that fade as they turn away | `screw`, `facingAt` + `smooth` for alpha || Many parts in the right order | `paintAll(items)`; each item has `at`, `bias`, `ride` (its assembly) || An exploded view | `ExplodePlan` + `sharesAt(plan, cues, t)`: staggered out, last-out first-home, reversals cancel pending moves |-| A frame in a card with four corners (figure, title, hint, live readout) | `card` |+| A card that frames the figure and gives each corner a job: the title, a hint, the live readout | `card` |Rules that keep it clean: split a part that wraps another (back half, inner, front half); everypart is held by something; explode real assemblies along their true direction, the outside ones-first; draw a chain line along each path of travel; fit the figure to 55 to 65 percent of the card.+first; draw a chain line along each path of travel; leave the card a generous margin round the figure.## 5. Draw it in a style: the hand@@ -78,15 +86,17 @@ Two films, not one: the making (`kind: "drawing"`, each part inked then toned inwith `setReveal(ink, tone, paper)`, then the words) and the run (`kind: "explainer"`: play close onthe part to watch, explode, tour, home). One film holding both fails the dead-air gate, because abuild's slow strokes are measured against an explainer's floor. While apart, let each assembly-breathe a little along its own path, out of step with the others, so the tour never freezes. An interactive piece (`interactive.md`): one-spring per assembly with `zeta` 0.8 to 0.9 so parts land with weight, outer ones faster; a fixed+breathe a little along its own path, out of step with the others, so the tour never freezes. An interactive piece (`interactive.md`): each+assembly rides its own spring, damped with `zeta` 0.8 to 0.9 so it settles with weight, and the+outer assemblies get the quicker springs; a fixedcamera so the card and the bench bake once; the part nearest the pointer lights and the readoutsays what it does; reduced motion holds the drum still.## 7. Check itRender at `--scale 2` or 3 and crop every joint (flange, bridge, crank, wire end, tooth tips); the-fault list, in order: a line that stops in the air, a part sunk into or floating off another, a-nearer part drawn behind, a texture cut at full strength mid-surface, a doubled edge. Then+things to hunt for: a part painted behind something it should sit in front of; two parts that+overlap or hang apart where they should touch; a stroke that ends on nothing; an edge drawn twice;+a pattern that stops abruptly in the middle of a face instead of fading. Then`node tools/test.mjs mechanism` and, for a page, `emit-interactive.mjs` and `replay.mjs` (22 checks,including 6 ms a frame at DPR 2). Measured, not assumed: say which of these you ran.diff --git a/skills/anidoodle/references/workflows/site-art.md b/skills/anidoodle/references/workflows/site-art.mdindex bf075dc..1391311 100644--- a/skills/anidoodle/references/workflows/site-art.md+++ b/skills/anidoodle/references/workflows/site-art.md@@ -1,96 +1,99 @@# Site art: a picture that works on someone's page-A hero beside a headline, a feature tile, a row of spots, a share card. The picture no longer owns its-canvas: a headline does, a page colour does, a brand does. Kit: `engine/src/canvas-core/assetKit.ts`.-Worked example: `siteHero.ts` (light page) and `siteHeroDark.ts` (dark page), one source.+A hero beside a headline, a feature card, a row of icons, a link preview. The picture no longer owns+its canvas: the page's words, colour and brand come first, and the art is drawn to live among them.+Kit: `engine/src/canvas-core/assetKit.ts`. Worked example: `siteHero.ts` (a light page) and+`siteHeroDark.ts` (a dark one), both drawn by the same code.-## 1. The brief, before any drawing+## 1. Start from the page, not the picture-Write five lines, from the request or as defaults you say out loud:+Before choosing a subject, write down what the page already decides:-1. **Where it goes:** product, page, section, shown size, what sits beside it.-2. **The one thing it says:** a promise ("ships in a minute"), a feeling ("unhurried"), or a fact ("works offline").-3. **Who looks:** engineers read instruments and machines; a family app wants warm, soft, homely things.-4. **The page:** its exact colour, light or dark or both, and the brand colours.-5. **The style:** any of the 32. Style is free; craft is not.+1. **The slot:** which section, what sits beside or above the art, the size it is shown at.+2. **The page colour,** exactly, and whether the site also has a dark theme.+3. **The brand colour,** as one hex, and any material the brand is known for (walnut, brass, matte black).+4. **The sentence the art must back up:** usually the headline next to it.+5. **The style:** any of the 32. The page constrains placement and colour, never the medium.-## 2. One real object that says it+## 2. Pick an object that does what the product does-Three kinds, and write one concept of each before choosing:+Read the sentence from step 1 and ask what the product *does*, as a verb: sorts, connects, protects,+repeats, measures. Then find a made object that performs that verb visibly, and build it as a machine+(`machines.md`), so its working carries the message without a caption. Put two or three candidates+to the user, a line each, name the one you favour and the reason, and go ahead with it unless they+pick another. When the user has already named the object, skip straight to building it.-- **Literal:** the product as a fine object (a camera for a photo app).-- **Metaphor:** a real thing whose working is the promise. Software has no body, so this is usually the strongest.-- **Scene:** a small world on a tray or a shelf, one hero object among a few supporting ones. Good for wide heroes and for sets.--Choose with five quick tests: **glance** (named in a second at its shown size), **promise** (its working says-it, no caption), **parts** (fifty real parts, not a smooth blob), **page** (its silhouette suits the slot:-wide and low beside a headline, tall in a column), **brand** (material and era match the mood). Say which-you pick and why in one line, then build it. If the user already named the object, skip the round.--| The promise | A thing that does it |+| What the page promises | A made thing that shows it ||---|---|-| Nothing gets lost | A post-office sorting frame, every letter in its slot, one being placed |-| Fast setup | A flat-pack chair half assembled, the last dowel going in |-| Team chat | A switchboard, one cable mid-plug, a lamp lit |-| Privacy | A letterbox with a combination dial, its flap shut |-| Automation | A marble run: one marble on the track, the next waiting at the gate |-| Insights | A weather station: anemometer turning, barometer needle, a logbook |-| Translation | A typewriter with two type baskets, one key mid-strike |-| Savings | A coin sorter with tubes by size, one coin rolling down the ramp |-| Learning | A desk globe on a brass meridian, a pin in one city |-| Music | A cylinder music box, the drum turning, the governor a blur |--## 3. The moment--A picture shown once gets one place for the eye: a drawer half out, a key mid-strike, a lamp lit, a-coin in the slot. Exactly one, carried by the accent, about a third of the way into the art region on-the side nearest the text (`strongPoint`). If the accent lands on structure, the eye lands on structure.+| keeps everything findable | A post-office sorting frame, every letter in its slot, one being placed |+| sets up in minutes | A flat-pack chair half assembled, the last dowel going in |+| connects a team | A switchboard, one cable mid-plug, a lamp lit |+| keeps things private | A letterbox with a combination dial, its flap shut |+| automates a chain of steps | A marble run: one marble on the track, the next waiting at the gate |+| turns data into insight | A weather station: anemometer turning, barometer needle, a logbook |+| translates | A typewriter with two type baskets, one key mid-strike |+| grows savings | A coin sorter with tubes by size, one coin rolling down the ramp |+| teaches | A desk globe on a brass meridian, a pin in one city |+| makes music | A cylinder music box, the drum turning, the governor a blur |++Hold the object's outline up to the space it will fill. Art beside the words suits a broad shape,+art under the words suits a low, stretched one, and an icon wants a single tight thing.++## 3. One place for the eye++Choose the single part that shows the verb happening (the letter going into its slot, the dowel+going in) and give it the accent material (`accent: true`). `strongPoint(p)` gives a good spot for+it: a third of the way in, leaning toward the words, or centred when the words sit above.## 4. Placement-`PLACEMENTS` holds the canvas, the art region and the headline zone for each slot (heroRight, heroLeft,-heroCentre, art, tile, spot, banner, social, slide). `Cam.fit(A, E, points, fitBox(p))` fits the object-into its region; pass every extreme point, lifted parts included. The object leads toward the text: pick-the azimuth that turns its long face and its moment that way. Nothing enters the headline zone, not a-shadow, not a sheen; prove it with `node tools/placement.mjs still.png --W <meta.W> --safe x,y,w,h`.-Keep a few units of air at every edge the object does not deliberately bleed off.--## 5. Page colour, light and dark--`setPalette(pagePalette({ paper, accent, colours, tint }))` moves every material onto the page: on a-light page the neutrals shift by the page's difference in lightness and, by `tint`, its colour cast; on-a dark page the parts sit just above the page, the lit top lightest, the lines lighter than the faces.-The fill colour of the page and of `paper` must be identical, or every part shows a pale halo. A site-with both themes gets both films from one source (`heroOn(title, paper, accent)`).--## 6. Brand colour--`accent: "#hex"` puts the brand on the part to watch (`accent: true`); `colours: { wood: "#7a5536" }`-recolours any material by name, which is also how brass, walnut or ebony are made. Mode **body** makes-the part of the colour (a five-step ramp in its own hue, lightness set so four tones read and nothing-glares on dark). Mode **ink** keeps the part neutral and colours only its lines and dots (an LED, a-pointer, an engraved mark). Default to one brand family: the subject in body, one or two small echoes.-Colour the moment, never the base or the biggest faces, unless the product is that colour.--## 7. Motion is the object working--Loop one full cycle of the machine so it repeats without a seam. Anything that would turn in life turns;-fast spinners get `spin(angle, sweep, draw, { disc })`, a sheen disc and fading trails, because bare blades-read as a paper cut-out. At most three or four kinds of motion, out of step. Beside a headline, calm wins:-if the real machine moves little, declare it with a `meta.holds` reason instead of inventing motion. Frame 0-is what a reduced-motion visitor sees, so compose it as the hero frame.--## 8. Sets and small sizes--Spots in a row share one family of parts (the same screws, feet, bevels, label plates) and similar-weight: add parts to the sparse one, never strip the dense one. Under about 320 px cut detail instead of-shrinking it: bigger screws, fewer ticks, no knurls. Check every piece at its shown size and at 390 px-wide (`placement.mjs --phone out.png`), and look.--| Mood | Shape and parts | Colour |-|---|---|---|-| Precise | Thin plates, fine bevels, rulers, many small screws | Greys and one sharp accent |-| Friendly | Big radii, chunky buttons, rubber feet, few large screws | Warm page, a soft accent on the body |-| Crafted | Wood cheeks, brass fittings, label plates, hinges | Cream page, a deep accent |-| Calm | Few objects with air between, low heights, one slow motion | Low contrast, a muted accent |-| Launch | A diagonal, something lifted or in flight | The accent on the moving thing |+`PLACEMENTS` holds a canvas, an art region and, where there are words, a headline zone for each slot:+heroSide, heroSideLeft, heroStack, art, card, icon, strip, social, slide. Fit the object into its+region with `Cam.fit(A, E, points, fitBox(p))`. Give it every point that could stick out, a raised+or exploded part included, or the fit will crop it. Swing the azimuth until the side where the work+happens looks toward the words. Nothing at all is drawn inside the headline zone, and that includes+a cast shadow or a soft highlight. Check it on a rendered still:+`node tools/placement.mjs still.png --W <meta.W> --safe x,y,w,h`.++## 5. The page's colour, light and dark++`setPalette(pagePalette({ paper, accent, colours, tint }))` carries every material over to the page,+so the machine belongs to it. On a light page each neutral shifts by however much lighter or darker+the page is than the kit's cream, and `tint` (0 to 1) decides how much of the page's hue the greys+pick up as well. On a dark page the parts rise only a little above the page: the lit tops are the+lightest thing, and lines are drawn lighter than the faces they edge. Paint the background in+`paper` and nothing else; a near miss draws a pale rim round every part. A site with a light and a+dark theme gets both pictures from the same code, through `heroOn(title, paper, accent)`.++## 6. The brand's colour++`accent: "#hex"` colours the part from step 3. `colours: { wood: "#7a5536" }` recolours any+material by name, which is also how a brand's signature material is made. Two modes:++- **solid** (default): the whole part takes the brand colour. Its five shades all keep that hue,+ and their lightness is held in a range where each shade is still told apart from the next and+ none of them burns too bright against a dark background;+- **lines**: the faces keep their neutral greys and the colour goes only into the strokes and dots,+ which suits a pointer, a gauge needle or an engraved mark.++Put the brand on the part from step 3, and at most once more somewhere small. A brand colour that+also covers the base and the large panels no longer tells the eye where to go.++## 7. Let it move the way it works++Loop one whole cycle of the machine so it repeats without a seam. Animate the parts the real thing+would move, and nothing else. A part that turns too fast to see clearly gets+`spin(angle, sweep, draw, { swept })`: fainter copies of the blades, each a little further back,+over a faint swept shape, so the eye reads speed rather than slow turning. Next to a headline,+quiet is better: when the real machine barely moves, say so with a `meta.holds` reason instead of+inventing movement. A visitor who asks for reduced motion sees frame 0 and nothing more, so build+frame 0 as a finished picture in its own right.++## 8. Families of pictures, and tiny ones++When several pictures will sit together (a row of cards, a strip of icons), build them all from the+same bin of parts: one screw, one foot, one edge bevel, one camera angle, one accent. Then they+look like siblings. Compare how busy each one is and bring the emptiest up to the others, not the+fullest down. At icon size, use fewer parts and make each one bigger, and leave out fine ticks+altogether. Render each picture at the size the page will actually show it, and again at phone+width (`placement.mjs --phone out.png`), and look at both.