mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Summary NOMAD-1779 (job `58555663`) shipped with two lyric lines drawn on top of each other near the end of the song (YouTube comment: "the lyrics get kinda messed up towards the end"). **Cause:** lines are split by character count (`max_line_length`, 40 for Nomad). Wide-glyph lines like "Mm- mm- mm, mm- …" pass that but measured ~3890px on the 3840px frame. libass wraps an over-wide event by itself; rows are exactly one line-height apart, so the wrapped half landed on the next row's lyrics. **Fix:** `SubtitlesGenerator.generate_ass` now measures each line in the style font, scaled the way libass sizes it (existing `LyricsLine._measure_text` / `ass_font_scale`), and splits any line wider than 94% of the frame at a word boundary (`SegmentResizer.split_to_width`, prefers phrase-ending punctuation, keeps word timing, shares translations). Applies to every ASS render (main, portrait, theme previews). Lines that fit are untouched. **Scope:** of 309 completed branded jobs since 2026-09-10, only 1779 had an overlap; 4 more (1759, 1738, 1766, NOMADNP-0264) had a line wrapping into an empty row. ## Testing - New `tests/unit/lyrics_transcriber/output/test_line_width_split.py`: split logic (fits / splits / phrase break / balance / single long word / timing / translation / singer), ASS generation, and a **real libass render** asserting each lyric event draws as exactly one row. Verified the render test fails with the fix disabled. - Regenerated 1779's ASS from its `corrections_updated.json` with the real theme font and rendered 2:58 with ffmpeg/libass: old ASS reproduces the overlap exactly, new one renders 4 clean lines (widest 3502px). - Locally: 1968 unit + 7231 backend tests pass. Failures were environmental only (shared conda env lacks `flacfetch`: 6 unit + 2 collection errors; `test_emulator_integration.py` fails identically on `origin/main` locally). - CodeRabbit CLI (local, committed): no findings. After deploy: admin re-render of 58555663. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012RYLVW1AnhNWu2qGLaNvxu --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>