@olegkoval/agent-skills 1.60.0 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +2 -0
- package/.github/prompts/carousel-maker.prompt.md +102 -0
- package/.github/prompts/shorts-animator.prompt.md +103 -0
- package/.kiro/steering/carousel-maker.md +101 -0
- package/.kiro/steering/shorts-animator.md +102 -0
- package/.windsurf/rules/carousel-maker.md +100 -0
- package/.windsurf/rules/shorts-animator.md +101 -0
- package/README.md +4 -2
- package/adapters/claude/olko-creative/skills/carousel-maker/SKILL.md +112 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/cm.ts +220 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/domain/check.ts +68 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/domain/layout.ts +75 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/domain/schema.ts +54 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/domain/types.ts +33 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/edge/io.ts +87 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/package.json +4 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/test/domain.test.ts +99 -0
- package/adapters/claude/olko-creative/skills/carousel-maker/scripts/tsconfig.json +16 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/SKILL.md +113 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/references/kit.md +59 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/references/looks.md +32 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/references/writing.md +9 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/audio/compose.ts +290 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/audio/dsp.ts +193 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/audio/instruments.ts +185 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/audio/master.ts +55 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/audio/soundtrack.ts +119 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/captions.ts +35 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/check.ts +96 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/look.ts +26 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/patch.ts +38 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/schema.ts +81 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/timeline.ts +75 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/domain/types.ts +91 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/chrome.ts +169 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/doctor.ts +52 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/media.ts +105 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/page.ts +53 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/probe.ts +75 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/sound.ts +46 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/edge/voice.ts +183 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/looks/gouache.json +7 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/looks/ink.json +6 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/looks/oil.json +7 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/looks/pastel.json +7 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/looks/watercolor.json +6 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/package.json +4 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/runtime/globals.d.ts +199 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/runtime/kit.ts +856 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/runtime/paint.ts +268 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/runtime/stage.ts +181 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/runtime/tsconfig.json +12 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/sa.ts +262 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/test/domain.test.ts +107 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/tsconfig.json +16 -0
- package/adapters/claude/olko-creative/skills/shorts-animator/scripts/tts.py +20 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +30 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/context-gathering.md +3 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/finding-state.mjs +207 -0
- package/adapters/codex/olko-creative/README.md +2 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/SKILL.md +112 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/cm.ts +220 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/domain/check.ts +68 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/domain/layout.ts +75 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/domain/schema.ts +54 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/domain/types.ts +33 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/edge/io.ts +87 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/package.json +4 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/test/domain.test.ts +99 -0
- package/adapters/cursor/olko-creative/skills/carousel-maker/scripts/tsconfig.json +16 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/SKILL.md +113 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/references/kit.md +59 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/references/looks.md +32 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/references/writing.md +9 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/audio/compose.ts +290 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/audio/dsp.ts +193 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/audio/instruments.ts +185 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/audio/master.ts +55 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/audio/soundtrack.ts +119 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/captions.ts +35 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/check.ts +96 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/look.ts +26 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/patch.ts +38 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/schema.ts +81 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/timeline.ts +75 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/domain/types.ts +91 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/chrome.ts +169 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/doctor.ts +52 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/media.ts +105 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/page.ts +53 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/probe.ts +75 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/sound.ts +46 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/edge/voice.ts +183 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/looks/gouache.json +7 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/looks/ink.json +6 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/looks/oil.json +7 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/looks/pastel.json +7 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/looks/watercolor.json +6 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/package.json +4 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/runtime/globals.d.ts +199 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/runtime/kit.ts +856 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/runtime/paint.ts +268 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/runtime/stage.ts +181 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/runtime/tsconfig.json +12 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/sa.ts +262 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/test/domain.test.ts +107 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/tsconfig.json +16 -0
- package/adapters/cursor/olko-creative/skills/shorts-animator/scripts/tts.py +20 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/SKILL.md +112 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/cm.ts +220 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/domain/check.ts +68 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/domain/layout.ts +75 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/domain/schema.ts +54 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/domain/types.ts +33 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/edge/io.ts +87 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/package.json +4 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/test/domain.test.ts +99 -0
- package/adapters/grok/olko-creative/skills/carousel-maker/scripts/tsconfig.json +16 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/SKILL.md +113 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/references/kit.md +59 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/references/looks.md +32 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/references/writing.md +9 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/audio/compose.ts +290 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/audio/dsp.ts +193 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/audio/instruments.ts +185 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/audio/master.ts +55 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/audio/soundtrack.ts +119 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/captions.ts +35 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/check.ts +96 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/look.ts +26 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/patch.ts +38 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/schema.ts +81 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/timeline.ts +75 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/domain/types.ts +91 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/chrome.ts +169 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/doctor.ts +52 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/media.ts +105 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/page.ts +53 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/probe.ts +75 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/sound.ts +46 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/edge/voice.ts +183 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/looks/gouache.json +7 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/looks/ink.json +6 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/looks/oil.json +7 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/looks/pastel.json +7 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/looks/watercolor.json +6 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/package.json +4 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/runtime/globals.d.ts +199 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/runtime/kit.ts +856 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/runtime/paint.ts +268 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/runtime/stage.ts +181 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/runtime/tsconfig.json +12 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/sa.ts +262 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/test/domain.test.ts +107 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/tsconfig.json +16 -0
- package/adapters/grok/olko-creative/skills/shorts-animator/scripts/tts.py +20 -0
- package/adapters/hermes/olko-creative/README.md +2 -0
- package/catalog/skills.json +46 -0
- package/package.json +1 -1
- package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-creative/skills/carousel-maker/SKILL.md +111 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/cm.ts +220 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/domain/check.ts +68 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/domain/layout.ts +75 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/domain/schema.ts +54 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/domain/types.ts +33 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/edge/io.ts +87 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/package.json +4 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/test/domain.test.ts +99 -0
- package/plugins/olko-creative/skills/carousel-maker/scripts/tsconfig.json +16 -0
- package/plugins/olko-creative/skills/shorts-animator/SKILL.md +112 -0
- package/plugins/olko-creative/skills/shorts-animator/references/kit.md +59 -0
- package/plugins/olko-creative/skills/shorts-animator/references/looks.md +32 -0
- package/plugins/olko-creative/skills/shorts-animator/references/writing.md +9 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/audio/compose.ts +290 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/audio/dsp.ts +193 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/audio/instruments.ts +185 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/audio/master.ts +55 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/audio/soundtrack.ts +119 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/captions.ts +35 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/check.ts +96 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/look.ts +26 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/patch.ts +38 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/schema.ts +81 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/timeline.ts +75 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/domain/types.ts +91 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/chrome.ts +169 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/doctor.ts +52 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/media.ts +105 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/page.ts +53 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/probe.ts +75 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/sound.ts +46 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/edge/voice.ts +183 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/looks/gouache.json +7 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/looks/ink.json +6 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/looks/oil.json +7 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/looks/pastel.json +7 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/looks/watercolor.json +6 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/package.json +4 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/runtime/globals.d.ts +199 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/runtime/kit.ts +856 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/runtime/paint.ts +268 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/runtime/stage.ts +181 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/runtime/tsconfig.json +12 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/sa.ts +262 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/test/domain.test.ts +107 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/tsconfig.json +16 -0
- package/plugins/olko-creative/skills/shorts-animator/scripts/tts.py +20 -0
- package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +30 -0
- package/plugins/olko-github-pr/skills/lekker-review/references/context-gathering.md +3 -0
- package/plugins/olko-github-pr/skills/lekker-review/scripts/finding-state.mjs +207 -0
- package/plugins/olko-github-pr/skills/lekker-review/workflow.js +46 -3
- package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
- package/scripts/lib/catalog.mjs +2 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Voiced to sound played, not like a ringtone: electric piano, felt plucks, warm pads, a round sub and
|
|
2
|
+
// soft drums, all in the low and middle register. Nothing melodic sits above about B4, no bare sine or
|
|
3
|
+
// square plays up high, and every source is low-passed before it reaches the mix.
|
|
4
|
+
import {
|
|
5
|
+
SR, TAU, addInto, adsr, biquad, expDecay, filt, human, mtof, mulInto, noise, osc, scaleBy, tabulate,
|
|
6
|
+
} from "./dsp.ts";
|
|
7
|
+
import type { Rng, Stereo } from "./dsp.ts";
|
|
8
|
+
|
|
9
|
+
// ---------- drums ----------
|
|
10
|
+
type KickOpts = { pitch?: number; dec?: number; punch?: number };
|
|
11
|
+
|
|
12
|
+
function kickBody(n: number, pitch: number, dec: number, punch: number): Float32Array {
|
|
13
|
+
const o = new Float32Array(n);
|
|
14
|
+
let ph = 0;
|
|
15
|
+
for (let i = 0; i < n; i++) {
|
|
16
|
+
const t = i / SR;
|
|
17
|
+
ph += pitch * (1 + 1.1 * punch * Math.exp(-t / 0.035)) / SR;
|
|
18
|
+
o[i] = Math.sin(TAU * ph) * Math.exp(-t / (dec * 0.45)) * Math.min(1, i / 48);
|
|
19
|
+
}
|
|
20
|
+
return o;
|
|
21
|
+
}
|
|
22
|
+
// round kick: a short sweep down to the fundamental, a felt click, a little saturation
|
|
23
|
+
export function kick(r: Rng, { pitch = 50, dec = 0.36, punch = 1 }: KickOpts = {}): Float32Array {
|
|
24
|
+
const sec = dec + 0.12, n = Math.ceil(sec * SR), o = kickBody(n, pitch, dec, punch);
|
|
25
|
+
const click = filt(mulInto(noise(0.01, r), expDecay(0.01, 0.002)), biquad("lp", 1400));
|
|
26
|
+
addInto(o, click, 0, (x) => x * 0.18 * punch);
|
|
27
|
+
for (let i = 0; i < n; i++) o[i] = Math.tanh(o[i] * 1.3) / Math.tanh(1.3);
|
|
28
|
+
return o;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type SnareOpts = { tone?: number; dec?: number; top?: number };
|
|
32
|
+
// a soft, dusty snare: a short tuned body and a band of noise with the top rolled off
|
|
33
|
+
export function snare(r: Rng, { tone = 190, dec = 0.14, top = 7000 }: SnareOpts = {}): Float32Array {
|
|
34
|
+
const sec = dec * 3, n = Math.ceil(sec * SR), o = new Float32Array(n);
|
|
35
|
+
let ph = 0;
|
|
36
|
+
for (let i = 0; i < n; i++) { const t = i / SR; ph += tone * (1 + 0.25 * Math.exp(-t / 0.01)) / SR; o[i] = Math.sin(TAU * ph) * Math.exp(-t / 0.045) * 0.7; }
|
|
37
|
+
const nz = filt(mulInto(noise(sec, r, true), expDecay(sec, dec * 0.6)), biquad("bp", 1700, 0.6), biquad("lp", top), biquad("hp", 300));
|
|
38
|
+
return tabulate(n, (i) => (o[i] + nz[i] * 3.2) * Math.min(1, i / 72));
|
|
39
|
+
}
|
|
40
|
+
// brush: a slow-onset sweep of noise, no crack
|
|
41
|
+
export function brush(r: Rng): Float32Array {
|
|
42
|
+
const o = filt(noise(0.28, r, true), biquad("bp", 2200, 0.5), biquad("lp", 7000), biquad("hp", 450));
|
|
43
|
+
return scaleBy(o, (i) => { const t = i / SR; return Math.min(1, t / 0.018) * Math.exp(-t / 0.09) * 2.4; });
|
|
44
|
+
}
|
|
45
|
+
// a closed hat with the fizz taken off (nothing above ~9 kHz)
|
|
46
|
+
export function hat(r: Rng): Float32Array {
|
|
47
|
+
const o = filt(noise(0.07, r), biquad("hp", 5600, 0.7), biquad("lp", 11000));
|
|
48
|
+
return scaleBy(o, (i) => { const t = i / SR; return Math.min(1, i / 96) * Math.exp(-t / 0.018); });
|
|
49
|
+
}
|
|
50
|
+
// shaker: a short grain of high noise with a soft onset (the light percussion of a calm bed)
|
|
51
|
+
export function shaker(r: Rng): Float32Array {
|
|
52
|
+
const o = filt(noise(0.09, r), biquad("bp", 4200, 1.1), biquad("lp", 9000));
|
|
53
|
+
return scaleBy(o, (i) => { const t = i / SR; return Math.min(1, t / 0.008) * Math.exp(-t / 0.03) * 1.6; });
|
|
54
|
+
}
|
|
55
|
+
function crackle(o: Float32Array, i: number, r: Rng): void {
|
|
56
|
+
const a = (r() * 0.6 + 0.2) * (r() < 0.5 ? -1 : 1);
|
|
57
|
+
for (let k = 0; k < 30 && i + k < o.length; k++) o[i + k] += a * Math.exp(-k / 6);
|
|
58
|
+
}
|
|
59
|
+
// vinyl: sparse soft crackle and a little low hiss (the lofi bed's air)
|
|
60
|
+
export function vinyl(sec: number, r: Rng): Float32Array {
|
|
61
|
+
const n = Math.ceil(sec * SR), o = new Float32Array(n);
|
|
62
|
+
for (let i = 0; i < n; i++) if (r() < 0.00035) crackle(o, i, r);
|
|
63
|
+
addInto(o, noise(sec, r, true), 0, (x) => x * 0.05);
|
|
64
|
+
return filt(o, biquad("lp", 3200), biquad("hp", 250));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ---------- bass and keys ----------
|
|
68
|
+
type BassOpts = { a?: number; r?: number; drive?: number; tone?: number };
|
|
69
|
+
// sub bass: a sine with a touch of its own second harmonic, so it still reads on a phone speaker
|
|
70
|
+
export function bass(note: number, sec: number, { a = 0.006, r = 0.08, drive = 1.3, tone = 0.18 }: BassOpts = {}): Float32Array {
|
|
71
|
+
const f = mtof(note), n = Math.ceil(sec * SR), env = adsr(sec, a, 0.18, 0.75, r);
|
|
72
|
+
const o = tabulate(n, (i) => {
|
|
73
|
+
const t = i / SR, x = Math.sin(TAU * f * t) + tone * Math.sin(TAU * 2 * f * t + 0.6);
|
|
74
|
+
return Math.tanh(x * drive) / Math.tanh(drive) * env[i];
|
|
75
|
+
});
|
|
76
|
+
return filt(o, biquad("lp", 520));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// electric piano (FM, Rhodes-like): a 1:1 pair for the body and the bark of a harder hit, the tine
|
|
80
|
+
// short and quiet, rounder the softer it's played; low notes ring longer. `rh` feeds the hammer noise.
|
|
81
|
+
export function ep(note: number, sec: number, vel: number, rh: Rng): Float32Array {
|
|
82
|
+
const f = mtof(note), n = Math.ceil(sec * SR);
|
|
83
|
+
const ham = scaleBy(filt(mulInto(noise(0.03, rh), expDecay(0.03, 0.006)), biquad("bp", 2600, 0.7)), () => 1.6 * vel);
|
|
84
|
+
const idx = 0.5 + 1.7 * vel, tau = 0.7 + 1.8 * Math.exp(-(note - 48) / 16), rel = Math.min(n, Math.round(0.09 * SR));
|
|
85
|
+
const o = tabulate(n, (i) => {
|
|
86
|
+
const t = i / SR, I = idx * Math.exp(-t / 0.25) + 0.15;
|
|
87
|
+
const body = Math.sin(TAU * f * t + I * Math.sin(TAU * f * t));
|
|
88
|
+
const tine = Math.sin(TAU * f * 4 * t) * Math.exp(-t / 0.025) * 0.12 * vel + (ham[i] || 0);
|
|
89
|
+
const e = Math.min(1, i / (0.003 * SR)) * Math.exp(-t / tau);
|
|
90
|
+
return (body + tine) * (i > n - rel ? e * ((n - i) / rel) : e) * (0.55 + 0.45 * vel);
|
|
91
|
+
});
|
|
92
|
+
return filt(o, biquad("lp", 2200 + 3000 * vel, 0.6), biquad("hp", 70));
|
|
93
|
+
}
|
|
94
|
+
type ChordOpts = { roll?: number; trem?: number };
|
|
95
|
+
// a chord on the electric piano: slightly rolled, with a slow stereo tremolo
|
|
96
|
+
export function epChord(notes: readonly number[], sec: number, vel: number, r: Rng, rh: Rng, { roll = 0.012, trem = 0.18 }: ChordOpts = {}): Stereo {
|
|
97
|
+
const n = Math.ceil((sec + roll * notes.length) * SR), L = new Float32Array(n), R = new Float32Array(n);
|
|
98
|
+
const share = (x: number) => x / notes.length * 1.8;
|
|
99
|
+
notes.forEach((m, k) => {
|
|
100
|
+
const v = ep(m, sec, vel * human(r, 0.16), rh), off = Math.round(k * roll * SR * human(r, 0.6));
|
|
101
|
+
addInto(L, v, off, share); addInto(R, v, off, share);
|
|
102
|
+
});
|
|
103
|
+
const ph = r() * TAU;
|
|
104
|
+
for (let i = 0; i < n; i++) { const p = trem * Math.sin(TAU * 4.6 * i / SR + ph); L[i] *= 1 - p; R[i] *= 1 + p; }
|
|
105
|
+
return { L, R };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ---------- plucks, pads, synth ----------
|
|
109
|
+
type PluckOpts = { bright?: number; decay?: number };
|
|
110
|
+
// felt pluck (Karplus-Strong, dark): muted guitar, kalimba or felt piano, with a warm body under it
|
|
111
|
+
export function pluck(note: number, sec: number, r: Rng, { bright = 0.25, decay = 0.995 }: PluckOpts = {}): Float32Array {
|
|
112
|
+
const f = mtof(note), p = Math.max(2, Math.round(SR / f)), n = Math.ceil(sec * SR), o = new Float32Array(n);
|
|
113
|
+
const buf = new Float32Array(p);
|
|
114
|
+
for (let i = 0; i < p; i++) buf[i] = r() * 2 - 1;
|
|
115
|
+
const pre = biquad("lp", 500 + bright * 3000);
|
|
116
|
+
filt(buf, pre, pre);
|
|
117
|
+
let last = 0;
|
|
118
|
+
for (let i = 0; i < n; i++) {
|
|
119
|
+
const j = i % p, v = buf[j];
|
|
120
|
+
buf[j] = (v + last) * 0.5 * decay;
|
|
121
|
+
last = v; o[i] = v;
|
|
122
|
+
}
|
|
123
|
+
for (let i = 0; i < n; i++) o[i] += Math.sin(TAU * f * i / SR) * Math.exp(-i / SR / 0.25) * 0.25;
|
|
124
|
+
return filt(mulInto(o, adsr(sec, 0.003, 0.05, 1, 0.1)), biquad("hp", 90), biquad("lp", 5200));
|
|
125
|
+
}
|
|
126
|
+
// a strummed chord on the felt pluck (the guitar's ending)
|
|
127
|
+
export function strum(notes: readonly number[], sec: number, r: Rng, o: PluckOpts = {}): Float32Array {
|
|
128
|
+
const n = Math.ceil((sec + 0.2) * SR), out = new Float32Array(n);
|
|
129
|
+
notes.forEach((m, k) => addInto(out, pluck(m, sec, r, o), Math.round(k * 0.028 * SR), (x) => x * 0.55));
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
type PadOpts = { cutoff?: number; attack?: number; release?: number; detune?: number };
|
|
134
|
+
// the saws, detuned across a note's four voices and split left/right, summed before filtering
|
|
135
|
+
function padSaws(notes: readonly number[], sec: number, r: Rng, detune: number): Stereo {
|
|
136
|
+
const n = Math.ceil(sec * SR), L = new Float32Array(n), R = new Float32Array(n);
|
|
137
|
+
for (const m of notes) {
|
|
138
|
+
for (let k = 0; k < 4; k++) addInto(k % 2 ? R : L, osc("saw", mtof(m + (k - 1.5) * detune / 1.5), sec, r()), 0, (x) => x * 0.16);
|
|
139
|
+
}
|
|
140
|
+
return { L, R };
|
|
141
|
+
}
|
|
142
|
+
// a warm pad: detuned saws through a steep low-pass, a sine an octave under, slow in and out, stereo
|
|
143
|
+
export function pad(notes: readonly number[], sec: number, r: Rng, { cutoff = 2600, attack = 0.8, release = 1.4, detune = 0.07 }: PadOpts = {}): Stereo {
|
|
144
|
+
const { L, R } = padSaws(notes, sec, r, detune), n = L.length;
|
|
145
|
+
const lo = osc("sine", mtof(notes[0] - 12), sec);
|
|
146
|
+
const env = adsr(sec, attack, 0.5, 0.85, release);
|
|
147
|
+
const f = [biquad("lp", cutoff, 0.55), biquad("lp", cutoff, 0.55), biquad("lp", cutoff * 1.1, 0.55), biquad("lp", cutoff * 1.1, 0.55)];
|
|
148
|
+
const h = [biquad("hp", 110), biquad("hp", 110)];
|
|
149
|
+
const g = 2.2 / notes.length;
|
|
150
|
+
const air = filt(noise(sec, r, true), biquad("bp", 3800, 0.6), biquad("lp", 9000));
|
|
151
|
+
for (let i = 0; i < n; i++) {
|
|
152
|
+
L[i] = (h[0](f[2](f[0](L[i]))) * g + lo[i] * 0.12 + air[i] * 0.1) * env[i];
|
|
153
|
+
R[i] = (h[1](f[3](f[1](R[i]))) * g + lo[i] * 0.12 - air[i] * 0.1) * env[i];
|
|
154
|
+
}
|
|
155
|
+
return { L, R };
|
|
156
|
+
}
|
|
157
|
+
// a soft, low synth note (Terminal's arpeggio): a saw through a low filter
|
|
158
|
+
export function softSynth(note: number, sec: number, cut = 1800): Float32Array {
|
|
159
|
+
const o = osc("saw", mtof(note), sec), f = biquad("lp", cut, 0.7);
|
|
160
|
+
for (let i = 0; i < o.length; i++) { const t = i / SR; o[i] = f(o[i]) * Math.min(1, i / 120) * Math.exp(-t / (sec * 0.6)); }
|
|
161
|
+
return o;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------- the ending ----------
|
|
165
|
+
// a low, dark swell that grows into its end (a hiss climbing to the sky is what sounds cheap)
|
|
166
|
+
export function outroRiser(r: Rng, sec: number): Stereo {
|
|
167
|
+
const n = Math.ceil(sec * SR), L = new Float32Array(n), R = new Float32Array(n);
|
|
168
|
+
const src = noise(sec, r, true), bl = biquad("bp", 140, 0.8), br = biquad("bp", 140, 0.8), ll = biquad("lp", 2200), lr = biquad("lp", 2200);
|
|
169
|
+
const fo = Math.round(0.04 * SR);
|
|
170
|
+
for (let i = 0; i < n; i++) {
|
|
171
|
+
const k = i / n, f = 140 * Math.pow(1600 / 140, k * k);
|
|
172
|
+
if (i % 32 === 0) { bl.set(f, 0.8); br.set(f * 1.04, 0.8); }
|
|
173
|
+
const env = Math.pow(k, 2.2) * (i > n - fo ? (n - i) / fo : 1) * 2.6;
|
|
174
|
+
L[i] = ll(bl(src[i])) * env; R[i] = lr(br(src[i])) * env;
|
|
175
|
+
}
|
|
176
|
+
return { L, R };
|
|
177
|
+
}
|
|
178
|
+
// one deep hit with a breath of air after it
|
|
179
|
+
export function outroImpact(r: Rng, note: number): Stereo {
|
|
180
|
+
const n = Math.ceil(2.4 * SR), L = new Float32Array(n), R = new Float32Array(n);
|
|
181
|
+
const boom = filt(kick(r, { pitch: mtof(note - 24) * 0.9, punch: 0.4, dec: 1.4 }), biquad("lp", 700));
|
|
182
|
+
const air = filt(mulInto(noise(1.3, r, true), expDecay(1.3, 0.3)), biquad("lp", 1100), biquad("hp", 90));
|
|
183
|
+
for (let i = 0; i < n; i++) { const b = boom[i] || 0, a = air[i] || 0; L[i] = b * 0.9 + a * 0.45; R[i] = b * 0.9 + a * 0.4; }
|
|
184
|
+
return { L, R };
|
|
185
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Mastering: gentle bus glue and a look-ahead brickwall, peaks held under the ceiling without pumping.
|
|
2
|
+
import { SR, biquad, dbToGain } from "./dsp.ts";
|
|
3
|
+
import type { Bus } from "./dsp.ts";
|
|
4
|
+
|
|
5
|
+
// presence (the instruments are voiced dark, so the top is lifted broadly, never a narrow treble boost)
|
|
6
|
+
// and a little tape saturation. The filters keep per-channel memory, so each channel gets its own.
|
|
7
|
+
function eqChannel(ch: Float32Array): void {
|
|
8
|
+
const hp = biquad("hp", 32), lo = biquad("lowshelf", 110, 0.7, -1.5), hi = biquad("highshelf", 2200, 0.6, 5);
|
|
9
|
+
for (let i = 0; i < ch.length; i++) ch[i] = Math.tanh(1.15 * hi(lo(hp(ch[i])))) / Math.tanh(1.15);
|
|
10
|
+
}
|
|
11
|
+
// a soft knee on the loudest transients first, so the limiter barely has to work
|
|
12
|
+
function softKnee(ch: Float32Array, knee: number): void {
|
|
13
|
+
for (let i = 0; i < ch.length; i++) {
|
|
14
|
+
const x = ch[i], a = Math.abs(x);
|
|
15
|
+
if (a > knee) ch[i] = Math.sign(x) * (knee + (1 - knee) * Math.tanh((a - knee) / (1 - knee)));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// sample peaks and the half-sample peaks between them (cubic interpolation ~ true peak)
|
|
19
|
+
const half = (x: Float32Array, i: number): number => (-(x[i - 1] || 0) + 9 * x[i] + 9 * (x[i + 1] || 0) - (x[i + 2] || 0)) / 16;
|
|
20
|
+
const peakAmp = (bus: Bus): Float32Array =>
|
|
21
|
+
Float32Array.from({ length: bus.n }, (_, i) => Math.max(Math.abs(bus.L[i]), Math.abs(bus.R[i]), Math.abs(half(bus.L, i)), Math.abs(half(bus.R, i))));
|
|
22
|
+
|
|
23
|
+
// the exact max over the next `look` samples (monotonic queue); kept as one loop, the queue is the mechanism
|
|
24
|
+
function wantedGain(amp: Float32Array, look: number, ceil: number): Float32Array {
|
|
25
|
+
const n = amp.length, want = new Float32Array(n), q = new Int32Array(n);
|
|
26
|
+
let h = 0, t = 0;
|
|
27
|
+
for (let i = 0, j = 0; i < n; i++) {
|
|
28
|
+
for (; j < Math.min(n, i + look); j++) { while (t > h && amp[q[t - 1]] <= amp[j]) t--; q[t++] = j; }
|
|
29
|
+
while (q[h] < i) h++;
|
|
30
|
+
const pk = amp[q[h]];
|
|
31
|
+
want[i] = pk > ceil ? ceil / pk : 1;
|
|
32
|
+
}
|
|
33
|
+
return want;
|
|
34
|
+
}
|
|
35
|
+
// gain glides down before a peak arrives (attack over the look-ahead) and recovers over ~120 ms
|
|
36
|
+
function applyGlide(bus: Bus, want: Float32Array): void {
|
|
37
|
+
const rel = Math.exp(-1 / (0.12 * SR));
|
|
38
|
+
let g = 1;
|
|
39
|
+
for (let i = 0; i < bus.n; i++) {
|
|
40
|
+
const w = want[i];
|
|
41
|
+
g = w < g ? w : w - (w - g) * rel;
|
|
42
|
+
bus.L[i] *= g; bus.R[i] *= g;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const hardClip = (ch: Float32Array, ceil: number): void => {
|
|
46
|
+
for (let i = 0; i < ch.length; i++) { if (ch[i] > ceil) ch[i] = ceil; else if (ch[i] < -ceil) ch[i] = -ceil; }
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function master(bus: Bus, eq = true): void {
|
|
50
|
+
if (eq) { eqChannel(bus.L); eqChannel(bus.R); }
|
|
51
|
+
const knee = dbToGain(-6), look = Math.round(0.005 * SR), ceil = dbToGain(-2.3);
|
|
52
|
+
softKnee(bus.L, knee); softKnee(bus.R, knee);
|
|
53
|
+
applyGlide(bus, wantedGain(peakAmp(bus), look, ceil));
|
|
54
|
+
hardClip(bus.L, ceil); hardClip(bus.R, ceil);
|
|
55
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// audio: the soundtrack, composed and mixed offline for each video.
|
|
2
|
+
// A music bed in the style's genre, in tempo, warm and low (played instruments, not beeps), one stereo mix,
|
|
3
|
+
// -16 LUFS. Pure JS synthesis (no samples), seeded so a rebuild sounds identical. ffmpeg measures loudness.
|
|
4
|
+
// This file is the edge: ffmpeg reads and loudness, WAV writes, the mastering loop.
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { PRESETS, composeMusic } from "./compose.ts";
|
|
8
|
+
import type { Preset } from "./compose.ts";
|
|
9
|
+
import { SR, busGain, busMixFrom, clamp, dbToGain, makeBus, rng } from "./dsp.ts";
|
|
10
|
+
import type { Bus, Rng } from "./dsp.ts";
|
|
11
|
+
import { master } from "./master.ts";
|
|
12
|
+
|
|
13
|
+
export { SR } from "./dsp.ts";
|
|
14
|
+
export { PRESETS } from "./compose.ts";
|
|
15
|
+
|
|
16
|
+
// `cues` (sound effects) is accepted for old callers and ignored.
|
|
17
|
+
export type Plan = {
|
|
18
|
+
duration: number;
|
|
19
|
+
style?: string;
|
|
20
|
+
preset?: string;
|
|
21
|
+
bpm?: number;
|
|
22
|
+
boundaries?: readonly number[];
|
|
23
|
+
outroAt?: number;
|
|
24
|
+
cues?: readonly unknown[];
|
|
25
|
+
music?: string; // "auto" | "none" | a file path
|
|
26
|
+
musicVolume?: number;
|
|
27
|
+
musicStart?: number;
|
|
28
|
+
};
|
|
29
|
+
export type Report = {
|
|
30
|
+
music: string;
|
|
31
|
+
preset: string | undefined;
|
|
32
|
+
bpm: number;
|
|
33
|
+
sfx: number;
|
|
34
|
+
lufs: number | null;
|
|
35
|
+
truePeak: number | null;
|
|
36
|
+
};
|
|
37
|
+
type Loud = { readonly I: number; readonly TP: number };
|
|
38
|
+
|
|
39
|
+
// ---------- ffmpeg and files ----------
|
|
40
|
+
function writeWav(file: string, bus: Bus, seconds: number): void {
|
|
41
|
+
const n = Math.min(bus.n, Math.round(seconds * SR));
|
|
42
|
+
const b = Buffer.alloc(44 + n * 4);
|
|
43
|
+
b.write("RIFF", 0); b.writeUInt32LE(36 + n * 4, 4); b.write("WAVEfmt ", 8); b.writeUInt32LE(16, 16); b.writeUInt16LE(1, 20); b.writeUInt16LE(2, 22);
|
|
44
|
+
b.writeUInt32LE(SR, 24); b.writeUInt32LE(SR * 4, 28); b.writeUInt16LE(4, 32); b.writeUInt16LE(16, 34); b.write("data", 36); b.writeUInt32LE(n * 4, 40);
|
|
45
|
+
for (let i = 0; i < n; i++) { b.writeInt16LE(Math.round(clamp(bus.L[i], -1, 1) * 32767), 44 + i * 4); b.writeInt16LE(Math.round(clamp(bus.R[i], -1, 1) * 32767), 46 + i * 4); }
|
|
46
|
+
fs.writeFileSync(file, b);
|
|
47
|
+
}
|
|
48
|
+
function readAudio(file: string, seconds: number): Bus | null {
|
|
49
|
+
const r = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-t", String(seconds), "-f", "f32le", "-ac", "2", "-ar", String(SR), "-"], { maxBuffer: 1 << 30 });
|
|
50
|
+
if (r.status !== 0) return null;
|
|
51
|
+
const f = new Float32Array(r.stdout.buffer, r.stdout.byteOffset, Math.floor(r.stdout.length / 4));
|
|
52
|
+
const bus = makeBus(f.length / 2 / SR);
|
|
53
|
+
for (let i = 0; i < bus.n; i++) { bus.L[i] = f[i * 2]; bus.R[i] = f[i * 2 + 1]; }
|
|
54
|
+
return bus;
|
|
55
|
+
}
|
|
56
|
+
function loudness(file: string): Loud | null {
|
|
57
|
+
const r = spawnSync("ffmpeg", ["-hide_banner", "-i", file, "-af", "loudnorm=I=-14:TP=-1:LRA=11:print_format=json", "-f", "null", "-"], { encoding: "utf8" });
|
|
58
|
+
const m = /\{[\s\S]*\}/.exec(r.stderr || "");
|
|
59
|
+
if (!m) return null;
|
|
60
|
+
try {
|
|
61
|
+
const j: unknown = JSON.parse(m[0]);
|
|
62
|
+
if (typeof j !== "object" || j === null) return null;
|
|
63
|
+
return { I: "input_i" in j ? Number(j.input_i) : NaN, TP: "input_tp" in j ? Number(j.input_tp) : NaN };
|
|
64
|
+
} catch { return null; }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ---------- the bed ----------
|
|
68
|
+
const presetFor = (plan: Plan): Preset => {
|
|
69
|
+
const pick = (name: string | undefined): Preset | undefined => (name !== undefined && Object.hasOwn(PRESETS, name) ? PRESETS[name] : undefined);
|
|
70
|
+
const base = pick(plan.preset) ?? pick(plan.style) ?? PRESETS.keynote;
|
|
71
|
+
return plan.bpm ? { ...base, bpm: plan.bpm } : base;
|
|
72
|
+
};
|
|
73
|
+
// your own track, trimmed to the video, faded in and out under the volume
|
|
74
|
+
function addOwnTrack(mix: Bus, plan: Plan, file: string): void {
|
|
75
|
+
const m = readAudio(file, plan.duration + (plan.musicStart || 0) + 3);
|
|
76
|
+
if (!m) return;
|
|
77
|
+
const off = Math.round((plan.musicStart || 0) * SR), fo = Math.round(Math.min(2, plan.duration * 0.1) * SR), end = Math.round(plan.duration * SR);
|
|
78
|
+
for (let i = 0; i < end && i + off < m.n; i++) {
|
|
79
|
+
const g = Math.min(1, i / (0.25 * SR)) * (i > end - fo ? (end - i) / fo : 1) * (plan.musicVolume ?? 0.8);
|
|
80
|
+
mix.L[i] += m.L[i + off] * g; mix.R[i] += m.R[i + off] * g;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function addMusic(mix: Bus, plan: Plan, P: Preset, r: Rng, ham: Rng): void {
|
|
84
|
+
if (plan.music === "auto" || plan.music == null) busMixFrom(mix, composeMusic(P, plan, r, ham), 0.9);
|
|
85
|
+
else if (plan.music && plan.music !== "none") addOwnTrack(mix, plan, plan.music);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ---------- loudness loop ----------
|
|
89
|
+
// -16 LUFS integrated (full, not loud) with peaks under -2 dBTP (headroom for the AAC encode). A few passes of
|
|
90
|
+
// gain -> soft knee + limiter -> measure, so transient-heavy styles get there too.
|
|
91
|
+
function trimPeaks(mix: Bus, outFile: string, seconds: number, L2: Loud | null): Loud | null {
|
|
92
|
+
if (!L2 || L2.TP <= -1.95) return L2;
|
|
93
|
+
busGain(mix, dbToGain(-2.05 - L2.TP));
|
|
94
|
+
writeWav(outFile, mix, seconds);
|
|
95
|
+
return loudness(outFile);
|
|
96
|
+
}
|
|
97
|
+
function loudnessPass(mix: Bus, outFile: string, seconds: number, L2: Loud | null, pass: number): Loud | null {
|
|
98
|
+
if (pass >= 4 || !L2 || !isFinite(L2.I)) return L2;
|
|
99
|
+
const g = clamp(-16 - L2.I, -20, 20);
|
|
100
|
+
if (Math.abs(g) < 0.25 && L2.TP <= -1.95) return L2;
|
|
101
|
+
busGain(mix, dbToGain(g));
|
|
102
|
+
master(mix, false);
|
|
103
|
+
writeWav(outFile, mix, seconds);
|
|
104
|
+
return loudnessPass(mix, outFile, seconds, trimPeaks(mix, outFile, seconds, loudness(outFile)), pass + 1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function renderSoundtrack(plan: Plan, outFile: string, { seed = 7 }: { seed?: number } = {}): Report {
|
|
108
|
+
const r = rng(seed), ham = rng(seed + 1), P = presetFor(plan);
|
|
109
|
+
const seconds = plan.duration + 0.05;
|
|
110
|
+
const mix = makeBus(plan.duration + 3);
|
|
111
|
+
addMusic(mix, plan, P, r, ham);
|
|
112
|
+
master(mix);
|
|
113
|
+
const tmp = outFile.replace(/\.wav$/, ".pre.wav");
|
|
114
|
+
writeWav(tmp, mix, seconds);
|
|
115
|
+
const L2 = loudnessPass(mix, outFile, seconds, loudness(tmp), 0);
|
|
116
|
+
if (!fs.existsSync(outFile)) writeWav(outFile, mix, seconds);
|
|
117
|
+
fs.rmSync(tmp, { force: true });
|
|
118
|
+
return { music: plan.music || "auto", preset: plan.preset || plan.style, bpm: P.bpm, sfx: 0, lufs: L2 ? L2.I : null, truePeak: L2 ? L2.TP : null };
|
|
119
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Line } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
// "*" and "|" are emphasis and pause marks for the writer; they are never spoken or shown.
|
|
4
|
+
export const words = (s: string): readonly string[] => s.replace(/\*|\|/g, "").split(/\s+/).filter(Boolean);
|
|
5
|
+
|
|
6
|
+
const STOP = /[,.;:!?…\u2014]$/;
|
|
7
|
+
|
|
8
|
+
/** How many words the next chunk takes: an even share, nudged one word to land on punctuation. */
|
|
9
|
+
function chunkSize(w: readonly string[], n: number, i: number, parts: number): number {
|
|
10
|
+
const left = w.length - i;
|
|
11
|
+
const even = Math.round(left / parts);
|
|
12
|
+
const nudge = [0, 1, -1].find((d) => {
|
|
13
|
+
const size = even + d;
|
|
14
|
+
return size >= 2 && left - size >= 2 && size <= n && STOP.test(w[i + size - 1] ?? "");
|
|
15
|
+
});
|
|
16
|
+
return even + (nudge ?? 0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function split(w: readonly string[], n: number, i: number, parts: number): readonly string[] {
|
|
20
|
+
if (parts <= 1) return [w.slice(i).join(" ")];
|
|
21
|
+
const size = chunkSize(w, n, i, parts);
|
|
22
|
+
return [w.slice(i, i + size).join(" "), ...split(w, n, i + size, parts - 1)];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Balanced chunks of at most n words (7 words become 4 + 3, not 5 + 2). */
|
|
26
|
+
export function chunks(text: string, n: number): readonly string[] {
|
|
27
|
+
const w = words(text);
|
|
28
|
+
return w.length <= n ? [w.join(" ")] : split(w, n, 0, Math.ceil(w.length / n));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A "/" in a line's caption forces a break there; in spoken text it is just a character ("and/or"). */
|
|
32
|
+
export function captionChunks(line: Line, n: number): readonly string[] {
|
|
33
|
+
if (line.caption?.includes("/")) return line.caption.split("/").map((x) => x.trim()).filter(Boolean);
|
|
34
|
+
return chunks(line.caption ?? line.say, n);
|
|
35
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// `SA check`: catch the defects a render would show, before paying for one. Each rule is a pure
|
|
2
|
+
// function over plain facts; the edge gathers the facts (scene probes, kit and look vocabularies).
|
|
3
|
+
import { words } from "./captions.ts";
|
|
4
|
+
import { isMap } from "./schema.ts";
|
|
5
|
+
import type { JsonMap, Short, Timeline } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export type Call = { readonly fn: string; readonly opts: JsonMap };
|
|
8
|
+
export type Probe = { readonly scene: string; readonly calls: readonly Call[]; readonly error?: string };
|
|
9
|
+
export type Facts = {
|
|
10
|
+
readonly short: Short;
|
|
11
|
+
readonly timeline: Timeline;
|
|
12
|
+
readonly probes: readonly Probe[];
|
|
13
|
+
readonly kit: readonly string[];
|
|
14
|
+
readonly lookKeys: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export type Finding = { readonly level: "error" | "warn"; readonly where: string; readonly msg: string };
|
|
17
|
+
|
|
18
|
+
export const MOVES = ["push", "pull", "pan-left", "pan-right", "rise", "fall", "drift", "still"];
|
|
19
|
+
export const TRANSITIONS = ["cut", "fade", "dip"];
|
|
20
|
+
const LOOK_META = ["base", "palette", "captions", "about"];
|
|
21
|
+
const WORDS = { min: 4, max: 12 };
|
|
22
|
+
const SECONDS = { min: 20, max: 45 };
|
|
23
|
+
const BAND = 0.04;
|
|
24
|
+
|
|
25
|
+
const err = (where: string, msg: string): Finding => ({ level: "error", where, msg });
|
|
26
|
+
const warn = (where: string, msg: string): Finding => ({ level: "warn", where, msg });
|
|
27
|
+
const num = (o: JsonMap, k: string, d: number): number => {
|
|
28
|
+
const v = o[k];
|
|
29
|
+
return typeof v === "number" ? v : d;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const unknownScenes = ({ timeline, probes }: Facts): readonly Finding[] => {
|
|
33
|
+
const known = new Set(probes.map((p) => p.scene));
|
|
34
|
+
return timeline.beats
|
|
35
|
+
.filter((b) => !known.has(b.scene))
|
|
36
|
+
.map((b) => err(`lines[${b.line}]`, `no scene "${b.scene}" in scenes.js (renders as a red frame)`));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const unknownMoves = ({ timeline }: Facts): readonly Finding[] =>
|
|
40
|
+
timeline.beats.flatMap((b) => [
|
|
41
|
+
...(MOVES.includes(b.move) ? [] : [warn(`lines[${b.line}]`, `move "${b.move}" is not one of ${MOVES.join(", ")}; it renders as still`)]),
|
|
42
|
+
...(TRANSITIONS.includes(b.transition) ? [] : [warn(`lines[${b.line}]`, `transition "${b.transition}" is not one of ${TRANSITIONS.join(", ")}; it renders as a cut`)]),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const unknownLookKeys = ({ short, lookKeys }: Facts): readonly Finding[] => {
|
|
46
|
+
if (!isMap(short.look)) return [];
|
|
47
|
+
const known = new Set([...lookKeys, ...LOOK_META]);
|
|
48
|
+
return Object.keys(short.look)
|
|
49
|
+
.filter((k) => !known.has(k))
|
|
50
|
+
.map((k) => warn("look", `"${k}" is not a look setting; it is ignored`));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const lineLengths = ({ short }: Facts): readonly Finding[] =>
|
|
54
|
+
short.lines.flatMap((l, i) => {
|
|
55
|
+
const n = words(l.say).length;
|
|
56
|
+
return n < WORDS.min || n > WORDS.max ? [warn(`lines[${i}]`, `${n} words; lines of ${WORDS.min} to ${WORDS.max} read best`)] : [];
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const totalLength = ({ timeline: { duration } }: Facts): readonly Finding[] =>
|
|
60
|
+
duration < SECONDS.min || duration > SECONDS.max
|
|
61
|
+
? [warn("short", `${duration.toFixed(1)}s long; ${SECONDS.min} to ${SECONDS.max}s holds attention best`)]
|
|
62
|
+
: [];
|
|
63
|
+
|
|
64
|
+
const sceneErrors = ({ probes }: Facts): readonly Finding[] =>
|
|
65
|
+
probes.flatMap((p) => (p.error === undefined ? [] : [err(`scene "${p.scene}"`, `throws: ${p.error}`)]));
|
|
66
|
+
|
|
67
|
+
const unknownKit = ({ probes, kit }: Facts): readonly Finding[] => {
|
|
68
|
+
const known = new Set(kit);
|
|
69
|
+
return probes.flatMap((p) =>
|
|
70
|
+
[...new Set(p.calls.map((c) => c.fn))].filter((fn) => !known.has(fn)).map((fn) => err(`scene "${p.scene}"`, `k.${fn} is not in the kit`)),
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** A figure whose body spans the caption line gets text drawn across it. */
|
|
75
|
+
const crossesBand = (c: Call, y: number): boolean => {
|
|
76
|
+
if (c.fn !== "person") return false;
|
|
77
|
+
const feet = num(c.opts, "y", 0.85);
|
|
78
|
+
const head = feet - num(c.opts, "h", 0.3) * num(c.opts, "scale", 1);
|
|
79
|
+
return head < y + BAND && feet > y - BAND;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const captionOverlap = ({ short, timeline, probes }: Facts): readonly Finding[] => {
|
|
83
|
+
if (short.captions.style === "none" || timeline.track.length === 0) return [];
|
|
84
|
+
const y = num(short.captions, "y", 0.775);
|
|
85
|
+
const used = new Set(timeline.beats.map((b) => b.scene));
|
|
86
|
+
return probes
|
|
87
|
+
.filter((p) => used.has(p.scene) && p.calls.some((c) => crossesBand(c, y)))
|
|
88
|
+
.map((p) => warn(`scene "${p.scene}"`, `a person crosses the caption line at y=${y}; raise them, shrink them, or set captions.y`));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const RULES = [sceneErrors, unknownScenes, unknownKit, unknownMoves, unknownLookKeys, captionOverlap, lineLengths, totalLength];
|
|
92
|
+
|
|
93
|
+
export const check = (facts: Facts): readonly Finding[] => RULES.flatMap((rule) => rule(facts));
|
|
94
|
+
|
|
95
|
+
export const report = (fs: readonly Finding[]): string =>
|
|
96
|
+
fs.length === 0 ? "check: clean" : fs.map((f) => `${f.level === "error" ? "ERROR" : "warn "} ${f.where}: ${f.msg}`).join("\n");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isMap } from "./schema.ts";
|
|
2
|
+
import type { Json, JsonMap, Result, Short, Timeline } from "./types.ts";
|
|
3
|
+
import { fail, ok } from "./types.ts";
|
|
4
|
+
|
|
5
|
+
export type Named = (name: string) => Result<JsonMap>;
|
|
6
|
+
|
|
7
|
+
const sub = (o: JsonMap, k: string): JsonMap => {
|
|
8
|
+
const v = o[k];
|
|
9
|
+
return isMap(v) ? v : {};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** A look is a name from looks/, or an object with an optional `base` name plus overrides. */
|
|
13
|
+
export function resolveLook(spec: Json, named: Named): Result<JsonMap> {
|
|
14
|
+
if (typeof spec === "string") return named(spec || "oil");
|
|
15
|
+
if (!isMap(spec)) return spec === null ? named("oil") : fail("look must be a name or an object");
|
|
16
|
+
const base = typeof spec.base === "string" ? named(spec.base) : ok<JsonMap>({});
|
|
17
|
+
if (!base.ok) return base;
|
|
18
|
+
return ok({ ...base.value, ...spec, palette: { ...sub(base.value, "palette"), ...sub(spec, "palette") } });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** What the page reads as window.SHORT: the timeline, the look with the short's palette over it, the captions. */
|
|
22
|
+
export const pageState = (s: Short, tl: Timeline, look: JsonMap) => ({
|
|
23
|
+
...tl,
|
|
24
|
+
look: { ...look, ...(s.palette ? { palette: { ...sub(look, "palette"), ...s.palette } } : {}) },
|
|
25
|
+
captions: { ...sub(look, "captions"), ...s.captions },
|
|
26
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// `SA set dir key.path=value`: an immutable path update over plain JSON.
|
|
2
|
+
import { isJson, isMap } from "./schema.ts";
|
|
3
|
+
import type { Json, Result } from "./types.ts";
|
|
4
|
+
import { fail, ok } from "./types.ts";
|
|
5
|
+
|
|
6
|
+
export type Assignment = { readonly path: readonly string[]; readonly value: Json };
|
|
7
|
+
|
|
8
|
+
const parseValue = (raw: string): Json => {
|
|
9
|
+
try {
|
|
10
|
+
const v: unknown = JSON.parse(raw);
|
|
11
|
+
return isJson(v) ? v : raw;
|
|
12
|
+
} catch {
|
|
13
|
+
return raw;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** "lines.0.say=Hello" becomes a path and a value; values are JSON when they parse, text otherwise. */
|
|
18
|
+
export function parseAssignment(arg: string): Result<Assignment> {
|
|
19
|
+
const i = arg.indexOf("=");
|
|
20
|
+
if (i <= 0) return fail(`"${arg}" is not key=value (e.g. look=watercolor, lines.0.hold=0.8)`);
|
|
21
|
+
const path = arg.slice(0, i).split(".");
|
|
22
|
+
if (path.some((k) => k === "")) return fail(`"${arg.slice(0, i)}" has an empty key`);
|
|
23
|
+
return ok({ path, value: parseValue(arg.slice(i + 1)) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const isIndex = (k: string): boolean => /^\d+$/.test(k);
|
|
27
|
+
|
|
28
|
+
export function setPath(doc: Json | undefined, path: readonly string[], value: Json): Json {
|
|
29
|
+
const [k, ...rest] = path;
|
|
30
|
+
if (k === undefined) return value;
|
|
31
|
+
if (Array.isArray(doc) && isIndex(k)) {
|
|
32
|
+
const i = Number(k);
|
|
33
|
+
return Array.from({ length: Math.max(doc.length, i + 1) }, (_, j): Json => (j === i ? setPath(doc[j], rest, value) : (doc[j] ?? null)));
|
|
34
|
+
}
|
|
35
|
+
const base = isMap(doc) ? doc : {};
|
|
36
|
+
const next = rest.length && base[k] === undefined && isIndex(rest[0] ?? "") ? [] : base[k];
|
|
37
|
+
return { ...base, [k]: setPath(next, rest, value) };
|
|
38
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// short.json arrives as unknown JSON; this is the one place it is narrowed into a Short.
|
|
2
|
+
import type { Json, JsonMap, Line, Music, Result, Short, Shot, Voice } from "./types.ts";
|
|
3
|
+
import { fail, ok } from "./types.ts";
|
|
4
|
+
|
|
5
|
+
export const isMap = (x: unknown): x is JsonMap => typeof x === "object" && x !== null && !Array.isArray(x);
|
|
6
|
+
export const isJson = (x: unknown): x is Json =>
|
|
7
|
+
x === null || ["boolean", "number", "string"].includes(typeof x) || (Array.isArray(x) ? x.every(isJson) : isMap(x) && Object.values(x).every(isJson));
|
|
8
|
+
|
|
9
|
+
const str = (o: JsonMap, k: string): string | undefined => (typeof o[k] === "string" ? String(o[k]) : undefined);
|
|
10
|
+
const num = (o: JsonMap, k: string): number | undefined => {
|
|
11
|
+
const v = o[k];
|
|
12
|
+
return typeof v === "number" ? v : undefined;
|
|
13
|
+
};
|
|
14
|
+
const map = (o: JsonMap, k: string): JsonMap | undefined => {
|
|
15
|
+
const v = o[k];
|
|
16
|
+
return isMap(v) ? v : undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const shotOf = (x: Json): Shot | undefined => {
|
|
20
|
+
if (typeof x === "string") return { scene: x };
|
|
21
|
+
if (!isMap(x)) return undefined;
|
|
22
|
+
const scene = str(x, "scene");
|
|
23
|
+
return scene === undefined
|
|
24
|
+
? undefined
|
|
25
|
+
: { scene, move: str(x, "move"), amount: num(x, "amount"), seed: num(x, "seed"), transition: str(x, "transition") };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const shotsOf = (x: Json | undefined): readonly Shot[] | undefined => {
|
|
29
|
+
const list = Array.isArray(x) ? x : x === undefined ? [] : [x];
|
|
30
|
+
const shots = list.map(shotOf);
|
|
31
|
+
return shots.length > 0 && shots.every((s) => s !== undefined) ? shots.filter((s) => s !== undefined) : undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const lineOf = (x: Json, i: number): Result<Line> => {
|
|
35
|
+
if (!isMap(x)) return fail(`lines[${i}] is not an object`);
|
|
36
|
+
const say = typeof x.say === "string" || typeof x.say === "number" ? String(x.say) : undefined;
|
|
37
|
+
const shots = shotsOf(x.scene);
|
|
38
|
+
if (say === undefined) return fail(`lines[${i}] has no "say"`);
|
|
39
|
+
if (shots === undefined) return fail(`lines[${i}] needs "scene": a name, {scene, ...}, or a list of them`);
|
|
40
|
+
return ok({
|
|
41
|
+
say, shots, speak: str(x, "speak"), caption: str(x, "caption"), move: str(x, "move"), amount: num(x, "amount"),
|
|
42
|
+
seed: num(x, "seed"), hold: num(x, "hold"), transition: str(x, "transition"),
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const DEFAULT_VOICE = { kind: "kokoro", id: "bm_george", speed: 0.92 } satisfies Voice;
|
|
47
|
+
|
|
48
|
+
const voiceOf = (x: Json | undefined): Voice => {
|
|
49
|
+
if (x === "none") return { kind: "none" };
|
|
50
|
+
if (typeof x === "string") return { ...DEFAULT_VOICE, id: x };
|
|
51
|
+
if (!isMap(x)) return DEFAULT_VOICE;
|
|
52
|
+
const file = str(x, "file");
|
|
53
|
+
if (str(x, "id") === "none") return { kind: "none" };
|
|
54
|
+
if (file !== undefined) return { kind: "file", file };
|
|
55
|
+
return { kind: "kokoro", id: str(x, "id") ?? DEFAULT_VOICE.id, speed: num(x, "speed") ?? DEFAULT_VOICE.speed };
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const musicOf = (x: Json | undefined): Music =>
|
|
59
|
+
typeof x === "string"
|
|
60
|
+
? { mood: x }
|
|
61
|
+
: isMap(x)
|
|
62
|
+
? { mood: str(x, "mood") ?? "tender", volume: num(x, "volume"), seed: num(x, "seed"), start: num(x, "start") }
|
|
63
|
+
: { mood: "tender" };
|
|
64
|
+
|
|
65
|
+
const collect = <T>(rs: readonly Result<T>[]): Result<readonly T[]> => {
|
|
66
|
+
const errors = rs.flatMap((r) => (r.ok ? [] : r.errors));
|
|
67
|
+
return errors.length ? fail(...errors) : ok(rs.flatMap((r) => (r.ok ? [r.value] : [])));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function parseShort(raw: unknown): Result<Short> {
|
|
71
|
+
if (!isMap(raw)) return fail("short.json is not a JSON object");
|
|
72
|
+
const lines = Array.isArray(raw.lines) ? collect(raw.lines.map(lineOf)) : fail<readonly Line[]>("short.json has no lines");
|
|
73
|
+
if (!lines.ok) return lines;
|
|
74
|
+
if (lines.value.length === 0) return fail("short.json has no lines");
|
|
75
|
+
return ok({
|
|
76
|
+
title: str(raw, "title") ?? "short", format: str(raw, "format") ?? "9:16", fps: num(raw, "fps") || 24,
|
|
77
|
+
twos: num(raw, "twos") || 2, lead: num(raw, "lead") ?? 0.35, pause: num(raw, "pause") ?? 0.3, tail: num(raw, "tail") ?? 1.2,
|
|
78
|
+
transition: str(raw, "transition") ?? "cut", look: raw.look ?? "oil", palette: map(raw, "palette"),
|
|
79
|
+
captions: map(raw, "captions") ?? {}, voice: voiceOf(raw.voice), music: musicOf(raw.music), lines: lines.value,
|
|
80
|
+
});
|
|
81
|
+
}
|