Score doesn't start playback after a certain length (including repeats) and crashes if started before and reaching that limit

• Feb 18, 2022 - 10:37
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
active
Regression
Yes
Workaround
No
Project

I have a bit of an odd situation but it happened so here we go...
I use Musescore to organize my practice sessions, write exercises, adjust number of repetitions for exercises , etc, so some of my scores are pretty lengthy, for example: if i have 10 patterns each is made of 4 measures each played in 12 Keys = 480 measures, say each pattern is repeated for at least 8 times (i use an auto-clicker to quickly change the "play count" of the whole score) so its fairly common for me to have a score that is actually thousands of measures long when considering the repeats.
Also I can also imagine someone could need to make a very long score if he/she is making an exercise book on Musescore
the problem is:
On these longer scores Musescore refuses to play beyond a maximum number of bars, ie when selecting a measure near the end it doesn't play and rewinds to the beginning of the score. I tried this on several computers and i always get the same result
you can easily replicate the bug following these steps:

1- Create a new score
2- Create a repeat sign to encompass the first 3 measures
3- Right-click on the 3rd measure to set play count
4- Enter 9999 as the play count and click OK
5- select the forth measure and press space bar to start playing
6- Nothing will happen
7- Press space-bar again playback will restart from the very beginning of the score

So as the title said... What is the maximum length for the score ?
Thank you in Advance

Attachment Size
test.mscz 4.76 KB

Comments

Status active closed

There is no maximum, practically. Theoretically you can't have more than 2147483647 measures, I believe

The issue tracker is not for asking questions (that's what the forums are for), but for reporting bugs

If your question "what is the maximum value for repeats", the answer seems to be:

a) 9999 (as you found out) is the max value you can have in the measure's properties
b) but that doesn't really work. The real value (where the playback does start properly) seems to be 8115 (found by experiment)
c) even that value causes a crash after playing some measures...

So we may turn this into a bug report...

i certainly cannot play 2147483647 bars on musescore, the number is less than 30000 bars, if it happens consistently it is a bug

Title What is the maximum length for the score ? What is the maximuTHe quesion m length for the score ?

You might be able to play the said number of bars with no repeats, but when having repeats in the score the total amount of bars is less than 30000 for some reason,

Title What is the maximum length for a score ? Score doesn't playback if exceeding a certain length (including repeats)
Severity S3 - Major S2 - Critical
Status closed active

Your're right, playback doesn't work after measure 24348 (in a 4/4 timesig) and even chrashes when starting before but reaching at that spot.
See no-playback+crash.mscz

Go to the last page and start playback at measure 24349 or later: jumps back to measure 1
Go to the last page and start playback at measure 24348 or earlier: MuseScore crashes

MuseScore 3.6.2, Windows 11

And yes, you do reach/exceede those 24348 measures with a 8116 times repeat of 3 measures too (8116 * 3 is 24348)
See test_0.mscz

24.348 * 4 is 97392 quarter beats, it crashes on 97393

Attachment Size
no-playback+crash.mscz 29.78 KB
test_0.mscz 4.41 KB

Stack trace

1 Ms::Seq::process seq.cpp 986 0x475908
2 Ms::paCallback pa.cpp 52 0x78254b
3 portaudio!Pa_WriteStream 0x7ff967125258
4 portaudio!Pa_WriteStream 0x7ff9671258aa
5 portaudio!PaWasapi_ThreadPriorityRevert 0x7ff96713e06c
6 portaudio!PaUtil_InitializeX86PlainConverters 0x7ff9671694d4
7 KERNEL32!BaseThreadInitThunk 0x7ff980cc54e0
8 ntdll!RtlUserThreadStart 0x7ff9816c485b
9 ??

Title Score doesn't playback if exceeding a certain length (including repeats) Score doesn'tstart playback after a certain length (including repeats) and crashes if started before and reaching that limit
Title Score doesn'tstart playback after a certain length (including repeats) and crashes if started before and reaching that limit Score doesn't playback if exceeding a certain length (including repeats)

A time-related variable overloading? Slow the tempo and it crashes sooner, speed it up and it crashes later. somewhere around 12½ hours?

Title Score doesn't playback if exceeding a certain length (including repeats) Score doesn'tstart playback after a certain length (including repeats) and crashes if started before and reaching that limit
Workaround Yes No

Well, no workaround really, other than keeping the score shorter, but I guess that doesn't count

Yes! The crash indeed depends on the tempo (too)! So the above crashes reproduce at the default of 120 BPM

More like 13½ hours apparently: 13 h, 31 minutes and 35 seconds (or 48695 s)

Regression No Yes

1.3 does not (it doesn't playback those sample scores, need to have notes in there, but then it just works)
So a 2.0 regression

Upon debugging the crash I've encountered some initial close-to-overflow values around that area:
playFrame: 2147471568 (close to signed 32-bit overflow)
framesRemain: 4294955216 (which seems to be already wrapped from -12080?)

It's the latter that is used as a loop boundary to access the buffer, but the buffer is not that big, so an indexing/buffer overflow likely happens.

Title Score doesn'tstart playback after a certain length (including repeats) and crashes if started before and reaching that limit Score doesn't start playback after a certain length (including repeats) and crashes if started before and reaching that limit

Given that master doesn't crash and no further 3.x's are foreseen; I'd propose we revisit this after 4.0 alpha to see where/how the max score limit is achieved/handled there.