@softure-ai/marketing-kit 0.44.0 → 0.45.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done"). Versions before the first one below are described in their GitHub Releases (`marketing-kit@x.y.z`).
6
6
 
7
+ ## 0.45.1
8
+
9
+ - **A clip recorded in one channel plays on both (issue #1385):** a stereo clip whose sound lives in one channel only
10
+ (a wireless lavalier receiver in stereo mode with one transmitter: voice left, a dead right channel) kept its
11
+ stereo in the speech chain, so the draft and the render played the voice in the left ear only. `prepareClipSounds`
12
+ now measures every clip's channels first (`buildChannelMeasureArgs`, `readChannelRmsDb`, `getChannelBalance`); a
13
+ clip whose quieter channel is under -70 dBFS RMS and at least 30 dB under the other (`ONE_SIDED_CHANNEL`) has its
14
+ live channel copied onto both (`getChannelFoldFilter`) before the pre-gain is measured and the sound is extracted.
15
+ `ClipSound.channels` says what was done and the `log` gets a line per folded clip (`describeChannelFold`). Real
16
+ stereo, mono and silence keep their exact arguments.
17
+
18
+ ## 0.45.0
19
+
20
+ - **The draft sets every line on the render's baseline:** libass sets a line's baseline `usWinAscent` below its top,
21
+ a browser half the leading plus the content area's ascent; for a brand font whose win ascent stands far above its
22
+ typo ascent (a display serif's 1.3 em over 1.0 em) every heading line stood about 0.375 em lower in the draft: a
23
+ place card's title fell onto its subtitle, a keyword's last line hung out of its card. `DraftFont` reads
24
+ `drawnAscentEm` and `drawnDescentEm`; every overlay line placed by its top or its middle moves by
25
+ `getDraftLineShift` or `getDraftMiddleShift` (both 0 without the draft's fonts, as before).
26
+ - **The draft fits captions to `captionMaxLines` as the render does:** a chunk's font shrinks in 1 px steps, down to
27
+ `CAPTION_MIN_FONT_SCALE` of the box's size, until it takes at most that many lines (`fitDraftCaptionPlace`); a
28
+ fitted size gets a caption style of its own. Before, a long chunk took three lines at the box's size in the draft
29
+ and two smaller ones in the render.
30
+ - The draft-versus-render regression test runs a second scenario: a heading font with a raised win ascent and
31
+ captions limited to two lines, tops and feet within 1 % of the frame.
32
+
7
33
  ## 0.44.0
8
34
 
9
35
  - **The draft runs every animation at the render's pace:** at the same second a counter showed 2734 in the draft and
package/README.md CHANGED
@@ -923,6 +923,12 @@ softure-marketing footage <film> --step=render # the EDL as it is, maybe e
923
923
  it (`assets/speech.raw.wav`, `speech.declicked.wav`, `speech.wav`) is float WAV, so quiet speech is never encoded
924
924
  lossily at its quiet level and the film's final AAC (`mixLoudness.audioBitrateKbps`, 192 to 512 kbps, default 192,
925
925
  48 kHz) is the only lossy encode.
926
+ - **A clip recorded in one channel (issue #1385):** before its loudness is measured, each clip's channels are measured
927
+ (`astats`, RMS per channel). A stereo clip whose quieter channel is under -70 dBFS and at least 30 dB under the other
928
+ (`ONE_SIDED_CHANNEL`), as a wireless lavalier receiver in stereo mode records a single transmitter, has its live
929
+ channel copied onto both (`pan=stereo|c0=c0|c1=c0` or the right-hand mirror) in the measure and in
930
+ `audio/<clip>.wav`, so the voice plays in the middle of the draft and the render. `ClipSound.channels` answers
931
+ `balanced` or `one_sided` (with `live`, `liveRmsDb`, `deadRmsDb`) and the `log` gets one line per folded clip.
926
932
  - **What the pre-gain reached (issue #1181):** quiet speech with a few short peaks (a mouth click, a bump on the
927
933
  microphone) has a crest of about 25 dB, so the −3 dBTP ceiling stops the gain under −23 LUFS. Each `ClipSound`
928
934
  answers `preGain`, and `transcribeFootage` / `isolateSpeechRanges` answer `speechPreGain` by clip id: `on_target`,
@@ -1351,7 +1357,9 @@ What the draft matches and what it leaves out:
1351
1357
  and named by the family the file itself declares (libass matches that, not the CSS family). A body font shipped only
1352
1358
  as WOFF or WOFF2, or no `brand`, draws in DejaVu Sans Bold subset to Latin with every Polish letter, shipped in
1353
1359
  [`fonts/`](fonts/README.md) (`FOOTAGE_DRAFT_FONT`), and the log says so. Without `brand` a highlight film uses
1354
- `FOOTAGE_DRAFT_CAPTION_COLORS`. `captionMaxLines` is not applied: the draft wraps at the caption box.
1360
+ `FOOTAGE_DRAFT_CAPTION_COLORS`. With `captionMaxLines` each chunk's font shrinks as the render's does, in 1 px
1361
+ steps down to `CAPTION_MIN_FONT_SCALE` of the box's size, until it takes that many lines (`fitDraftCaptionPlace`,
1362
+ 0.45.0).
1355
1363
  - **Text at the render's size** (`loadFootageDraftFonts`): every font is drawn as large as the render draws it.
1356
1364
  libass sizes a font by `usWinAscent + usWinDescent`, a browser by its em, so each size the draft writes (`Fontsize`,
1357
1365
  `\fs`) is the render's CSS px times the font's own `(usWinAscent + usWinDescent) / unitsPerEm` (`DraftFont.assScale`;
@@ -1371,6 +1379,11 @@ What the draft matches and what it leaves out:
1371
1379
  frame either side, `getFrameSteps`); typed letters come one render stagger apart (`getTypingStep`), a later line
1372
1380
  going on from the letters before it (`getTypingTimes`' `firstIndex`); a wipe's clips move along the render's ease
1373
1381
  in one `\t` per frame (`getEasedClipTags`). At any second the draft and the render differ by at most one frame.
1382
+ - **Lines on the render's baseline** (0.45.0): libass sets a line's baseline `usWinAscent` below its top, a browser half
1383
+ the leading plus the content area's ascent below the line box's top. With `fonts`, every overlay line placed by its
1384
+ top or its middle moves by the difference (`getDraftLineShift`, `getDraftMiddleShift`, from
1385
+ `DraftFont.drawnAscentEm` and `drawnDescentEm`), so a display serif whose win ascent stands far above its typo
1386
+ ascent no longer sits low in its card.
1374
1387
  - **Music without spending** (`cacheDir`, `providers`, as `renderFootage` takes them): a `file` source plays as is;
1375
1388
  a `prompt` or `video` source plays only when its paid cache entry exists (`findFootageMusic`, the render's lookup).
1376
1389
  It is ducked under the speech, looped and faded to the cut's length exactly as in the render. No provider is ever
@@ -60,9 +60,44 @@ export interface ClipSound {
60
60
  file: string;
61
61
  gainDb: number;
62
62
  preGain: SpeechPreGain;
63
+ /** Whether the clip's sound lived in one channel only and was folded onto both (issue #1385). */
64
+ channels: ChannelBalance;
63
65
  }
66
+ /**
67
+ * How a clip's sound sits in its channels (issue #1385): `balanced` (stereo with sound in both, mono, silence, or no
68
+ * sound at all), or `one_sided`, a stereo clip whose `live` channel carries the sound and whose other channel is dead,
69
+ * as a wireless lavalier receiver in stereo mode records one transmitter. Levels are RMS in dBFS.
70
+ */
71
+ export type ChannelBalance = {
72
+ kind: "balanced";
73
+ } | {
74
+ kind: "one_sided";
75
+ live: "left" | "right";
76
+ liveRmsDb: number;
77
+ deadRmsDb: number;
78
+ };
79
+ /**
80
+ * When a stereo clip counts as one-sided: its quieter channel is under `deadCeilingDb` RMS and at least `minGapDb`
81
+ * under the louder one. A dead channel measures about -115 dBFS; a phone's real stereo stays within a few dB.
82
+ */
83
+ export declare const ONE_SIDED_CHANNEL: {
84
+ readonly deadCeilingDb: -70;
85
+ readonly minGapDb: 30;
86
+ };
87
+ /** The per-channel RMS pass over the trimmed clip's sound, as the source has it (no format change); writes nothing. */
88
+ export declare function buildChannelMeasureArgs(input: ClipSoundInput): string[];
89
+ /** Each channel's RMS level in dBFS, in channel order, from `astats`' log; `-inf` (digital silence) is `-Infinity`. */
90
+ export declare function readChannelRmsDb(stderr: string): number[];
91
+ /** The balance of a clip's channels from their RMS levels (`readChannelRmsDb`); only two channels can be one-sided. */
92
+ export declare function getChannelBalance(rmsDb: readonly number[]): ChannelBalance;
93
+ /** The filter (with its trailing comma) that copies a one-sided clip's live channel onto both; empty when balanced. */
94
+ export declare function getChannelFoldFilter(balance: ChannelBalance): string;
95
+ /** The log line for a clip whose sound was folded onto both channels; null for a balanced one. */
96
+ export declare function describeChannelFold(clipId: string, balance: ChannelBalance): string | null;
64
97
  /** The measuring pass over the trimmed clip's sound, after the same format change the extraction makes; writes nothing. */
65
- export declare function buildClipSoundMeasureArgs(input: ClipSoundInput): string[];
98
+ export declare function buildClipSoundMeasureArgs(input: ClipSoundInput & {
99
+ balance?: ChannelBalance;
100
+ }): string[];
66
101
  /**
67
102
  * The pre-gain in dB for a measured clip: up (or down) to `SPEECH_PRE_GAIN.target`, but never past the gain that puts
68
103
  * its true peak at `SPEECH_PRE_GAIN.peakCeiling`; 0 for silence. Rounded to a hundredth of a dB.
@@ -89,6 +124,7 @@ export declare function buildClipSoundArgs(input: ClipSoundInput & {
89
124
  gainDb: number;
90
125
  output: string;
91
126
  peaks?: SpeechPeaks;
127
+ balance?: ChannelBalance;
92
128
  }): string[];
93
129
  /** Where a clip's sound goes in the build folder. */
94
130
  export declare function getClipSoundPath(buildDir: string, clipId: string): string;
@@ -96,8 +132,9 @@ export declare function getClipSoundPath(buildDir: string, clipId: string): stri
96
132
  * Every clip's lossless, pre-gained sound under `<buildDir>/audio/<id>.wav`, by clip id. A talking clip is gained by its
97
133
  * own measurement (`getPreGainDb`); any other clip by the mean of the talking clips' gains (0 dB without one), so a
98
134
  * b-roll's own sound under the speech keeps its relation to it. Each answers its `preGain` (issue #1181), and `log` gets
99
- * a line for every clip the peak ceiling held under the target (or, with `peaks: "float"`, whose peaks pass it).
100
- * Throws naming the clip when ffmpeg fails.
135
+ * a line for every clip the peak ceiling held under the target (or, with `peaks: "float"`, whose peaks pass it). A clip
136
+ * whose sound lives in one channel only is folded onto both before it is measured and extracted (issue #1385), with a
137
+ * log line. Throws naming the clip when ffmpeg fails.
101
138
  */
102
139
  export declare function prepareClipSounds(clips: readonly ClipSoundInput[], options: {
103
140
  buildDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"clip-sound.d.ts","sourceRoot":"","sources":["../../src/footage/clip-sound.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAqC,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;GAOG;AAEH,0HAA0H;AAC1H,eAAO,MAAM,eAAe;aAAK,MAAM,EAAE,CAAC,EAAE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AAA;CAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAc3J;AAED,gHAAgH;AAChH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,CASjH;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,GAAG,MAAM,EAAE,CAKtJ;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzE;AA0BD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACrG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CA0BpC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAK1D"}
@@ -15,7 +15,47 @@ import { runFfmpeg, runProcess } from "./process.js";
15
15
  export const SPEECH_PRE_GAIN = { target: -23, peakCeiling: -3 };
16
16
  /** The loudness range `loudnorm` measures with; the pre-gain itself is a plain linear `volume`. */
17
17
  const MEASURE_RANGE = 11;
18
+ /**
19
+ * When a stereo clip counts as one-sided: its quieter channel is under `deadCeilingDb` RMS and at least `minGapDb`
20
+ * under the louder one. A dead channel measures about -115 dBFS; a phone's real stereo stays within a few dB.
21
+ */
22
+ export const ONE_SIDED_CHANNEL = { deadCeilingDb: -70, minGapDb: 30 };
23
+ const BALANCED = { kind: "balanced" };
18
24
  const toFormat = `aformat=sample_rates=${String(FOOTAGE_SAMPLE_RATE)}:channel_layouts=stereo`;
25
+ /** The per-channel RMS pass over the trimmed clip's sound, as the source has it (no format change); writes nothing. */
26
+ export function buildChannelMeasureArgs(input) {
27
+ const { seek, length } = getTrimArgs(input);
28
+ return ["-hide_banner", "-nostats", ...seek, "-i", input.source, ...length, "-map", "0:a:0", "-vn", "-af", "astats=measure_overall=none:measure_perchannel=RMS_level", "-f", "null", "-"];
29
+ }
30
+ /** Each channel's RMS level in dBFS, in channel order, from `astats`' log; `-inf` (digital silence) is `-Infinity`. */
31
+ export function readChannelRmsDb(stderr) {
32
+ return [...stderr.matchAll(/RMS level dB: (-?inf|-?\d+(?:\.\d+)?)/g)].map((match) => (match[1]?.endsWith("inf") === true ? -Infinity : Number(match[1])));
33
+ }
34
+ /** The balance of a clip's channels from their RMS levels (`readChannelRmsDb`); only two channels can be one-sided. */
35
+ export function getChannelBalance(rmsDb) {
36
+ const [left, right] = rmsDb;
37
+ if (rmsDb.length !== 2 || left === undefined || right === undefined)
38
+ return BALANCED;
39
+ const [live, liveRmsDb, deadRmsDb] = left >= right ? ["left", left, right] : ["right", right, left];
40
+ if (!Number.isFinite(liveRmsDb) || deadRmsDb >= ONE_SIDED_CHANNEL.deadCeilingDb || liveRmsDb - deadRmsDb < ONE_SIDED_CHANNEL.minGapDb)
41
+ return BALANCED;
42
+ return { kind: "one_sided", live, liveRmsDb, deadRmsDb };
43
+ }
44
+ /** The filter (with its trailing comma) that copies a one-sided clip's live channel onto both; empty when balanced. */
45
+ export function getChannelFoldFilter(balance) {
46
+ if (balance.kind === "balanced")
47
+ return "";
48
+ const channel = balance.live === "left" ? "c0" : "c1";
49
+ return `pan=stereo|c0=${channel}|c1=${channel},`;
50
+ }
51
+ /** The log line for a clip whose sound was folded onto both channels; null for a balanced one. */
52
+ export function describeChannelFold(clipId, balance) {
53
+ if (balance.kind === "balanced")
54
+ return null;
55
+ const dead = balance.live === "left" ? "right" : "left";
56
+ const level = (db) => (Number.isFinite(db) ? `${String(Math.round(db * 10) / 10)} dBFS` : "silent");
57
+ return `clip sound: clip ${clipId} has sound only in its ${balance.live} channel (${level(balance.liveRmsDb)} RMS, ${dead} ${level(balance.deadRmsDb)}); the ${balance.live} channel is played on both.`;
58
+ }
19
59
  /** The seek and the length of the trimmed clip, as `buildNormalizeArgs` reads its source. */
20
60
  function getTrimArgs(input) {
21
61
  return { seek: input.clip.trim.start > 0 ? ["-ss", String(input.clip.trim.start)] : [], length: ["-t", input.duration.toFixed(3)] };
@@ -23,8 +63,9 @@ function getTrimArgs(input) {
23
63
  /** The measuring pass over the trimmed clip's sound, after the same format change the extraction makes; writes nothing. */
24
64
  export function buildClipSoundMeasureArgs(input) {
25
65
  const { seek, length } = getTrimArgs(input);
66
+ const fold = getChannelFoldFilter(input.balance ?? BALANCED);
26
67
  const measure = `loudnorm=I=${String(SPEECH_PRE_GAIN.target)}:TP=${String(SPEECH_PRE_GAIN.peakCeiling)}:LRA=${String(MEASURE_RANGE)}:print_format=json`;
27
- return ["-hide_banner", "-nostats", ...seek, "-i", input.source, ...length, "-map", "0:a:0", "-vn", "-af", `${toFormat},${measure}`, "-f", "null", "-"];
68
+ return ["-hide_banner", "-nostats", ...seek, "-i", input.source, ...length, "-map", "0:a:0", "-vn", "-af", `${fold}${toFormat},${measure}`, "-f", "null", "-"];
28
69
  }
29
70
  /**
30
71
  * The pre-gain in dB for a measured clip: up (or down) to `SPEECH_PRE_GAIN.target`, but never past the gain that puts
@@ -80,23 +121,34 @@ export function buildClipSoundArgs(input) {
80
121
  const { seek, length } = getTrimArgs(input);
81
122
  if (!input.probe.hasAudio)
82
123
  return ["-v", "error", "-y", "-f", "lavfi", "-i", `anullsrc=r=${String(FOOTAGE_SAMPLE_RATE)}:cl=stereo`, ...length, ...codec];
83
- return ["-v", "error", "-y", ...seek, "-i", input.source, ...length, "-map", "0:a:0", "-vn", "-af", `${toFormat},volume=${String(input.gainDb)}dB`, ...codec];
124
+ return ["-v", "error", "-y", ...seek, "-i", input.source, ...length, "-map", "0:a:0", "-vn", "-af", `${getChannelFoldFilter(input.balance ?? BALANCED)}${toFormat},volume=${String(input.gainDb)}dB`, ...codec];
84
125
  }
85
126
  /** Where a clip's sound goes in the build folder. */
86
127
  export function getClipSoundPath(buildDir, clipId) {
87
128
  return join(buildDir, "audio", `${clipId}.wav`);
88
129
  }
89
130
  /** Measures one clip's sound; null when the clip has none. Throws naming the clip when ffmpeg fails. */
90
- async function measureClipSound(input, signal) {
91
- if (!input.probe.hasAudio)
92
- return null;
93
- const step = `Measuring the sound of clip ${input.clip.id}`;
94
- const measured = await runProcess({ command: "ffmpeg", args: buildClipSoundMeasureArgs(input), ...(signal === undefined ? {} : { signal }) });
131
+ /** Runs one ffmpeg measuring pass and answers its log; throws naming `step` when ffmpeg does not start or fails. */
132
+ async function runMeasure(step, args, signal) {
133
+ const measured = await runProcess({ command: "ffmpeg", args, ...(signal === undefined ? {} : { signal }) });
95
134
  if (measured.kind === "not-started")
96
135
  throw new Error(`${step}: ffmpeg did not start (${measured.error}).`);
97
136
  if (measured.code !== 0)
98
137
  throw new Error(`${step}: ffmpeg ended with code ${String(measured.code)}: ${measured.stderr.trim().split("\n").slice(-3).join(" | ")}.`);
99
- const measurement = readLoudnessMeasurement(measured.stderr);
138
+ return measured.stderr;
139
+ }
140
+ /** How one clip's sound sits in its channels (issue #1385); `balanced` for a clip without sound. Throws naming the clip when ffmpeg fails. */
141
+ async function measureClipChannels(input, signal) {
142
+ if (!input.probe.hasAudio)
143
+ return BALANCED;
144
+ const stderr = await runMeasure(`Measuring the channels of clip ${input.clip.id}`, buildChannelMeasureArgs(input), signal);
145
+ return getChannelBalance(readChannelRmsDb(stderr));
146
+ }
147
+ async function measureClipSound(input, signal) {
148
+ if (!input.probe.hasAudio)
149
+ return null;
150
+ const step = `Measuring the sound of clip ${input.clip.id}`;
151
+ const measurement = readLoudnessMeasurement(await runMeasure(step, buildClipSoundMeasureArgs(input), signal));
100
152
  if (measurement === null)
101
153
  throw new Error(`${step}: ffmpeg printed no loudnorm measurement for ${input.source}.`);
102
154
  return measurement;
@@ -105,17 +157,22 @@ async function measureClipSound(input, signal) {
105
157
  * Every clip's lossless, pre-gained sound under `<buildDir>/audio/<id>.wav`, by clip id. A talking clip is gained by its
106
158
  * own measurement (`getPreGainDb`); any other clip by the mean of the talking clips' gains (0 dB without one), so a
107
159
  * b-roll's own sound under the speech keeps its relation to it. Each answers its `preGain` (issue #1181), and `log` gets
108
- * a line for every clip the peak ceiling held under the target (or, with `peaks: "float"`, whose peaks pass it).
109
- * Throws naming the clip when ffmpeg fails.
160
+ * a line for every clip the peak ceiling held under the target (or, with `peaks: "float"`, whose peaks pass it). A clip
161
+ * whose sound lives in one channel only is folded onto both before it is measured and extracted (issue #1385), with a
162
+ * log line. Throws naming the clip when ffmpeg fails.
110
163
  */
111
164
  export async function prepareClipSounds(clips, options) {
112
165
  const { signal } = options;
113
166
  const peaks = options.peaks ?? "ceiling";
167
+ const balances = new Map();
168
+ for (const clip of clips)
169
+ balances.set(clip.clip.id, await measureClipChannels(clip, signal));
114
170
  const measured = new Map();
115
171
  for (const clip of clips) {
116
172
  if (clip.clip.role !== "talk")
117
173
  continue;
118
- measured.set(clip.clip.id, getSpeechPreGain(await measureClipSound(clip, signal), { peaks }));
174
+ const balance = balances.get(clip.clip.id) ?? BALANCED;
175
+ measured.set(clip.clip.id, getSpeechPreGain(await measureClipSound({ ...clip, balance }, signal), { peaks }));
119
176
  }
120
177
  const talking = [...measured.values()].map((entry) => entry.gainDb);
121
178
  const sharedGain = talking.length === 0 ? 0 : Math.round((talking.reduce((sum, gain) => sum + gain, 0) / talking.length) * 100) / 100 || 0;
@@ -125,12 +182,13 @@ export async function prepareClipSounds(clips, options) {
125
182
  const { gainDb, preGain } = measured.get(clip.clip.id) ?? shared;
126
183
  const output = getClipSoundPath(options.buildDir, clip.clip.id);
127
184
  mkdirSync(dirname(output), { recursive: true });
128
- await runFfmpeg(`Extracting the sound of clip ${clip.clip.id}`, buildClipSoundArgs({ ...clip, gainDb, output, peaks }), { ...(signal === undefined ? {} : { signal }), output });
129
- const sound = { file: output, gainDb, preGain };
185
+ const channels = balances.get(clip.clip.id) ?? BALANCED;
186
+ await runFfmpeg(`Extracting the sound of clip ${clip.clip.id}`, buildClipSoundArgs({ ...clip, gainDb, output, peaks, balance: channels }), { ...(signal === undefined ? {} : { signal }), output });
187
+ const sound = { file: output, gainDb, preGain, channels };
130
188
  sounds[clip.clip.id] = sound;
131
- const line = describeSpeechPreGain(clip.clip.id, sound);
132
- if (line !== null)
133
- options.log?.(line);
189
+ for (const line of [describeChannelFold(clip.clip.id, channels), describeSpeechPreGain(clip.clip.id, sound)])
190
+ if (line !== null)
191
+ options.log?.(line);
134
192
  }
135
193
  return sounds;
136
194
  }
@@ -1 +1 @@
1
- {"version":3,"file":"clip-sound.js","sourceRoot":"","sources":["../../src/footage/clip-sound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAA4B,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;;;;GAOG;AAEH,0HAA0H;AAC1H,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,EAAW,CAAC;AAEzE,mGAAmG;AACnG,MA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
46
  };
47
+ /**
48
+ * How far a line of `role` placed by its top moves so its baseline stands where the render's does in a line box of
49
+ * `lineHeightEm` (`getDraftLineShift`), in px; 0 without the draft's fonts (as before).
50
+ */
51
+ lineShift: (role: DraftFontRole, cssPx: number, lineHeightEm: number) => number;
52
+ /** The same for a line placed by its middle (`getDraftMiddleShift`); 0 without the draft's fonts. */
53
+ middleShift: (role: DraftFontRole, cssPx: number) => number;
47
54
  }
48
55
  /**
49
56
  * A card's corner in px: its own token, else the brand style's (a search bar stays a pill unless it names its own),
@@ -1 +1 @@
1
- {"version":3,"file":"draft-overlays.d.ts","sourceRoot":"","sources":["../../src/footage/draft-overlays.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EAAwF,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE7I,OAAO,EAAyF,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9I,OAAO,EAeL,KAAK,WAAW,EAGjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAsCL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAErB,MAAM,eAAe,CAAC;AA8BvB,0HAA0H;AAC1H,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAOrF;AAcD,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAY3F;AAED,oHAAoH;AACpH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,M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,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,MAAM,CAU/H;AAqKD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAS9F;AAusBD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACxC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;CAAO,GACrJ,MAAM,EAAE,CAwBV"}
@@ -2,7 +2,7 @@ import { FOOTAGE_FPS } from "./normalize.js";
2
2
  import { getCornerRadiusPx } from "./brand-style.js";
3
3
  import { getDraftBoxEvents } from "./draft-boxes.js";
4
4
  import { toAssColor } from "./draft-color.js";
5
- import { DEFAULT_CONTENT_AREA, getSpacingWidth, toDraftAssSize, toDraftSpacing, wrapDraftLine } from "./draft-text-width.js";
5
+ import { DEFAULT_CONTENT_AREA, getDraftLineShift, getDraftMiddleShift, getSpacingWidth, toDraftAssSize, toDraftSpacing, wrapDraftLine } from "./draft-text-width.js";
6
6
  import { HAND_FONT, getHandFontAssSize } from "./hand-font.js";
7
7
  import { getCounterValueAt, getOverlayColors, getPlaceCardTimes, getTypingStep, getTypingTimes } from "./overlay-html.js";
8
8
  import { DROP_LETTER_SECONDS, NOTE_GROW_FROM_SCALE, NOTE_GROW_SECONDS, NOTE_TICK_SECONDS, OVERLAY_EASES, getDropLetterTimes, getFrameSteps, PIN_DROP_SECONDS, PIN_DROP_SHARE, UNDERLINE_EM, UNDERLINE_SECONDS, getEntranceMotion, getExitMotion, getWipeHalves, } from "./overlay-motion.js";
@@ -479,7 +479,7 @@ function getLaidOutSideTextEvents(overlay, context, measure) {
479
479
  const isTyped = overlay.entrance !== null && overlay.entrance !== "drop" && overlay.typing !== null;
480
480
  let typedBefore = 0;
481
481
  const lines = layout.lines.flatMap((line, index) => {
482
- const pos = { x: layout.textX, y: layout.textTop + index * lineHeight };
482
+ const pos = { x: layout.textX, y: layout.textTop + index * lineHeight + context.lineShift(role, fontSize, OVERLAY_LINE_HEIGHT) };
483
483
  const lineStart = overlay.typing === null ? span.start : span.start + typedBefore / overlay.typing;
484
484
  const count = [...line].length;
485
485
  const steps = overlay.entrance === "drop"
@@ -547,7 +547,8 @@ function getListEvents(overlay, context) {
547
547
  const name = overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance;
548
548
  const textTags = getTextTags(overlay, colors, context, OVERLAY_FONT_ROLES.list);
549
549
  const lines = getSideTextLines(overlay);
550
- const write = (pos, align, steps, motion, clip = "") => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags: `\\an${align}\\fs${context.toAssSize(OVERLAY_FONT_ROLES.list, fontSize)}${context.spacing(OVERLAY_LETTER_SPACING_EM.card, fontSize)}${textTags}${clip}`, steps, motion });
550
+ const shift = context.lineShift(OVERLAY_FONT_ROLES.list, fontSize, OVERLAY_LINE_HEIGHT);
551
+ const write = (at, align, steps, motion, clip = "") => getTextEvents({ layer: 4, style: "OverlayPlain", pos: { x: at.x, y: at.y + shift }, tags: `\\an${align}\\fs${context.toAssSize(OVERLAY_FONT_ROLES.list, fontSize)}${context.spacing(OVERLAY_LETTER_SPACING_EM.card, fontSize)}${textTags}${clip}`, steps, motion });
551
552
  if (overlay.chips !== undefined) {
552
553
  const covered = getChipCoveredTimes(overlay);
553
554
  return overlay.chips.flatMap((_chip, index) => {
@@ -701,7 +702,9 @@ function getCardEvents(overlay, context) {
701
702
  const tagsFor = (role) => getTextTags(overlay, colors, context, role);
702
703
  // The render spaces a title's heading lines tighter than the rest of a card's text, and a search query not at all.
703
704
  const spacingFor = (role) => overlay.kind === "search_bar" ? 0 : role !== "heading" ? OVERLAY_LETTER_SPACING_EM.card : overlay.kind === "hook_title" ? OVERLAY_LETTER_SPACING_EM.hookTitle : overlay.kind === "place_card" ? OVERLAY_LETTER_SPACING_EM.placeTitle : OVERLAY_LETTER_SPACING_EM.card;
704
- const text = (pos, align, size, role, steps, own = motion) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags: `\\an${align}\\fs${context.toAssSize(role, r0(size))}${context.spacing(spacingFor(role), r0(size))}${tagsFor(role)}`, steps, motion: own });
705
+ // Every card line is set by its top in the render's line box (a title's heading lines in theirs, the rest in `OVERLAY_LINE_HEIGHT`).
706
+ const lineBoxFor = (role) => (role === "heading" && overlay.kind === "place_card" ? OVERLAY_TITLE_LINE_HEIGHT : OVERLAY_LINE_HEIGHT);
707
+ const text = (at, align, size, role, steps, own = motion) => getTextEvents({ layer: 4, style: "OverlayPlain", pos: { x: at.x, y: at.y + (align >= 7 ? context.lineShift(role, r0(size), lineBoxFor(role)) : align >= 4 ? context.middleShift(role, r0(size)) : 0) }, tags: `\\an${align}\\fs${context.toAssSize(role, r0(size))}${context.spacing(spacingFor(role), r0(size))}${tagsFor(role)}`, steps, motion: own });
705
708
  const plain = { ...motion, name: "none", entrance: { kind: "none" } };
706
709
  if (overlay.kind === "hook_title" || overlay.kind === "place_card") {
707
710
  // The text block sits in the card's middle; centred lines on its axis, left ones from its left edge (RV-131).
@@ -905,7 +908,8 @@ function getNoteEvents(overlay, context) {
905
908
  const assSize = isStrip ? context.toAssSize("heading", overlay.fontSize) : getHandFontAssSize(overlay.fontSize);
906
909
  const tags = `\\an7\\fs${assSize}${isStrip ? context.spacing(OVERLAY_LETTER_SPACING_EM.strip, overlay.fontSize) : ""}${font}\\1c${toTagColor(colors.ink)}${turn}`;
907
910
  getNoteWordsByLine(overlay).forEach((words, index) => {
908
- const pos = { x: textBox.left, y: textBox.top + index * lineHeight };
911
+ // A strip's heading font stands on the render's baseline; the hand font is sized to its own letters (`getHandFontAssSize`).
912
+ const pos = { x: textBox.left, y: textBox.top + index * lineHeight + (isStrip ? context.lineShift("heading", overlay.fontSize, NOTE_LINE_HEIGHT) : 0) };
909
913
  const line = overlay.lines[index];
910
914
  const span = { start: overlay.start, end: overlay.end };
911
915
  if (isStrip) {
@@ -970,6 +974,8 @@ export function buildDraftOverlayEvents(overlays, colors, frame, options = {}) {
970
974
  measure: (role, text, cssPx, spacingEm) => (drawn === undefined ? estimateTextWidth(text, cssPx) : drawn[role].measure(text, cssPx) + getSpacingWidth(text, spacingEm, cssPx)),
971
975
  spacing: (spacingEm, cssPx) => (drawn === undefined || spacingEm === 0 ? "" : `\\fsp${String(toDraftSpacing(spacingEm, cssPx))}`),
972
976
  contentArea: (role) => drawn?.[role].contentArea ?? DEFAULT_CONTENT_AREA,
977
+ lineShift: (role, cssPx, lineHeightEm) => (drawn === undefined ? 0 : getDraftLineShift(drawn[role], cssPx, lineHeightEm)),
978
+ middleShift: (role, cssPx) => (drawn === undefined ? 0 : getDraftMiddleShift(drawn[role], cssPx)),
973
979
  ...(options.style === undefined ? {} : { style: options.style }),
974
980
  ...(drawn === undefined ? {} : { layout: (role, text, cssPx, spacingEm) => drawn[role].measure(text, cssPx) + getSpacingWidth(text, spacingEm, cssPx) }),
975
981
  };