-
Notifications
You must be signed in to change notification settings - Fork 433
Description
9.9.1
Mac OS Sequoia 15.6.1
Problem summary
Under specific circumstances (e.g. ties + chords, 2 piano voices) parsing a musicxml file with the converter, and then immediately writing a MIDI file from it, will result in notes missing and moved/overlapping.
We suspect that this could be related to the stripTies method.
To illustrate and reproduce the issue, I created two minimal examples of a single bar. With several bars, more related issues appear, but for now:
example_doubleVoice_2notes.musicxml:
example_doubleVoice_3notes.musicxml
I'm also providing the resulting MIDI files.
Steps to reproduce
import music21
converter = music21.converter
score = converter.parse('example_doubleVoice_2notes.musicxml')
midi_path = score.write('midi', fp='example_doubleVoice_2notes.midi')
Expected vs. actual behaviour
for the first example, this what the output should be (midi exported from MuseScore) as seen in sonic Visualiser:
this is the music21 output, with 4 midi events instead of 2:
for the second example, this what the output should be (midi exported from MuseScore) as seen in sonic Visualiser:
this is the music21 output, with 4 midi events instead of 3, note that the second (top) voice has been deleted:
I'd be happy to produce more examples if this can help to fix this issue, thank you so much!