Skip to content

[MU4 Issue] Crash opening musicxml file with consecutive <direction> without notes #15575

@jacobtylerwalls

Description

@jacobtylerwalls

Describe the bug
Opening this file crashes MuseScore. MuseScore3 (and Finale) validates it fine.

The file contains one measure: two consecutive wedges, then backs up and gives a whole note. The wedges show a swell over the note, but they aren't attached to the note.

From the musicxml spec:

For applications where a specific direction is indeed attached to a specific note, the element can be associated with the first element that follows it in score order that is not in a different voice.

Because of the <backup> that follows, the next note is in a different voice.

To Reproduce
Open attached file (strip ".txt" suffix, or see Details, below)
two-spanners-crash-file.musicxml.txt

raw MusicXML
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE score-partwise  PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
  <movement-title>Music21 Fragment</movement-title>
  <identification>
    <creator type="composer">Music21</creator>
    <encoding>
      <encoding-date>2022-12-24</encoding-date>
      <software>music21 v.9.0.0a6</software>
    </encoding>
  </identification>
  <defaults>
    <scaling>
      <millimeters>7</millimeters>
      <tenths>40</tenths>
    </scaling>
  </defaults>
  <part-list>
    <score-part id="Pf0d638d8f90e97076e77a0edf3ea2c84">
      <part-name />
    </score-part>
  </part-list>
  <!--=========================== Part 1 ===========================-->
  <part id="Pf0d638d8f90e97076e77a0edf3ea2c84">
    <!--========================= Measure 0 ==========================-->
    <measure implicit="no" number="0">
      <attributes>
        <divisions>10080</divisions>
      </attributes>
      <direction placement="below">
        <direction-type>
          <wedge number="1" spread="0" type="crescendo" />
        </direction-type>
      </direction>
      <forward>
        <duration>20160</duration>
      </forward>
      <direction placement="below">
        <direction-type>
          <wedge number="2" spread="15" type="diminuendo" />
        </direction-type>
      </direction>
      <direction placement="below">
        <direction-type>
          <wedge number="1" spread="15" type="stop" />
        </direction-type>
      </direction>
      <forward>
        <duration>20160</duration>
      </forward>
      <direction placement="below">
        <direction-type>
          <wedge number="2" spread="0" type="stop" />
        </direction-type>
      </direction>
      <backup>
        <duration>40320</duration>
      </backup>
      <note>
        <pitch>
          <step>C</step>
          <octave>4</octave>
        </pitch>
        <duration>40320</duration>
        <type>whole</type>
      </note>
    </measure>
  </part>
</score-partwise>

Platform information
OS: macOS 13.1

Test file created by @gregchapman-dev in cuthbertLab/music21#1479

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions