Skip to content

autodj: preroll transitions for gapless playback - #16063

Open
ywwg wants to merge 5 commits into
mixxxdj:mainfrom
ywwg:owilliams/autodj-gapless
Open

autodj: preroll transitions for gapless playback#16063
ywwg wants to merge 5 commits into
mixxxdj:mainfrom
ywwg:owilliams/autodj-gapless

Conversation

@ywwg

@ywwg ywwg commented Feb 27, 2026

Copy link
Copy Markdown
Member

Start playback of incoming tracks about 1.0s (corrected for the exact offset between tracks!) before the transition begins to prevent any audible gap between tracks due to buffer inconsistencies or delays in playback triggering.

Tested manually, sounds delicious. This is best with the following settings:

  • select 0 autodj transition time
  • "full track" autodj track duration (to prevent late start or early end)
  • disable quantization (to prevent extra seeks)
  • disable sync (to prevent rate adjustments)
  • disable loudness normalization, or tracks may change volume across the change (to prevent volume inconsistencies)

NOTE: this does not totally work on mp3 tracks, which cannot be sample-exact lengths. Instead, test with wav, aiff, flac, or ogg. "skip silence" mode works a little better, but it's not perfect and sometimes messes up the transitions for non-mp3 tracks. A subsequent PR could introduce a new skip algorithm that takes mp3 frames into account.

Initially created with claude but I edited it a lot since then so now it's all mine.

@ywwg

ywwg commented Feb 27, 2026

Copy link
Copy Markdown
Member Author

oh right I need to update tests as well

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “pre-roll” playback for the incoming deck during AutoDJ so the next track is already running before the crossfader transition starts, reducing audible gaps from playback start latency.

Changes:

  • Start the “to” deck ~1s before fadeBeginPos while still in ADJ_IDLE, seeking it back so it aligns at fade start.
  • Add a gtest covering the early-play pre-roll behavior in FixedFullTrack mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
src/library/autodj/autodjprocessor.cpp Implements early-start logic for the incoming deck during ADJ_IDLE before fading begins.
src/test/autodjprocessor_test.cpp Adds a regression test verifying the pre-roll behavior and that fading still starts at fadeBeginPos.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/library/autodj/autodjprocessor.cpp Outdated
Comment thread src/library/autodj/autodjprocessor.cpp
Comment thread src/library/autodj/autodjprocessor.cpp Outdated
Comment thread src/library/autodj/autodjprocessor.cpp Outdated
Comment thread src/library/autodj/autodjprocessor.cpp Outdated
Comment thread src/test/autodjprocessor_test.cpp
Comment thread src/library/autodj/autodjprocessor.cpp Outdated
ywwg added 3 commits April 2, 2026 13:36
Start playback of incoming tracks before the transition begins, to prevent any audible gap between tracks due to buffer inconsistencies or delays in playback triggering.

Tested manually, sounds delicious

Signed-off-by: Owen Williams <owilliams@mixxx.org>
Signed-off-by: Owen Williams <owilliams@mixxx.org>
…eek requests.

Also removes ADJ_ENABLE_P1PLAYING state, which was unused.

Signed-off-by: Owen Williams <owilliams@mixxx.org>
@ywwg
ywwg force-pushed the owilliams/autodj-gapless branch from 406afc9 to 29b261c Compare April 2, 2026 17:37
@ywwg

ywwg commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

looks like I have to fix a test

Comment thread src/library/autodj/autodjprocessor.cpp
@github-actions

Copy link
Copy Markdown

This PR is marked as stale because it has been open 90 days with no activity.

@github-actions github-actions Bot added the stale Stale issues that haven't been updated for a long time. label Jul 11, 2026
@ywwg
ywwg requested a review from jclsn July 27, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autodj code quality library stale Stale issues that haven't been updated for a long time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants