-
feat(foundry): lyric-aware vocal sampler (engine/vox.py) — phrase-level,… · c5963f63
feat(foundry): lyric-aware vocal sampler (engine/vox.py) — phrase-level, hook-ranked, loop-capable vox one-shots PROBLEM. The Foundry's vocal path (loops.analyze_chops) cuts vocals blind to what is sung — onset→onset slices scored on seam/zc mechanics. But a vocal one-shot's value to a livecoder IS the lyric. The freshly-shipped superfreak dub kit had four tiny 0.35-0.65s onset chops (03-06) with no idea they sat on top of some of the most iconic lyrics in funk ("she's a super freak", "kinky girl", "the kind you read about"). APPROACH. engine/vox.py: transcribe → phrase-segment → iconicity-rank → cut → grade → lyric-name, DRY-reusing grade.py sub-scorers and naming.py convention. - transcribe: whisper word-level timestamps, shelled out like separate.py→demucs, cached at workspace/vox_transcript.json so re-runs are instant. Model escalates small→medium empirically when the known hooks don't surface (small garbled the patois delivery; medium recovers the real lyrics). - segment: group words on inter-word gaps (>=0.45s), cap 6s, split over-long phrases at their widest interior gap; keep per-phrase avg ASR confidence. - iconicity: feature-engineered rank = repetition (normalized phrase text + content n-grams recurring across the track — hooks repeat) + hook keywords (title-derived or --hooks) + clarity (ASR prob) + energy (RMS vs stem median) + duration sweet-spot. - cut: pre-pad + post-pad (clamped to next phrase), zero-crossing snap both edges, 3-10ms fades so edge samples are ~0 regardless of where the snap landed; as-cut level. - kit-level loopability: report each phrase's duration in BEATS at the kit BPM; flag loop-capable phrases (within ±3% of a 1/2/4-bar multiple) and emit a bar-quantized _loop variant (tail pulled to the exact beat grid, still zc-snapped) for the best hooks, so a vocal can loopAt alongside instrument loops. - name: NN_vox_<lyricslug> (naming.lint-clean), dedup identical texts (best-graded instance, up to 2 takes of THE hook). VALIDATION. 17 new mocked-transcription tests (whisper never runs in tests): gap segmentation, over-long split, iconicity repetition-beats-oneoff + hook-keyword boost, beat/loop annotation, cut edges ~0 after zc+fade, next-start clamp, exact-beat loop variant, lyric-slug + lint contract. Full suite 60->77 green. Applied to the superfreak stem: medium transcript contains every iconic line; shipped 6 curated vox files (S/B tier) replacing the 4 blind chops, incl. one 2-bar (8.00-beat) loop variant. All re-graded on disk: no clip (peaks <0.8), no DC (<2e-4), edges exactly 0.0.PLN (Algolia) authoredc5963f63
×