[Musicxml im-export] - New Instrument name disappears

• Sep 23, 2019 - 13:54
Reported version
3.2
Type
Functional
Frequency
Many
Severity
S3 - Major
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project

Hello,
The attached xml file from Sibelius shows an instrument change with correct new instrument name and abbreviation. But when imported into Musescore, they disappear, and there's only an "instrument change" shown. I can't produce an example of instrument change in Musescore, but when exporting it into Musicxml, the new names are lost.

Regards
Haipeng

Attachment Size
changes.xml 20.37 KB

Comments

FWIW, I don't see any text specified to display there in the MusicXML file - looks like just a plain "instrument" element with no corresponding text.

that suplement part is fixed in 3.3 as far as I can tell, there you can access the long and short names of instruments introduced by an instrument changes

In measure 3 of the original, there is indeed text reading "muta in F", and that is imported just fine. But the instrument change itself in measure 4 has no text in the MusicXML file that I can see.

I'm not the MusicXML expert so normally I defer to others (particular Leon), but since I've just been working on the code dealing with change of instrument and names in particular, I did want to take a look. Still, according to my best read of the standard, the mere existence of an "instrument" element is not supposed to cause text to appear in the score. See for example http://usermanuals.musicxml.com/MusicXML/MusicXML.htm#EL-MusicXML-instr…. But maybe there is another page to this I am missing?

Meanwhile, as mentioned, the staff name (is that what you mean by "block"?) does show the name change - the first system reads "Horn in D", the next reads "F Hn". At least, these names appear if I turn off the option to hide instrument names in scores with only a single staff.

So I'm still not sure how this differs from the expected result, except probably the "Instrument change" text should be invisible.

Thanks, the latest build does give the correct result. The only thing now is to get rid of the unwanted "instrument change". You are right that the "instrument" block is not a part label.

Haipeng

A few remarks from my side wrt MusicXML and MuseScore's MusicXML importer:
- according to my interpretation of the spec, the "instrument" element simply specifies which instrument plays a note, it does not lead in any way to display text (neither as staff text, nor as a change in a part's instrument name)
- MuseScore requires an "instrument change" score element to change instruments
- the importer generates an "instrument change" score element when the instrument changes (whenever a note contains a different instrument element) and puts in the text "instrument change" because the MusicXML file does not define the text to display at that point in the score and without text, there is no way to edit the instrument change (which in terms of GUI probably is sub-optimal, but I took the easy way out here)
- the MusicXML part-name-display element (and its display-text child) are not handled by the importer, they are ignored
- MusicXML places no restrictions on instrument changes (any note in any voice can use a different instrument). This is not supported by MuseScore (which allows only one instrument per part at any given time) and not handled very elegantly by the MusicXML importer

My vote is to simply make the "Instrument Change" text invisible. Could also be nice if the text actually had the name of the instrument, if it happens to be easily available, but it should still be invisible, as well-formed MusicXML files should not be relying on the instrument tags to display text. Seeing the name would be more of a convenience for the user.

As far as I know, MuseScore does not allow invisible instrument changes (you can unset the "visible" flag in the inspector, but it does not stick), nor does it allow instrument changes without text (these get deleted). Either we have visible instrument changes and the instrument actually changes or we don't have either.

Thus my vote goes to putting in the instrument name or short name. Should be a trivial change.

Finally, although this seems a sensible change to me, it does not solve Haipeng's complaint that the MusicXML part-name-display element is not handled. That would require further investigation.

Only time a change in the Inspector doesn't stick is if you are currently in Edit mode. That's a bug that comes up pretty often...

Anyhow, putting in the instrument name and making it invisible is what makes most sense to me.

Probably my mistake, I tried but could not make setting to invisible work. Anyway, I agree putting in the instrument name and making it invisible seems the best choice. This is a trivial change, result attached (note: option to hide instrument names in scores with only a single staff is ON).

Attachment Size
Screen Shot 2019-09-26 at 19.35.35.png 69.03 KB

To me that's perfect for the given example. Although I still can't say I totally understand how the MusicXML should look if you wanted the text the be visible - i.e., what would be the ideal MusicXML export from MuseScore if a user adds an instrument change, text and all.

Any text is simply exported as direction / direction-type / words elements. Note that there is no explicit relation with the instrument change. Also there even is no explicit instrument change in MusicXML. Some notes simply have a different instrument associated with them (indicated using the instrument child element).

Due to the different concepts, lossless conversion between MuseScore and MusicXML is non-trivial.

The problem is, the short name disappears when importing. If changing in Musescore, text in the instrument change tag will be "in F" and the like. But when importing from Musicxml, it will be simply replaced as Instrument Change.

Well, it's true the instrument change.text.iteself doesn't say the name of the instrument. Really you needto add that text explicitly in the MusicXML if you want it to appear at that point in the score. But the staff name definitely does update - that's something separate.

Haipeng, what do you mean "the short name disappears when importing" ? What are you trying to do and how exactly ? There is a lot of discussion in this issue, but it seems short on detail. At least I fail to understand what you want to achieve, how you want to do it and why MuseScore currently does not meet your expectation.

I think there are a couple of things going on here to be aware of.

First, because this score has only a single staff, and the default is not to display staff names at all if there is only a single instrument, these don't appear, that is true. If you want the staff names to be displayed even though there is only a single instrument, you need to go to Format / Style and turn off "Hide instrument name if there is only 1 instrument".

Second, as mentioned, MusicXML and MuseScore have different ways of handing multiple instruments on the same staff. MusicXML apparently allows each note to specify which instrument to use - there are no explicit "change instrument" elements. So it seems there will likely always be some inconsistencies in how this gets imported.

Third, MuseScore currently does not allow random changes to the staff names. The staff names change only when the instrument changes - only where there is an explicit instrument change element. So, the staff name does change at the point where the new instrument appears in the score - well, it changes if you make sure to turn on display of staff names. But the name that displays will be the default name for that instrument according to its MusicXML id, I think - as far as I can tell we don't look at the "part-abbreviation-display" tag to determine what name to show. In this case, it doesn't matter - the text in the MusicXML is "F Hn.", which is the default, and is what MuseScore displays when you force staff names to be shown, so all is well, and this actually appears to work correctly.

But if you had specified some non-default text instead of "F Hn." - say, "F Hn. 1 & 3" - then this would not work, you'd still get just the default "F Hn.".

Prior to MuseScore 3, there would have been no way to honor these name changes, but now with MuseScore 3 it should be possible - the long/short instrument names of the new instrument for the staff names after an instrument changes (whereas in MuseScore 2 we erroneously kept the original staff names always). In theory, all we would need to do to allow the name to be customized via part-abbreviation-display is to assign the name we see there to the "current" instrument. The tricky part would be, in this case that part-abbreviation-display tag appears before the new instrument itself, so it's not the current instrument instrument we want but rather, the one we are about to change to. So when we see the part-abbreviation-disply tag, we'd have to remember that name, then apply it after we actually see the new instrument and thus create the instrument change element.

Exactly, the two part elements at bar 3 should all be accepted. In the mscx ile, I only found the usual instrument name tag changed, not the short name. Even using self-defined names, they should be like this:

          Horn 1, 2 in F
          Hn. in F 1, 2

Haipeng

In reply to by hhpmusic

Well, it's normal you wouldn't see the short name in the MSCX file - those are never stored, since they are generated on the fly. But the "F Hn" is displayed as I said. There's actually quite a bit of info that is displayed in a score but not stored - the barlines, for example, the clef & key signature at the start of each stystem, etc.

After checking the relevant parts of the MusicXML specification my conclusions are:

1) Haipeng is right, MusicXML's part-name and part-abbreviation are meant to specify the part name displayed in the score
2) the MusicXML's score-instrument's instrument-name and abbreviation are not meant to be displayed
3) MuseScore MusicXML importer simply imports the MusicXML instrument-name as the long instrument name
4) MuseScore automatically displays the instrument's long or short name and does not fully support different part and instrument names
5) many MusicXML files do contain part-abbreviation but do not contain instrument-abbreviation
6) the previously described change to put the instrument name into the instrument change text is useful anyway, will submit a PR for that

As explained by Marc, 4) makes import of part-name and part-abbreviation a non-trivial problem to solve. Furthermore, this issue does not seem very important to me. Thus I do not expect this to be solved on short notice.