-
Notifications
You must be signed in to change notification settings - Fork 7
02 MIDI Basics

The MIDI (Musical Instruments Digital Interface) is a very well known protocol in the music industry, used to connect digital instruments between them and with a computer. It allows to send and receive messages trough for example a USB cable.
Without going in technical details, a MIDI message can contain for example what note we want to play and with what intensity. Lets say that we want a D3 with a intensity of 127. Note that intensity, or also called velocity is a value from 0 to 127, because there are 7 bits to encode that value.
Just in case, if you don't remember a byte is a set of 8 bits. A typical MIDI message has 3 bytes, which means 24 bits. Each of these bits has a 0 or a 1 according to what message we want to send. We can divide this 3 bytes in: The first byte corresponds to the state and carries information related also to the channel. Here we have the information of what king of message we want to send. For example, we have noteOn or noteOff message, where the first one will play a note with an intensity given by the next bytes. The second byte content will depend on the type of message set in the first byte. If the first byte was indicating a noteOn message, the second byte will indicate which note is going to be played. The third byte also depends on the message. If we have send a noteOn message in the first byte, this third byte will be the intensity of the note.