Repository navigation
Gapless playback and crossfade - #158
Merged
Merged
Conversation
The pre-loaded next song starts just before the current one ends (gapless), or fades in over the Settings crossfade length while the current one fades out. Same-album songs, DJ sets and repeat-one stay gapless; iOS, which ignores element volume, plays gapless only. Closes #155 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcNpPocCZdNRCmS9c36eBh
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcNpPocCZdNRCmS9c36eBh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tom · project thread
Before: the next song only started after the current one fired
ended, which left a short gap between tracks (noticeable on live and continuous albums), and there was no crossfade.After: songs play back to back with no gap, and Settings → Playback has a Crossfade slider (Off, or 1 to 12 seconds, per device) that fades the end of each song into the next. Songs from the same album, DJ sets and repeat-one always stay gapless; skipping by hand still changes song at once.
How: the player already pre-loads the next song in a second audio element. In the last second before the hand-over,
PlayerRuntimesets a timer to start it about 0.12 s early (gapless) or by the crossfade length, but only if that element has buffered enough to start at once; otherwise it falls back to the oldendedpath. The element handed over from plays out or fades on equal-power curves through a per-element fade level that multiplies the existing volume and normalisation scale. When it finishes, the element loads the song after next. The play is counted and scrobbled as completed at the hand-over. iPhone and iPad ignore element volume, so they get gapless only (volumeCanFade). Logic insrc/lib/crossfade.ts, setting insrc/stores/crossfade.ts.Frontend only: merging deploys the site, with no Worker or agent changes.
Closes #155
Generated by Claude Code