XML import of triplets

• Jul 6, 2021 - 14:08

I am trying to import a music xml file that has a number of triplets in it. The triplets do not seem to import with the correct time value into Musescore as the bar is internally a 3/4 bar where it should be a 2/4 bar. This can only mean that the 1/8 note triplet is imported as a full 1/8th note. Is there a way to select these notes and convert them to the correct value of 1/8th triplet?

Attachment Size
8-11.mscz 28.3 KB


You can't convert them, no. But if your MusicXML file has them specified as triplets, they definitely should import correctly. If you have a MusicXML where you believe this is not happening, please attach it so we can investigate.

In reply to by Dylan Nicholson1

Indeed, but it doesn't give me confidence in the correctness of the file. Given that and the fact that other triplets do import fine, I suspect there is something not quite right - or at least not quite normal - about how the triplets are represented in this file. I can see it uses divisions and durations value differently from how MuseScore would in a similar example. I don't know the spec well enough to say for sure that one is right and the other wrong, or if both should work.

In reply to by Marc Sabatella

Yeah there's something odd with it, each measure has divisions as 480, but the duration of each of the 1/8th note triplets is specified as 240.
When you export the same (a 2/4 bar with 2 sets of triplets) from MuseScore it has divisions as 3 and the duration of each of the 1/8 note triplets as 1.
But that technically means the duration of the triplets is too long in the OP's file, so I'm a bit confused why it's adding extra rests between them.
If you edit the file MuseScore produces to set divisions as 2, you get exactly the same result when importing.

In reply to by Dylan Nicholson1

My suspicion is we're adding up the lengths realizing it adds up to too many beat, so adding the extra time, then needing to pad it after all. There have been a couple of other recent discussion about corner case discrepancies with unusual/unexpected combinations of division/duration values that aren't covered explicitly in the spec, but I'm not sure any definitive conclusion was ever reached. See for instance https://musescore.org/en/node/313339. Some sort of change was proposed as a result, but my sense is that normal triplets do import correctly, and the test suite seems to bear that out.

In reply to by Marc Sabatella

The MusicXML spec does specify that "The <duration> elements in MusicXML move a musical counter" - i.e. it's what determines where the next note starts (so not just the "playback" duration, as another poster suggested). In that sense the file is unusual because it specifies that each note is to be notated as triplet 8th note, but has a duration of a regular 8th note (1/4 of a measure). Note this assumes "time-modification" does not apply to the "duration" element, and while this is not explicitly stated in the spec, the example at https://w3c.github.io/musicxml/musicxml-reference/examples/tuplet-eleme… suggests that this is correct (it explicitly gives 1/8th notes in a triplet 1/3 the duration of the preceding 1/4 notes).
However while this is weird, it's not impossible, and would need to be notated as:


But also note that the sum of all durations of notes in that first measure is too long, it would add up to a 3/4 bar.

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