MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

For large scores exported as audio or played continuously, MuseSounds staves are out of sync with the other staves

Open metasekk opened this issue 2 years ago • 7 comments

Issue type

General playback bug & Muse Sounds bug

Bug description

When a score becomes large enough and is exported as audio (e.g. mp3) or played without interruption, there comes a point when the staves that use MuseSounds will sound distinctly out of sync with (specifically, ahead of) the ones that don't use MuseSounds. The delay between staves is increasing gradually. It happens in the exported audio file, and it is reflected in the playback of the score if the latter is sustained long enough.

Steps to reproduce

  1. Create a new empty score with at least one staff using a MuseSounds instrument, and one that doesn't;

  2. Add many bars (for instance 999);

  3. Go to the beginning of the score;

  4. Write the same notes on the two staves mentioned above, so that they should play at the same time. During playback, hear that they are indeed synchronized;

  5. Export the score as mp3;

  6. Notice that the notes of the two staves are synchronized in the exported mp3 file, as expected.

  7. Now repeat steps 1. to 5., but write the notes at the end of the score instead. Notice that the notes of the two staves are out of sync in the exported mp3 file.

Screenshots/Screen recordings

I provide a video here where I apply the steps that I mentioned before (the piano uses MS Basic, while the violin uses Muse Sounds).

Here is also a proof of concept on a toy score, showing that the delay is growing progressively.

MuseScore Version

Checked in 4.1.1, 4.2.0, 4.3.0 and master (4.4).

Regression

I don't know

Operating system

Win10 (22H2); RAM: 16Go; CPU: Intel Core i5-9300H (2.40GHz)

Additional context

Like #20019, it seems to be depending on the sample rate (files exported at 44100 Hz show more delay than those at 48000 Hz, in particular).

It has been reported on musescore.org in https://musescore.org/en/node/361212 and https://musescore.org/en/node/344031#comment-1203191.

metasekk avatar Aug 30 '23 16:08 metasekk

I can confirm that it happens with all kinds of audio formats (.ogg, .wav, .flac, .mp3). I have rescoped the issue.

metasekk avatar Sep 27 '23 19:09 metasekk

While other synchronization problems (#20019, #20021) seem to have been solved with the latest update of MuseSampler, this issue is still reproducible in MuseSampler v0.5.1.62.

metasekk avatar Dec 22 '23 19:12 metasekk

Please ZIP and attach a score that demonstrates this issue, and describe exactly where in the exported audio to listen in order to hear the problem.

MarcSabatella avatar Dec 22 '23 19:12 MarcSabatella

Please find attach a simplified score for the issue, as well as the result when exported as mp3 in MuseScore 4.2.0 with MuseSampler 0.5.1.62. In this example, Piano 1 uses MuseSounds Grand Piano, while Piano 2 has MS Basic Grand Piano. You should listen to bars 1-4 (beginning of the score, 0-8 s in the exported audio), and then 1126-1129 (end of the score, 37:29-37:37 in the exported audio).

19232_Toy_score.zip

metasekk avatar Dec 23 '23 08:12 metasekk

I've investigated further, and the issue seems very different from what I had described at first.

  1. When played in MuseScore, MuseSounds staves seem to play at a slightly higher speed [1] than the other soundbanks [2], so that the staves that use Muse Sounds are gradually desynchronizing with the others (more precisely, they're getting ahead of the others). Here is a proof of concept on a toy score similar to the one that I attached in my previous comment.

[1] This has probably something to do with sample rates, since scores exported at 44100 Hz are more out of sync than those with 48000 Hz (see the corresponding files). [2] I tested MS Basic and a VST.

  1. As a consequence, the desynchronization does happen in the playback of the score, and not just in the exported audio, as the initial issue made it seem; but the playback needs to be sustained for a sufficient amount of time for the desynchronization to reveal, so that it can't be heard for playback of short scores, although the issue is likely to be present from the beginning.

  2. Summing up, two conditions are needed for the issue to be noticeable: (i) a long score, for the gradual desynchronization to be perceptible, and (ii) it requires the playback to be sustained with no break. Point 2, in particular, justifies why this issue is unlikely to be naturally heard during the playback (I suspect it is not common to play a score for a long time with no break, yet, starting the playback again resets it in a synchronized state...) but very easily perceptible in the exported audio (where I suspect that the exportation engine mimics a continuous playback?).

  3. I am still investigating to know roughly at which point the issue emerged (in the history of MuseSampler and/or MuseScore 4), so as to know in particular if it is a MuseSampler regression.

metasekk avatar Dec 25 '23 20:12 metasekk

Completing Point 4 of my previous comment: it turns out that I fortunately have a backup for version v0.3.2.18 of MuseSampler (dating back to December 2022). I could force MuseScore to use it by putting "MuseSamplerCoreLib.dll" directly into the "\bin" folder of the app (it works well in nightly builds too).

musesampler-win-0.3.2.18.zip

In my tests, the issue proves to be present since at least MuseSampler v0.3.2, as can be heard in the exported audio here (Sampler 0.3.2.18, MuseScore 4.3.0). Note that MuseSounds falls silent at 35'47 due to #15768 affecting v0.3, but the desynchronization can be heard before.

I found the issue using MuseSampler v0.3.2.18 in Master (4.3), 4.2.0, and Beta 4.1.0, but I could not check earlier versions of either MuseScore or MuseSampler.

I hope this helps !

metasekk avatar Dec 26 '23 10:12 metasekk

For your information, this issue is reproducible with MuseSampler v0.6.3.196 and Master (4.4). I am beginning to wonder whether the issue stems from the Muse Sampler / Muse Sounds side, or from the MS4 playback engine, since the latter seems to treat Muse Sounds somewhat differently compared to soundfonts and VSTs. In this case, this issue would fall into the "General playback bug" category instead of "Muse Sounds bug", contrary to what my original description seemed to suggest.

metasekk avatar May 09 '24 05:05 metasekk

@bkunda This one has been open for a while, and is still reproduible in latest master with the latest available version of MuseSampler (0.99.3). As noted above, there are reasons to believe that the issue may lie on the MuseScore side instead of the Muse Sounds side, yet, it isn't part of any project as for now. Besides, I suspect that it will become much more prominent in 4.4 due to the brand new Muse Sounds released on Muse Hub v2, and the note input optimizations which significantly simplify and foster the use of large scores. Thus, is it on your radar, and is there any plan for integrating it to 4.4? (I've seen that @romanpudashkin has already worked on numerous issues and improvements regarding the playback engine, audio exportation, and playback differences when working with Muse Sounds specifically or with different sample rates - hence my question)

Thank you very much in advance!

EDIT: I can't reproduce the issue with MuseSampler v0.100.0 when exporting at 48 kHz, but I can reproduce it when exporting at other sample rates.

metasekk avatar Jul 22 '24 11:07 metasekk