musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
11.91k stars 2.57k forks source link

Export audio (MP3) can be extremely long for scores with VST #21520

Open metasekk opened 5 months ago

metasekk commented 5 months ago

Issue type

General playback bug

Bug description

15810 reported exportation times in MuseScore 4 longer compared to MuseScore 3, at least when using MS Basic and MuseSounds. It was fixed in #19078. However, export time for scores that use VST plugins was not analysed as it was clearly out of scope, since the issue targeted the regression vs MS3 (which didn't support VST anyway).

Here, I provide a test score showing that, on my side, the audio export times for scores when switching some staves from MS Basic/Muse Sounds to VSTs become exceedingly - it should be read: prohibitively - long, about 10 times longer VS Muse Sounds and MS Basic.

The results prove to be relatively dependant of the VST plugin selected though.

Steps to reproduce

I provide a toy score with 3600 bars at 240 bpm, so that the total duration of the score is 01:00:00 hour. Only the Timpani staff has notes inside. Export parameters: mp3, 48 kHz, 128 kBit/s.

  1. Open Toy_score_for_exportation_time.zip.
  2. Empty the score, export it as mp3 and measure the time. I obtain ~ 114 sec (serves as a reference).
  3. Reopen the score (with notes), choose an MS Basic instrument for the Timpani staff, export it and measure the time again. I obtain about 220 sec
  4. Reopen the score, choose a Muse Sounds instrument for the Timpani staff, export it and measure the time again. I obtain about 240 sec
  5. Reopen the score, choose a VST instrument for the Timpani staff, export it and measure the time again. I obtain about: 1770 sec for LABS (Strings 2: Swells ensemble); 1670 sec for DecentSampler (Default Piano).

Screenshots/Screen recordings

Summary (with other VSTs):

Summary_V1

MuseScore Version

Tested on MuseScore 4.2.1

Regression

No.

Operating system

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

Additional context

NB: Both VST plugins and Muse Sounds are stored in the same folder of the same storage on my computer, so that the speed of access to these sounds should be approximately the same.

NB2: Incidentally, it's worth mentioning that there are 3 extra unexpected (invisible) bars at the end of the score when played back and exported (only 3600 are shown and therefore should be played or exported). I'm not sure if it's a bug or a feature.

NB3: Please note that the score provided here as an exemple has only one staff being played. In a real 1:30h-long score on which I am working (32 staves, with 5 using VSTi and the rest using Muse Sounds), the export time is 3:02 h, i.e. about twice the length of the score, which makes this issue particularly crippling in this instance.

Reported on Musescore.org (https://musescore.org/en/node/337944, https://musescore.org/en/node/351071)

metasekk commented 2 weeks ago

Here are the new results I get with today's version of pending PR #22791 (with latest VSTi optimization: "don't process if no event") (https://github.com/musescore/MuseScore/pull/22791#commits-pushed-1499d6b).

image

As you can see, it went from excruciatingly slow to reasonably fast (and even much faster than MS3 on this test score and for my operating system, as monitored in the cellsheet).

There is a consistent minimum 25% gain of exportation time with the PR, whatever library is used (MS Basic, Muse Sounds, VSTi, SF2).

VSTi can still take up to 2x longer in my test compared to other sounds, which is notably the case for sound libraries with a lot of reverb (like LABS Swells) where notes sound longer than what they are supposed to last. All in all, export time has been significantly reduced compared to previous versions of MuseScore Studio.

Therefore, I guess that it will be possible to declare the issue solved by #22791 when it is merged. Those tendencies are yet to be confirmed on real (large) scores (example: on my machine, a "large" 2:30h-long score with 30 Muse Sounds staves and a few VSTi takes ~1 hour to be exported, which is still twice as slow as MuseScore 3 on similar scores, and much, much more CPU-guzzling and GPU-expensive...).

Note to devs: Saturday's version of PR #22791 (which included a commit called "Muse Sampler optimization: don't process if no event") (https://github.com/musescore/MuseScore/pull/22791#commits-pushed-250a593) went even further, leading to an additional time reduction of ~30-40% of the current figures for the columns "Empty score" and "Muse Sounds".

RomanPudashkin commented 2 weeks ago

@metasekk thank you so much!