musescore / musescore/MuseScore

Loop Playback Offset

Open
#34,846 0 comments 0 reactions 1 assignee View on GitHub

@RomanPudashkin is already working on this.

Since Sep 8, 2026.

P2 playback regression MS4
Dominant language
C++
Stars
15.1k
Forks
3.3k
Avg merge
2d 2h
Merged PRs (30d)
91

Description

Issue type

General playback bug

Description with steps to reproduce

When selecting a range of measures and enabling Loop Playback, the visual playback cursor correctly looped back to the beginning of the selected range. However, the audio did not. After the first pass through the selected measures, the audio continued from the following measures instead of restarting at the loop beginning.

The amount of the audio offset corresponded exactly to the length of the selected loop. For example, looping measures 4–6 caused the second audio pass to play measures 7–9, while the visual playback remained on 4–6.

I traced the problem to framework/audio/engine/internal/contextplayer.cpp, specifically ContextPlayer::proc_onTimeChanged().

When the loop end was reached, the code correctly calculated the wrapped playback position:

m_timeLoopStart + overshoot

and returned that position as the new current position. However, the LoopEnded event sent to the engine thread contained the original, unwrapped newTime instead. The engine thread subsequently called seekAllTracks() using that incorrect position, causing the audio sources to seek past the loop boundary.

The patch makes the LoopEnded event use the same wrapped loopPosition that is returned as the new current position.

Supporting files, videos and screenshots

musescore-loop-playback-fix.patch

In which versions of MuseScore Studio is this issue present?

5.0.0 git 56436d2c96954b1440221d0dcafef6badb302e93

Regression

Yes, this used to work in a previous version of MuseScore 4.x

Operating system

ubuntu 26.04

Additional context

No response

Checklist
  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.