psst icon indicating copy to clipboard operation
psst copied to clipboard

Sync lyrics highlighting with playback progress

Open Cleboost opened this issue 5 months ago • 4 comments

This pull request introduces enhancements to playback state management and lyrics synchronization within the psst-gui application. Key changes include the addition of playback state tracking in the CommonCtx, a new LyricsTicker controller for real-time updates, and improvements to the lyrics widget for dynamic synchronization with playback progress.

Playback State Management Enhancements:

  • psst-gui/src/data/mod.rs: Added progress, last_update_ms, and playback_state fields to CommonCtx for tracking playback progress and state. Introduced a helper method set_common_progress to update progress and timestamp consistently. [1] [2] [3]

Lyrics Synchronization Improvements:

  • psst-gui/src/ui/lyrics.rs: Added a LyricsTicker controller for periodic updates to the lyrics widget, ensuring synchronization with playback progress. [1] [2]
  • psst-gui/src/ui/lyrics.rs: Enhanced the lyrics widget to dynamically highlight lyrics based on playback progress, using calculated offsets and playback state. [1] [2]

These changes improve the user experience by providing accurate playback state tracking and seamless lyrics synchronization during music playback.

close https://github.com/jpochyla/psst/issues/658

{64E46E0B-2038-449D-B825-85BA8F226241}

Cleboost avatar Jul 07 '25 22:07 Cleboost

This looks great! One think I was wondering is if your explored tracking the playback state (elapsed time) from the same tracker that is used as the reference for the seek bar UI? It would be nice if we had a single global tracking implementation that the lyrics could then just tie into.

jacksongoode avatar Jul 08 '25 01:07 jacksongoode

I tried to implement it with the tracking already in place, but I couldn't. It lacks precision on the timer update. It lacks precision on the timer update, which creates a visible discrepancy between speech and sound. I couldn't find any other way but to make my own timer faster, but I admit it's not the best solution.

Cleboost avatar Jul 08 '25 07:07 Cleboost

I think my last commit has a better management of timer

Cleboost avatar Jul 14 '25 10:07 Cleboost

This looks a lot better in the last commit. However, and I'm not so familiar with the report precision. It might be interesting if the CPU cycles are greater with this PR. Maybe if you're interested, could you check to make sure this doesn't use a lot more CPU by increasing the timing precision?

jacksongoode avatar Dec 02 '25 14:12 jacksongoode