Preserving line breaks on export to mxl

• Jun 13, 2020 - 20:36

When I export a score to mxl, the exported file ignores the line breaks of the musescore file and puts the whole score into 4 bars per line even though the original had some lines with five bars to accommodate 1st and 2nd time bars. How can I make the exported mxl follow the layout of the mscx score?


Comments

How are you comparing the file?
You state the file ignores the line breaks, but have you look into the file (as in unzipped it and checked the actual xml contents)?
Or are you opening/importing it in (another?) software package and basing your conclusions off of that?

In reply to by jeetee

I open the file in MS3 and see line 1 is 4 bars and line 2 is 5 bars (to include 1st and 2nd-time bars). Same for lines 3 (4 bars) and 4 (5 bars). Everything as intended.
Then I export to mxl. I open the mxl file in MS3 to check it and the layout has changed, shoving the 2nd-time bars down into the next line, making it a stretched-out single-bar line.
But there is no line-break sign visible after the 1st-time bar so I can't pull the 2nd-time bar back to its line.
There is a line-break sign after the 2nd-time bar so I can delete that, but of course it pulls the next line up, giving an awkward line starting with the 2nd-time bar which would be much better at the end of the previous line where it was in the original MS3 score.

In reply to by raychandler

There is a line-break sign after the 2nd-time bar

So you're literally saying that the line break is indeed saved and restored :-p
Many other layout things (such as stretch for measures) don't exist in the MusicXML format, so can't be saved.

If your goal is to save and open the score in MuseScore, then why not use the MuseScore file format?

In reply to by jeetee

Well, some line breaks are saved and restored - some that I don't want but not others that I do want, so the result in the .mxl file is not as the Musescore score.
Jo-jo has suggested a solution which I'll play with.

The background to this is that a colleague creates MuseScore files and produces pdfs for a tune library that we provide online. I want to make the files also accessible in formats that people can use in their preferred music software, eg .mxl which can be imported into a wide range of applications. I had hoped that the MuseScore export to .mxl would preserve the layout so that I didn't have to fiddle with every tune before adding them to the library, but it seems this was wishful thinking.

In reply to by Jojo-Schmitz

But MusicXML files can be imported into a wide range of notation software so it is useful for a library to make them available in that format. When people import such files they can make adjustments, customise them, edit them with their own changes, etc, within their own preferred software packages - all of which will be far quicker than notating a score from scratch from a pdf print-out.
I know this means they can correct the obvious bad line-breaks themselves, but I was just hoping to give them a score which didn't look too daft as soon as they open it.

In reply to by raychandler

MuseScore exports line (actually page and system) breaks and measure width to MusicXML. The issue is that the "stretch" concept does not exist in MusicXML and calculating stretch based on the information in the MusicXML file is non-trivial (and has not been implemented). On import MuseScore layouts the score using only the musical content but ignoring the previous layout information.

In reply to by raychandler

some line breaks are saved and restored
No, not some. All of the breaks you put in are there when you re-open the document. Your issue is not about line breaks themselves, but about measures having a different width leading to less measures fitting on a system, leading to those measures overflowing onto a new system, which is then ended "prematurely" by the line break that was saved and restored.

To be absolutely clear: line breaks never force more measures on a system, always less.

But as Leon pointed out, MusicXML simply doesn't have a way to define stretch and thus retain it. Moreover, since you're taking about "a wide range of applications" I can state that even if MusicXML was capable of storing stretch it still wouldn't lead to the same layout in that wide range of applications.
Simply because those applications might use a different music notation symbol font, in which a clef is perhaps 4pixels wider than it was on MuseScore; as a result those measures would now become larger in that other software and it again might not fit measures onto a system.
Or that other application shows the score on a mobile phone instead of on "paper", thus doesn't even honor the existing line breaks as it wouldn't make sense in that application.

What MusicXML is great at, is preserving the music. So that all those applications will show the same music, regardless of how they show it. They could even show it in a different notation system altogether where blue bears means a quarter C4 note and yellow crocodiles mean that whats inside the crocodiles belly is a tuplet.

MusicXML simply isn't a layout file format, it's a music format.

In reply to by jeetee

Thanks. I can see that because of the nature of MusicXML, a five-bar line created in MuseScore may be split after bar 4 when exported. But I'm puzzled that when I bring it back into MuseScore, I can't get the line back to the original 5 bars - there isn't a line-break symbol at that point that I can remove. Hopefully no problem for people more experienced with MuseScore.
But I'm not worrying about it any more ... I'll make the mxl files available as an option in the library, and if people can adjust the layout to their liking in whatever software they use, it will be a useful service to them rather than expecting them to notate the tunes from scratch from the library's pdf list.
Incidentally, the library also has the files available in .abc format. Many of these were produced from an earlier set-up, but I now produce them from the mxl files using xml2abc.py.
http://www.rudemex.co.uk/library.html

In reply to by Jojo-Schmitz

Thanks. I did try this when you suggested it earlier but it didn't work for me.
As mentioned above, I needn't worry about this for my purposes because I'm just making the mxl files available for other people to use ... they will presumably be familiar enough with their own software to make any adjustments they wish.

Do you still have an unanswered question? Please log in first to post your question.