fbpx
Skip to main content

MIDI Forum

This midi score doe...
 
Notifications
Clear all

This midi score does not load/import properly on many players. Why?

9 Posts
3 Users
0 Reactions
2,991 Views
m
 m
Posts: 3
Active Member
Topic starter
 

I am trying to create a smf midi score using some software. However, it doesn't seem to export properly. When I try to play the smf midi score back in windows media player, or FL Studio, or other online midi players, only one track is played.

I have started looking through the midi score's bytes to see what is wrong, but so far I am not seeing any issues. I am also very new to deciphering the bytes so this is admittedly difficult for me.

Can anyone tell why this file would only play back one of the six tracks?

Here is are the bytes of the midi file as text

Here is the actual midi file.

 
Posted : 01/03/2023 2:40 pm
Geoff
Posts: 1047
Noble Member
 

Hello,

I'd be happy to have a look at your midi file, if you would help.

You can pack the midi file into a ZIP file and attach it to your post. There are various things I can do with the actual file, incl try it in various players, of decode it into a test form for east checking.

Your ascii version - I'm not sure what you're expecting me to do with that. I can see that it IS the bytes of a midi file, but I would need to write some software to convert the bytes back into a midi file, which would take some time and effort. This is a VERY long way around. So much easier for everyone if you just used the 'attachment' option in the forum to attach your file as converted from midi to .ZIP

Geoff

 
Posted : 01/03/2023 3:46 pm
Bavi_H
Posts: 267
Reputable Member
 

I was uncomfortable using the file sharing service in your second link. I visted your first link in a browser with JavaScript disabled and copied your hex dump. I pasted the hex bytes into a hex editor and saved as a .mid file. Note: in that MIDI file, there are actually 5 tracks, not 6.

When I tested the MIDI file in the software I have, I either got an error message or the software was able to play all 5 tracks.

Major problem: None of the tracks have an End of Track meta event as the final event. This is required by the MIDI File Specification. When the End of Track event is missing, it looks like some MIDI file software will show an error message and won't open the file. For example, when I tested the MIDI file software I have, MuseScore and Windows Media Player showed an error message.

Other suggestions:

There are notes on the first track. The MIDI File Specification strongly implies that the first track of a Format 1 MIDI file shouldn't have any notes on it and most MIDI file software will use the first track of a Format 1 MIDI file only for events like tempos, time signatures, key signatures, and markers. If there are notes on the first track in a Format 1 MIDI file, it looks like most MIDI file software will still play those notes anyway, but you might encounter some MIDI file software that will ignore note events on the first track of a Format 1 MIDI file.

There is no tempo event in the MIDI file. The MIDI File Specification says if there is no tempo specified, a default tempo of 120 quarter notes per minute should be used. However, Cakewalk incorrectly uses a default tempo of 100 quarter notes per minute. If you want your MIDI file to play at the same tempo in Cakewalk and in other MIDI file players, consider adding a tempo meta event to your MIDI file.

The MIDI file resolution (ticks per quarter note) is very low: 2 ticks per quarter note. While this doesn't seem to cause problems, be aware it is common to have a ticks per quarter note amount that is a multiple of 24. For example, Cakewalk lets you choose from these values for ticks per quarter note: 48, 72, 96, 120, 144, 168, 192, 216, 240, 360, 384, 480, 600, 720, 960.

Results with MIDI file software I have:

Gives an error message:
• Windows Media Player 12.0.9600.19482 ("Windows Media Player encountered a problem while playing the file.")
• MuseScore Version 3.6.2.548021803, Revision 3224f34 ("Load failed: bad midifile: unexpected EOF")

Plays all 5 tracks with a tempo of 120 quarter notes per minute:
• Sekaiju 7.8 (also prompts to move all channel events that appear in the first track into a new track)
• Notation Player 4.0.3
• Synthesia 10.9.5893
• vanBasco's Karaoke Player 2.53

Plays all 5 tracks with a tempo of 100 quarter notes per minute:
• Cakewalk 2022.06 (Build 034, 64 bit)

 
Posted : 01/03/2023 4:14 pm
Geoff
Posts: 1047
Noble Member
 

Bavi,

I'm trying to do something with the ASCII file, but it looks to me as if the timing data is very strange. There seems to be a lot of zero delta times, and where it's not zero is seems to be very small numbers (as I think you are saying). Note there is a LOT of the data '4000' showing, which I think is 40 for the velocity of the note, followed by a delta time of zero.

Have you got actual sounds being produced?

Geoff

 
Posted : 01/03/2023 4:46 pm
Bavi_H
Posts: 267
Reputable Member
 

User m, here are some more suggestions:

Add a Time Signature event. When there is no Time Signature event, the MIDI File Specification says a default is 4/4 should be used. However, this MIDI file sounds like it should use 6/4 instead.

Add a Key Signature event. When there is no Key Signature event, the MIDI File Specification says a default of C major should be used. However, I think this MIDI file sounds like it's in B major (key signature of 5 sharps).

Adding a correct time signature and key signature will make music score notation easier to read. And with a correct time signature, a metronome click will sound better (an emphasized click for the first beat of each measure will sound correct.)

 
Posted : 01/03/2023 5:32 pm
Bavi_H
Posts: 267
Reputable Member
 

[quotePost id=17835]Bavi, I'm trying to do something with the ASCII file, but it looks to me as if the timing data is very strange. There seems to be a lot of zero delta times, and where it's not zero is seems to be very small numbers (as I think you are saying). Note there is a LOT of the data '4000' showing, which I think is 40 for the velocity of the note, followed by a delta time of zero. Have you got actual sounds being produced?[/quotePost]
Geoff: As I explained in my initial post, all I did was paste the hex data into a hex editor and save as a .mid file. Most of the MIDI file players I have were able to play it (5 out of 7), but some of them just gave an error message (2 out of 7).

Taking a look at the hex bytes at the beginning of the file, the frequent pattern of hex 40 00 appears to be from each Note Off velocity 64 followed by a delta time of 0.

A zero delta time is fine, it just means the event is at the exact same time as the previous event. At the beginning of the track, the initial Program Change, Control Change, and Note On events are all at the same time. At other times, there is often a Note Off to end one note and a Note On to begin a new note at the same time.

The low value delta times are indeed because of the low value resolution of 2 ticks per quarter note. In other words, 1 tick represents an eighth note, so the smallest time advancement possible in this MIDI file is an eighth note.

 
Posted : 01/03/2023 5:35 pm
m
 m
Posts: 3
Active Member
Topic starter
 

Thanks so much Bavi_H and Geoff for getting back so quick and with such helpful information. I'll be working to making the changes you mentioned and hopefully that will sort things out.

Thanks again!

 
Posted : 01/03/2023 8:47 pm
Bavi_H
Posts: 267
Reputable Member
 

User m: I just re-read your original post. You said you created your MIDI file by exporting from some existing software? Out of curiosity, what software was that?

I also noticed another problem in your MIDI file:

The MIDI file appears to use a consistent pattern of starting a note with a Note On event and ending a note with a Note Off event.

However some of the Note On events have a velocity of zero. In MIDI standards, a Note On message with a velocity of zero is another way to end a note. But in this MIDI file it appears the Note On events with velocity zero were intended to be the start of a note.

In your MIDI file, each time there is a Note On with velocity zero followed by a Note Off for the same channel and pitch, MIDI file software will effectively treat them as a two instances of a note end that has no corresponding note start. This will usually show up as two notes with zero duration, and won't make any sound.

For example, the attached picture shows the first track of your MIDI file in Cakewalk's piano roll view. The red circles show instances of a Note On with velocity zero and its following Note Off.

 
Posted : 01/03/2023 9:07 pm
m
 m
Posts: 3
Active Member
Topic starter
 

I have just added the Track End events to all of the tracks and this seems to have gotten me a playable midi file in windows media player and fl studio. 🙂 Thanks so much for you your help Bavi_H! I will be working toward adding all of your other suggestions as well.

 
Posted : 01/03/2023 11:10 pm
Share: