Sequence Track Name MIDI messages wrongly null-terminated
Create a one-measure file with an instrument named Classical Guitar.
Insert a note.
Export to midi.
Inspect the MIDI file -- the Sequence Track Name message is null-terminated:
In python:
>>> binascii.unhexlify('ff0311436c6173736963616c204775697461720000')
b'\xff\x03\x11Classical Guitar\x00\x00'
Impact:
A MIDI importer, such as music21, might ingest the empty byte into the part name and then generate malformed musicxml when trying to write 'Classical Guitar\x00' as the part-name.
Another user verified this on a forum post on this topic:
https://musescore.org/en/node/310149
I confirm seeing the same here with MuseScore 3.5.1.13199/Windows 7.
That item in MIDI is not to be null-terminated (there is an explicit length parameter in the meta-event encoding.)
Attachment | Size |
---|---|
emptyByte.mid | 118 bytes |
emptyByte.mscz | 3.15 KB |
Comments
Raising frequency because it happens every time MIDI is exported, and we are starting to get bug reports at music21 over it.
That is Reproducibility. Frequency is the number of people reporting it and you're all but one
Well, and that other user in the forum post
I get exactly the same problem when trying to handle multiple midi files in a project using music21.
https://github.com/musescore/MuseScore/pull/7003
.
"PR Created"? What happened to the title of this issue?
No idea what went wrong here
(actually I do, @pereverzev_v just fixed it)