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
feat: flag lyric words aligned into vocal-stem silence and mark mix-only alignments stale once a stem exists (#10610)
[._.]/ Adam Eivy0962bc949b54
diff --git a/server/lib/musicVideoSummary.js b/server/lib/musicVideoSummary.jsindex 5c676676ad..47827d0c4a 100644--- a/server/lib/musicVideoSummary.js+++ b/server/lib/musicVideoSummary.js@@ -11,6 +11,16 @@ import { isLayeredComposition, sceneRenderReady } from './musicVideoLayers.js';import { latestMusicVideoReviewDraft } from './musicVideoReviewDraft.js';import { finishedOutsideCovers } from './musicVideoFinishedOutside.js';+/**+ * True when the project's word timings came from the full mix but a vocal+ * stem has since been attached: they are provisional until re-aligned.+ */+function isLyricAlignStale(project) {+ const hasWords = (project?.lyricCues || []).some((cue) => (cue.words || []).length > 0);+ return Boolean(hasWords && project.vocalStemFilename && project.lyricAlignSource !== 'vocal-stem');+}++// The six steps (Song, Look, Storyboard, Make, Final render, Publish); Make (`produce`) absorbed Compose.const STAGE_IDS = ['setup', 'cast-sets', 'board', 'produce', 'review', 'publish'];const RESUMABLE_RUN_STATUSES = new Set(['running', 'stopped', 'limit-reached', 'blocked', 'needs-replan']);@@ -175,6 +185,8 @@ export function summarizeMusicVideoProject(project, readiness) {},vocalStemFilename: project.vocalStemFilename || null,midiTranscription: Boolean(project.midiTranscription),+ lyricAlignStale: isLyricAlignStale(project),+ lyricAlignSilentWords: project.lyricAlignSilentWords ?? null,composition: { mode: project.composition?.mode },concept: { style: concept.style || concept.prompt || null, universeId: concept.universeId || null },visualSpec: { palette: Array.isArray(project.visualSpec?.palette) ? project.visualSpec.palette.slice(0, 5) : [] },diff --git a/server/lib/musicVideoSummary.lyricAlign.test.js b/server/lib/musicVideoSummary.lyricAlign.test.jsnew file mode 100644index 0000000000..2b5dbcd57c--- /dev/null+++ b/server/lib/musicVideoSummary.lyricAlign.test.js@@ -0,0 +1,14 @@+import { describe, expect, it } from 'vitest';+import { summarizeMusicVideoProject } from './musicVideoSummary.js';++const words = [{ text: 'hi', startSec: 1, endSec: 2, conf: 'matched' }];+const base = { id: 'p1', name: 'x', lyricCues: [{ id: 'c', text: 'hi', words }] };++describe('summary lyricAlignStale (#10610)', () => {+ it('is stale only when a stem arrived after a master-only alignment', () => {+ const stale = (extra) => summarizeMusicVideoProject({ ...base, ...extra }, {}).lyricAlignStale;+ expect(stale({ vocalStemFilename: 's.wav', lyricAlignSource: 'master' })).toBe(true);+ expect(stale({ vocalStemFilename: 's.wav', lyricAlignSource: 'vocal-stem' })).toBe(false);+ expect(stale({ lyricAlignSource: 'master' })).toBe(false);+ });+});diff --git a/server/services/musicVideo/lyricAlign.js b/server/services/musicVideo/lyricAlign.jsindex 282e84a82a..4ba7ef09a0 100644--- a/server/services/musicVideo/lyricAlign.js+++ b/server/services/musicVideo/lyricAlign.js@@ -32,6 +32,7 @@ import {vocalPcm,wavDurationSec,pickAlignmentPath,+ findSilentWords,} from './lyricAlignCore.js';import { relabelAnalysisSections } from './lyricMarkers.js';@@ -191,7 +192,12 @@ export async function alignProjectLyrics(projectId, options = {}) {}const matched = nextCues.reduce((sum, entry) => sum + (entry.words || []).filter((word) => word.conf === 'matched').length, 0);console.log(`🎤 Aligned lyric words from the ${source}${mixWav ? ' + mix' : ''} via ${transcriber.kind} (${matched} words matched)`);- const patch = { lyricCues: nextCues };+ const patch = { lyricCues: nextCues, lyricAlignSource: source };+ if (mixWav) {+ const silentWords = findSilentWords(nextCues, vocalPcm(wav)).length;+ patch.lyricAlignSilentWords = silentWords;+ if (silentWords > 0) console.warn(`⚠️ ${silentWords} aligned lyric words sit in silence in the vocal stem; their timing is suspect`);+ }if (!cueId) {const analysis = relabeledAnalysis(fresh, nextCues);if (analysis) patch.audioAnalysis = analysis;diff --git a/server/services/musicVideo/lyricAlignCore.js b/server/services/musicVideo/lyricAlignCore.jsindex ae29143875..78399f42b1 100644--- a/server/services/musicVideo/lyricAlignCore.js+++ b/server/services/musicVideo/lyricAlignCore.js@@ -828,6 +828,31 @@ export async function pickAlignmentPath(project, io = {}) {return { path: await resolveMaster(project), source: 'master', mixPath: null };}+// A word sung at -50 dBFS RMS or quieter in an isolated vocal is not being+// sung; the vocal-phrase detector's own floor is -40 dB over 10 ms hops.+const SILENT_WORD_RMS = 10 ** (-50 / 20);++/**+ * Words whose timed window is silent in the isolated vocal stem. Whisper word+ * times in sung music drift early, so a word placed in stem silence is a+ * timing that cannot be right (#10610). Returns [{ cueId, wordIndex }].+ */+export function findSilentWords(cues, stemPcm, sampleRate = LYRIC_ALIGN_SAMPLE_RATE) {+ const silent = [];+ for (const cue of cues || []) {+ (cue.words || []).forEach((word, wordIndex) => {+ if (typeof word.startSec !== 'number' || typeof word.endSec !== 'number' || word.endSec <= word.startSec) return;+ const from = Math.max(0, Math.floor(word.startSec * sampleRate));+ const to = Math.min(stemPcm.length, Math.ceil(word.endSec * sampleRate));+ if (to <= from) return;+ let sum = 0;+ for (let i = from; i < to; i++) sum += stemPcm[i] * stemPcm[i];+ if (Math.sqrt(sum / (to - from)) < SILENT_WORD_RMS) silent.push({ cueId: cue.id, wordIndex });+ });+ }+ return silent;+}+export {lyricAlignChunkSec,lyricAlignFfmpegArgs,diff --git a/server/services/musicVideo/lyricAlignCore.test.js b/server/services/musicVideo/lyricAlignCore.test.jsindex 7814a81c0a..68b32f048a 100644--- a/server/services/musicVideo/lyricAlignCore.test.js+++ b/server/services/musicVideo/lyricAlignCore.test.js@@ -103,3 +103,17 @@ describe('phrase lyric matching', () => {expect(snapLineStarts(aligned, [1, 3, 10], cues)).toEqual(aligned);});});++describe('findSilentWords (#10610)', () => {+ it('flags only words whose window is silent in the stem', async () => {+ const { findSilentWords } = await import('./lyricAlignCore.js');+ const rate = 16000;+ const pcm = new Float32Array(rate * 4);+ for (let i = rate; i < rate * 2; i++) pcm[i] = 0.3 * Math.sin(i / 10);+ const cues = [{ id: 'a', words: [+ { text: 'sung', startSec: 1.1, endSec: 1.8 },+ { text: 'early', startSec: 2.5, endSec: 3 },+ ] }];+ expect(findSilentWords(cues, pcm, rate)).toEqual([{ cueId: 'a', wordIndex: 1 }]);+ });+});