Opening mid file got an MTrk error

• Feb 5, 2022 - 00:57

Latest update? Not sure. Musescore is getting an error when opening a mid file. Something about a bad MTrk. After some digging around with my own programming it looks like its some kind of utf8 encoding issue at first. Winamp, Windows media player and my non UWP application all read it just fine however my Windows UWP is getting an exception when reading the 3rd track.

Before you get started the second track has two 0x2F end-of-track meta events.

And after further analysis:

while (fread_s(header.type, 4, sizeof(BYTE), 4, file))
{
if (header.type[0] == 'M' && header.type[1] == 'T' && header.type[2] == 'h' && header.type[3] == 'd')
{
// doing the header
else if (header.type[0] == 'M' && header.type[1] == 'T' && header.type[2] == 'r' && header.type[3] == 'k')
{
// doing the track
}
}

The header test and the track test skip past the second 0x00 0xFF 0x2F 0x00 so my Universal Windows Program (UWP) is reading it correctly. However, after taking out the extra end-of-track events Musecore still chooses not to open it and Windows media player wont play it either. If anyone has any idea why there would be two end-of-track events please respond.

Here's the file.

Attachment Size
Beeth7th2.mid 60.59 KB

Comments

Your mid plays in VCL and Audacity. It also opens in Sibelius. I exported it in three different formats. All of which open in my copy of MuseScore. Good luck.

Attachment Size
beeth.zip 214.62 KB

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