incidentist / the_tuul

Make a decent karaoke video from any song in about 10 minutes.
https://the-tuul.com
17 stars 4 forks source link

Stagger line displays for screens that come up quickly #7

Closed incidentist closed 1 month ago

incidentist commented 2 years ago

Sometimes a screen will segue into the next screen very quickly and you don't have time to read what's on the next screen before it starts. Normal karaoke tracks get around this by displaying the first few lines of the next screen on top of the last few lines of the current screen. There is probably a way to tell when this is going to happen, and do it automatically.

incidentist commented 8 months ago

General process for staggering lyrics for a given screen:

if nextScreen.startTime > screen.endTime + MIN_PAUSE_BETWEEN_SCREENS: return;
if len(screen.lines) < 2: return; // We can't remove the line early if it's the only line

earlyRemovalLines = get 1 or 2 lines to remove early
set their displayEndTimes to .5sec after earlyRemovalLines[-1].endTimestamp.

earlyDisplayLines = Get len(earlyRemovalTimes) lines from nextScreen.
// ensure early lines don't display on top of current lines
If earlyDisplayLines[0].yPosition > earlyRemovalLInes[0].yPosition:
    adjust nextScreen.lines yPositions to match screen.lines.yPositions

set earlyDisplayLines.displayStartTimes to .1 sec after the earlyRemovalLines.displayEndTimes

Corner cases:

  1. screen 1 has 1 line
  2. screen 2 has many more lines than screen 1
  3. screen 2 has many fewer lines than screen 1
  4. screen 1 has two lines, the last of which is sung very quickly
incidentist commented 7 months ago

This is pretty cool, actually. Early-removal lines can fade out midway through the next line, and early-display lines from the next screen can fade in after the early-removal lines have faded out.

Currently encountering an issue where screen.length = 2 and nextScreen.length = 4 -- the yOffset is not working.