Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: cut a hook at the next cue's onset instead of holding to the beat (#10804)
[._.]/ Adam Eivy25b6789204c0
diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.js b/server/services/musicVideo/documentTemplates/shared/lyricType.jsindex 0ac753092f..a440b7c9a4 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.js@@ -152,7 +152,7 @@ function wordsForLine(line, songWords = []) {* stays at least LYRIC_TIMING.minOnScreenSec unless another cue takes its zone.* `line`/`data` fade 0.3s after the last word ends, finishing by the next cue in* their zone (or cutting at its onset when a full fade cannot fit). A `stamp`- * cuts after its hold; a `hook` cuts on the next beat, with no fade.+ * cuts after its hold; a `hook` cuts on the next beat (or at the next cue if that comes first), with no fade.*/function lineWindow(words, role, { beats = [], nextOnset = null, fps = 24, endSec = null } = {}) {const T = LYRIC_TIMING;@@ -164,7 +164,9 @@ function lineWindow(words, role, { beats = [], nextOnset = null, fps = 24, endSeconst sorted = beats.filter(finite);const from = Math.max(lastEnd, last.startSec, minExit);const index = lastAtOrBefore(sorted, from - 1e-6) + 1;- const exitSec = index < sorted.length ? sorted[index] : from + T.lineExitDelaySec;+ let exitSec = index < sorted.length ? sorted[index] : from + T.lineExitDelaySec;+ // Never hold past the next cue: two hooks on screen together would collide.+ if (finite(nextOnset) && nextOnset > onset && nextOnset < exitSec) exitSec = nextOnset;return { startSec: onset, exitSec, endSec: exitSec };}let exitSec = lastEnd + T.lineExitDelaySec;diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js b/server/services/musicVideo/documentTemplates/shared/lyricType.test.jsindex e52e12a99c..b5bd078f92 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.test.js@@ -111,6 +111,15 @@ describe('lyricType timing', () => {expect(type.lines[0].endSec - type.lines[0].exitSec).toBeCloseTo(8 / 24, 6);});+ it('cuts a hook at the next hook onset when it comes before the beat', () => {+ const type = createLyricType({ song: { beats: [1, 3.5] } }, { exclusive: false, lines: [+ { text: 'Example hook', role: 'hook', zone: 'upper-right', words: words('Example hook', 2, 0.02) },+ { text: 'Example hook next', role: 'hook', zone: 'upper-right', words: words('Example hook next', 2.35, 0.02) },+ ] });+ expect(type.lines[0].endSec).toBeLessThanOrEqual(type.lines[1].startSec);+ expect(type.lines[0]).toMatchObject({ exitSec: 2.35, endSec: 2.35 });+ });+it('preserves hook beat cuts and stamp minimum holds for crowded cues', () => {const type = createLyricType({ song: { beats: [3, 4] } }, { exclusive: false, lines: [{ text: 'Example hook', role: 'hook', words: words('Example hook', 2, 0.02) },@@ -118,7 +127,7 @@ describe('lyricType timing', () => {{ text: 'Example stamp', role: 'stamp', words: words('Example stamp', 5, 0.02) },{ text: 'Example stamp next', role: 'stamp', words: words('Example stamp next', 5.1, 0.02) },] });- expect(type.lines[0]).toMatchObject({ exitSec: 3, endSec: 3 });+ expect(type.lines[0]).toMatchObject({ exitSec: 2.1, endSec: 2.1 });expect(type.lines[2].exitSec).toBeCloseTo(5.8, 6);expect(type.lines[2].endSec).toBe(type.lines[2].exitSec);});