0

I am currently working on producing an AI that will learn from music in midi files and then produce its own music. In order to do this I need to convert a few hundred, perhaps a few thousand in the future, midi files into images so that I can use specific algorithms to train it.

I need to understand the midi hex code to do this, but what I'm confused about is the couple of bytes after a note on or note off sequence. ex:

90 33 49 00 
90 44 4b 44 
90 3a 49 43 
90 3f 49 8d 79

I understand that the "90" means note on, the second byte means the note pitch, the third is the velocity, but I'm not entirely sure about the fourth and/or fifth byte.

I'm assuming that the fourth and fifth byte have something to do with time intervals, because notes played at the same time appear to each have 00 after them so that no time is between them. but then why do some notes have one filled byte after them like with the 2nd and 3rd note I showed, but then the last has two bytes? Also, I thought that 8x was reserved for note endings but that last note says "8d", which I thought would be for channel 14, but the midi files I'm using have only 1 channel (just for piano).

Note: I'm pretty new here so I wasn't sure if this should be in the sound or music stackexchange, and I also don't know all the proper terminology when it comes to electronic music and midi, so any help editing my title or description to make it more clear would be appreciated.

  • 1
    I can throw you a link to the official MIDI Association, but even though I did this for a living for 10 years, I don't know enough about the underlying spec to be able to answer. midi.org/specifications – Tetsujin Nov 15 '18 at 20:12
0

In SMF format files, every event is preceded by a delta time value, which specifies the time from the last event, and is encoded as a variable-length quantity, where a byte with the most significant bit set indicates that (at least) another byte with seven more bits follows. Delta times and actual MIDI bytes cannot be confused because they must occur alternately.

You really should read the Standard MIDI Files (SMF) Specification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.