MusicXML import ignores string/fret

• Apr 3, 2019 - 01:28
Reported version
S4 - Minor

1) Import fret_test.musicxml
2) Notice that musescore 3 uses string 2 fret 4 instead of the specified string 3 fret 8.

This occurs in the latest version from flathub as well as the latest nightly:
OS: Ubuntu 18.04.2 LTS, Arch.: x86_64, MuseScore version (64-bit):, revision: a9d043a

This worked in musescore 2.

Attachment Size
fret_test.musicxml 4.62 KB


Status active fixed
Fix version 3.5.0

Just tested this out in the 3.5 alpha, where this is now correct.
Don't know which commit fixed it yet

Status closed active

Well, but different from the original report, that sample file uses string 4 fret 1 in 3.5.2 and 3.6.2 rather than string 3 fret 8, as it did in 2.3.2

In reply to by Jojo-Schmitz

So now, not only the fretting from the XML file is ignored, but also a note in a different octave is used. I am not able to judge which version used the right octave. It is possible that this test file is wrong.

For me MuseScore 3.6 ignores fretting information from other files (that I care for) too, while 3.5 used to accept those. I do not have a simple test file to provide, though.

Please provide:
- more information on exactly what is perceived to be incorrect (expected versus actual) in which MuseScore version
- a file (preferably short) displaying the behaviour

In reply to by Leon Vinken

Hi Leon,

Thanks for looking into this.

I made a simple Overture "Guitar + Tab" test file with five E notes, each with a unique string assignment.

      Overture-MusicXMLTest--Five E notes.png

After importing to Musescore all the E notes are on the E string despite Overture specifying the strings. For instance, the MusicXML shows the tablature staff's second note as the 5th fret of String 2

      Tabalture String assignment in Overture MusicXML.png

This is the MusicXML file exported from Overture:

      Tablature string assignment (from Overture).musicxml


In reply to by scorster

Last night (using MuseScore MacOS I noticed at a glance all the fret numbers were on string 1, meaning that MuseScore missed the string assignments. A that time I didn't pay attention to the fret numbers that Musescore displayed on the E string. However this morning I noticed that all E4 notes (on the top line of the tablature staff) were marked 2nd fret! So I looked into Overture's XML and Musescore's String Data.

Overture's tablature staff description looks credible:

      Overture Tablature--XML STaff Tuning.png

But on import the MuseScore String Data shows a 3-string tuned D A D ... and yet the staff has six strings, in accord to Staff Properties>Lines = 6.

      MuseScore String DATA on import Overture XML.png

Here's the Overture file in case anyone one can make use of it. (It's zipped due to forum's posting file type restrictions.)

      Overture - Tablature string assignment TEST for MuseScore


Fret number is indeed a regression introduced after 3.5.1, for both files attached to this issue. Tested 3.5.1 and 3.6.2. The string data issue also reproduces for me, but only on 3.6.2 and only with the Overture file.

Cause found: a combination of missing instrument identification in the Overture file (in part P2), MuseScore MusicXML importer bugs and changes to instruments.xml leads to misidentifying the instrument as a three string bouzouki. Will add more information later.

More details: in order to add instrument information present in instruments.xml but not in the MusicXML file (e.g. pitch range and articulations), the importer tries to find a matching instrument by searching instruments.xml for MusicXML ID, name or MIDI program. Unfortunately, neither of these is unique, leading to incorrect identification. Furthermore, due to a bug in the importer, the string data in instruments.xml gets priority over the string data in the MusicXML file. This causes the "three strings" issue.

Also, this issue has been marked as fixed some time ago, but with today's knowledge about the exact cause combined with the lack of any commit referring to this issue, I strongly suspect it was never solved but simply was masked by updates in instruments.xml.

Proposed solution would be to remove the attempts to find a matching instrument in instruments.xml (as it is too error prone) and accept the fact that pitch range and articulations will not be set after MusicXML import. This is a trivial change.

In reply to by scorster

@scorster, thanks, will contact you if I need Encore files. I think the issue is broader than Encore, e.g. Sibelius also often lacks MIDI program numbers. In general almost all information describing a part or a part's instrument(s) is optional in MusicXML, and thus sometimes absent.

An even simpler solution would be to allow the string data present in the MusicXML file to overrule the string data from instrument. This is a simple change to MusicXMLParserPass2::staffDetails, which results in correct tablature, but the resulting MuseScore file (attached) still contains a few items in its instrument definition that are bouzouki specific (instrument id, useable pitches, channel settings).

Also, as sound or MIDI program do not define an instrument but a sound and instrument names are also not suitable to reliably identify an instrument in instruments.xml, the MusicXML importer should probably not try to do that.

Fix version