Skip to content

Add synced lyrics display with LrcLib#2055

Open
guitaripod wants to merge 1 commit intostrawberrymusicplayer:masterfrom
guitaripod:synced-lyrics
Open

Add synced lyrics display with LrcLib#2055
guitaripod wants to merge 1 commit intostrawberrymusicplayer:masterfrom
guitaripod:synced-lyrics

Conversation

@guitaripod
Copy link
Copy Markdown

@guitaripod guitaripod commented Apr 4, 2026

Summary

Strawberry already fetches lyrics from LrcLib, but discards the syncedLyrics field and only uses plainLyrics. This PR threads time-synced LRC data through the entire lyrics pipeline and displays it as a real-time scrolling view in the context panel.

Screencast_20260405_093914.mp4
  • LrcLib provider now extracts and parses the syncedLyrics JSON field that was previously ignored
  • New LrcParser utility parses [MM:SS.CC] LRC timestamps into structured LyricLine objects
  • New SyncedLyricsWidget (QListWidget subclass) displays lyrics line-by-line with:
    • Smooth pixel-level animated scrolling (QPropertyAnimation + ScrollPerPixel)
    • Current line highlighted in bold with full opacity
    • Distance-based fade effect — lines farther from current gradually dim
    • Click any line to seek playback to that timestamp
    • Auto-scroll pauses for 3 seconds when user scrolls manually
  • ContextView gets a 250ms position sync timer that polls the engine and updates the lyrics widget
  • Falls back gracefully to the existing plain text display when synced lyrics aren't available
  • All other lyrics providers continue to work unchanged

Setup

To see synced lyrics, LrcLib must be enabled in your lyrics provider settings:

  1. Go to Tools → Settings → Lyrics
  2. Check the LrcLib checkbox to enable it
  3. Optionally drag LrcLib to the top of the list for priority
  4. Click OK and play a track

LrcLib has excellent coverage for popular music. If a track has synced lyrics available on lrclib.net, they will display automatically. Otherwise, plain text lyrics from other providers are shown as before.

New files

File Purpose
src/lyrics/lyricline.h LyricLine struct (timestamp + text) and SyncedLyrics type
src/lyrics/lrcparser.h/.cpp LRC format timestamp parser
src/context/syncedlyricswidget.h/.cpp Synced lyrics display widget

Modified files

File Change
lyricssearchresult.h Added synced_lyrics field
lrcliblyricsprovider.cpp Extracts syncedLyrics from API response
lyricsfetchersearch.h/.cpp Threads synced lyrics through signals, +0.5 score bonus
lyricsfetcher.h/.cpp Threads synced lyrics through signals
contextview.h/.cpp Integrates widget, position timer, Player reference
mainwindow.cpp Passes player to ContextView, connects Paused/Resumed/Seeked signals
CMakeLists.txt Registers new source and header files

@guitaripod guitaripod force-pushed the synced-lyrics branch 8 times, most recently from 99644d1 to 827459c Compare April 5, 2026 06:37
LrcLib already returns time-synced lyrics in its API response but
Strawberry was discarding them and only using plain text. This change
threads synced LRC data through the entire lyrics pipeline and displays
it as a real-time scrolling lyrics view in the context panel.

When synced lyrics are available, a SyncedLyricsWidget replaces the
static text display. A 250ms timer polls the engine position and
highlights the current line with smooth animated scrolling. Lines fade
with distance from the current position for a depth effect. Clicking
any line seeks playback to that timestamp. Falls back to plain text
when synced lyrics are not available.
@jonaski
Copy link
Copy Markdown
Member

jonaski commented Apr 7, 2026

This is great, but needs to be optional. Also, when testing here there is a huge gap between the album cover and the lyrics:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants