// THE INTRO, PLAYABLE (intro-play.spec.ts, lane intro-play): the Play cut (play-cut-fixture.mjs) opening on a // title-card intro -- the project's title and its date (`generatedOn` 2026-10-29) over the brand -- with a sound of // the project's own (intro.wav: a 4.2 s tone written here, so the stand-in, which is not in git, is never needed), // and a whole-cut version v1 (a made take, its patch empty) whose intro the spec switches off and on. // // The spec WRITES (the intro's title, v1's patch): this fixture is its own. // // Synthetic, like every fixture. import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import path from "node:path"; /** A mono 16-bit PCM WAV of `seconds` of a quiet 440 Hz tone. */ export function toneWav(seconds, rate = 8000) { const n = Math.round(seconds * rate); const data = Buffer.alloc(n * 2); for (let i = 0; i < n; i++) data.writeInt16LE(Math.round(Math.sin((2 * Math.PI * 440 * i) / rate) * 3000), i * 2); const h = Buffer.alloc(44); h.write("RIFF", 0); h.writeUInt32LE(36 + data.length, 4); h.write("WAVE", 8); h.write("fmt ", 12); h.writeUInt32LE(16, 16); h.writeUInt16LE(1, 20); h.writeUInt16LE(1, 22); h.writeUInt32LE(rate, 24); h.writeUInt32LE(rate * 2, 28); h.writeUInt16LE(2, 32); h.writeUInt16LE(16, 34); h.write("data", 36); h.writeUInt32LE(data.length, 40); return Buffer.concat([h, data]); } /** @param {{ reports: string, deckManifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o */ export function makeIntroPlayFixture({ reports, deckManifest, cachedWindow, makePlayCutFixture }) { // The tally's word fitted to its cell (play-teaser-fixture's): the deck composes, so Play shows the deck hiding over the intro. const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: "intro-play-fixture", title: "The Intro Play Fixture", chrome: { factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } } }, }); const file = path.join(dir, "video.manifest.json"); const m = JSON.parse(readFileSync(file, "utf8")); m.generatedOn = "2026-10-29"; m.render.intro = { style: "title-card", sound: "intro.wav" }; const text = JSON.stringify(m, null, 2) + "\n"; writeFileSync(file, text); writeFileSync(path.join(dir, "intro.wav"), toneWav(4.2)); // A whole-cut version, made: its patch empty, so it opens on the cut's intro until the spec says otherwise. mkdirSync(path.join(dir, "takes", "v1"), { recursive: true }); writeFileSync( path.join(dir, "takes", "v1", "take.json"), JSON.stringify({ id: "v1", group: "takes", order: 2, label: "Version 1", kind: "different", preview: "preview.mp4", window: "full", style: null, patch: {}, seconds: 12, builtAt: "2026-11-01T10:00:00.000Z" }, null, 2) + "\n", ); writeFileSync(path.join(dir, "takes", "v1", "video.manifest.json"), text); return { dir }; }