dj sets + lyrics: a mix that names its own tracks, and words pulled off the separated voice
This commit is contained in:
1 parent
4efe85b6bf
commit
1dd8573808
41 files changed
+9288
-647
No files matched your search
@@ -1410,6 +1410,7 @@ pub async fn lyrics_get(
|
||||
let payload = payload_from(user, offset, duration_secs);
|
||||
if payload.status != "none" {
|
||||
return Ok(finish_synced(
|
||||
&app,
|
||||
payload,
|
||||
entry.auto_sync_off,
|
||||
path.as_deref(),
|
||||
@@ -1514,6 +1515,7 @@ pub async fn lyrics_get(
|
||||
let payload = payload_from(doc, offset, duration_secs);
|
||||
if payload.status == "synced" {
|
||||
return Ok(finish_synced(
|
||||
&app,
|
||||
payload,
|
||||
entry.auto_sync_off,
|
||||
path.as_deref(),
|
||||
@@ -1603,6 +1605,7 @@ pub async fn lyrics_get(
|
||||
// local copy may be the corrected one).
|
||||
if payload.status == "synced" || payload.status == "instrumental" {
|
||||
return Ok(finish_synced(
|
||||
&app,
|
||||
payload,
|
||||
entry.auto_sync_off,
|
||||
path.as_deref(),
|
||||
@@ -1638,6 +1641,7 @@ pub async fn lyrics_get(
|
||||
|
||||
/// Stamp the auto-sync fields onto a winning synced payload.
|
||||
async fn finish_synced(
|
||||
app: &tauri::AppHandle,
|
||||
mut payload: LyricsPayload,
|
||||
auto_sync_off: bool,
|
||||
path: Option<&str>,
|
||||
@@ -1649,6 +1653,35 @@ async fn finish_synced(
|
||||
let first = payload.synced.first().map(|l| l.time_ms);
|
||||
payload.auto_offset_ms =
|
||||
compute_auto_offset(path, duration_secs, source_duration_secs, first).await;
|
||||
// Second evidence source, consulted only when the corroborated
|
||||
// duration/silence probe found nothing: the word-timing artifact.
|
||||
// When forced alignment has already measured this file against this
|
||||
// doc and the sung words consistently start N ms from their cues,
|
||||
// that median is the doc's shift. Cache read only — never computed
|
||||
// here. (Aligned WORD times themselves are absolute and exempt from
|
||||
// this offset; only line cues move. See ArtifactLine::ctc.)
|
||||
if payload.auto_offset_ms == 0 {
|
||||
if let Some(p) = path {
|
||||
// The exact shape the word-timing request sends: original
|
||||
// indexes, empties dropped — the artifact key depends on it.
|
||||
let lines: Vec<crate::lyric_prep::PrepLine> = payload
|
||||
.synced
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, l)| crate::lyric_prep::PrepLine {
|
||||
index: i as u32,
|
||||
time_ms: l.time_ms as i64,
|
||||
text: l.text.clone(),
|
||||
})
|
||||
.filter(|l| !l.text.trim().is_empty())
|
||||
.collect();
|
||||
if let Some(shift) =
|
||||
crate::lyric_prep::cue_shift_evidence(app, Path::new(p), &lines)
|
||||
{
|
||||
payload.auto_offset_ms = shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
payload
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user