Add page and system breaks via command line

• Dec 2, 2020 - 19:49
Reported version
3.x-dev
Type
Functional
Frequency
Once
Severity
S5 - Suggestion
Reproducibility
Always
Status
active
Regression
No
Workaround
Yes
Project

We should add a command line option to freeze the layout of a score by adding manual page and system breaks in places where automatic breaks occur. For example:

mscore --freeze-layout score1.mscx score2.mscz
mscore --freeze-layout infile.mscx -o outfile.mscz

This is useful to enable other programs to read MuseScore files and work out where the pages and systems go without having to do expensive layout calculations. It also provides a way to "lock-in" the layout of a score before opening it in a newer version of MuseScore that uses a different layout algorithm, which would otherwise result in page and system breaks occurring in different places.

Use case: Music Braille converters need to know where page breaks occur so that they can provide print page references to facilitate blind and sighted musicians working together. High quality converters cannot depend solely on MusicXML because the specification lacks certain features necessary for Braille, hence they must use MuseScore's internal format.


Comments

Are you saying such converters exist, or are being worked on? Would they be superior to the built-in Braille export within MuseScore that was just merged from Andrei a week or so ago?

Anyhow, we do have a built-in facility to lock current breaks, so the code is there, exposing it via command line should be simple enough. Actually, we'd probably first want to factor the code out to make it accessible as an independent command - right now it requires use of a dialog to select this.

When I make scores to be converted to braille for hhpmusic I always use hard system and page breaks for the reasons explained by Peter. He exports them to musicxml then converts them to braille using a program developed for this purpose.

It is even an option in the Edit > Preferences > Export dialog to export all (implicit) system and page breaks explicitly. So the functionality exists already, just needs a command line option to force it on.

As far as I understand this option currently works only with MusicXML export so that would need to be adjusted to other formats too.

However it seems to be possible to automate this with a plugin. I have created such an example plugin (attached to this comment) to put layout breaks where needed. This plugin at its current state requires MuseScore 3.6 (as the previous versions lack nextMeasureMM property and thus would make it difficult to handle multi-measure rests), doesn't handle excerpts and seems to work best with scores that are already saved with the latest MuseScore version (as layout may change after saving a score otherwise). Existing layout breaks are replaced — maybe this behavior needs to be changed for section breaks. However it seems to be able to do what is needed here, and it works with a command line. To use it that way you need to put the plugin to Plugins directory and execute something like

mscore3 -p add_layout_breaks.qml score.mscz -o score_with_layout_breaks.mscz 
Attachment Size
add_layout_breaks.qml 2.36 KB

@dmitrio95, correct. A good Braille converter must use MSCX rather than MusicXML due to the following limitations in MusicXML:

  1. No text or symbol categories (what we call "text styles" in MuseScore).
  2. No distinction between system text and staff text that happens to be on the top staff.
  3. No mid-score text frames.
  4. No special time signatures, e.g. "(2+3)/4".
  5. Some types of line missing (e.g. certain pedal lines).
  6. Slower pace of improvement compared to MuseScore, and middleman / lost in translation problems.

Thanks to @hhpmusic for telling me about the above limitations which are important to Braille conversion.

1 to 5 are inherit limitations (i.e. missing from the MusicXML specification); they are not the fault of MuseScore's exporter. Most of these should be addressed in the MNX specification when that finally arrives.