Table of Contents:


What is MIDI?

MIDI—Musical Instrument Digital Interface— is the protocol used to digitize musical information. The files are all in binary and can be read easily. In this section we will be dissecting the binary data of a MIDI file.


Reading

Midi Protocol defines how the .mid file is read. For this example, I will be reading the file in python for ease of syntax.

Header Chunk

In the header you will find some data as follows

<Chunk Type><Chunk Length><Format><ntrks><division>

The chunk type for the header will always be MThd. And the length will always be the number 6.

The Format tells us how to read the file: