• No se han encontrado resultados

The Musical Instrument Digital Interface (MIDI) protocol is a communication standard developed in the early 1980s that allows different devices, made by different manufacturers, to exchange data and communicate with each other. The protocol was originally created by engineers from Sequential Circuits in 1981 and further developed by a joint collaboration of other popular manufacturers such as Roland, Yamaha, Korg, Oberheim, and Kawai. The official ratification was signed in 1983.

The MIDI protocol is based on a serial interface that runs at the speed of 31,250 bits/s. Being a serial protocol means that any type of data transferred on a MIDI cable is sent one after the other. Even though this may seem a slower way of communicating, compared, for example, with that of a parallel system in which several lanes of data can be sent simultaneously, it is in fact more reliable. MIDI data are based on a binary system in which each piece of information is sent in the form of 1s and 0s (bits). To make the data transferring more efficient and organized, bits are arranged in a group of eight, forming a “byte.” Two or more bytes form a “word” (Figure 3.58).

MIDI data have the advantage of being very small and concise. A typical MIDI message, for example, is the Note On. This message is sent from a MIDI controller every time we press a key. These particular data indicate the note pressed (Note Number) and how hard that key was pressed (Velocity). Keep in mind that only the description of the note played is sent over MIDI, and not the sound itself. This is the main reason why MIDI is so “light” in terms of data transferred. The receiving device (a sound module, for example) will receive the data and pass them to the internal sound generator that only then will produce the sound based on the note number and the velocity received. MIDI is a bit like writing notes on paper (notes and dynamics or note number and velocity); the musician that will play the notes written in the parts is the sound generator.

Table 3.6 MIDI Messages Categories

Channe l Me ssage s Syste m Me ssage s

Channel voice: note on, note off, monophonic aftertouch, polyphonic aftertouch, control changes, pitch bend, program change System real time: timing clock, start, stop, continue, active sensing, system reset Channel mode: all notes off, local control (on/off), poly on/mono on, Omni on, Omni off, all sound off, reset all controllers System common: MTC, song position pointer, song select, tune request, end of system exclusive System Exclusive Figure 3.59 The Status byte for a Note On message, sent on channel 1.

When the MIDI standard was ratified, the manufacturers agreed on a standard codified data structure that all MIDI devices would understand. MIDI data were divided into two main categories: Channels and Systems (Table 3.6). The former are usually associated with performance data and they include two subcategories: Channel Voice and Channel Mode. System messages usually refer to data that address the entire MIDI system and are divided in three subcategories: System Common, Real Time, and Exclusive. For the scope of this book the one we really need to understand is the Channel Voice group. These data are the ones used the most when dealing with software synthesizers and modern studio setups.

Structure of MIDI data

A typical MIDI data is formed by two or more bytes (remember that each byte contains 8 bits). The first byte of a MIDI message is called the Status byte, and the following bytes are called Data bytes. Remember that each byte is sent one at the time because MIDI is a serial protocol. The role of the Status byte is to send two very important pieces of information: the type of message sent and the MIDI channel to which the message is sent. In the MIDI standard there are 16 channels available (from 0 to 15). The structure of a typical Status byte for a Note On message can be seen in Figure 3.59.

As you can see in Figure 3.59 the first bit of the Status byte is reserved as identifier for the type of byte (Status bytes begins with 1, and Data bytes begin with 0). The next three bits are reserved for the type of data sent. For example, a Note On message is described as 001, or a Note Off message is represented by 000. The last four bites of a Status byte describe the MIDI channel on which the message is sent. They range from 0000 (channel 1) to 1111 (channel 16). At this point we need to dig just a bit deeper into how the binary system works in order to better understand the MIDI data structure. Figure 3.60 A simple “1-bit” binary system. Figure 3.61 A “2-bit” binary system.

Table 3.7 Channel Voice Messages With Their Status Bytes and Data Bytes

Status Me ssage De scription Data Byte s

1000 Note Off 2 (pitch, velocity) 1001 Note On 2 (pitch, velocity) 1010 Polyphonic Aftertouch 2 (pitch, pressure) 1011 Control Change 2 (id, value) 1100 Program Change 1 (program) 1101 Channel Aftertouch 1 (pressure) 1110 Pitch Bend 2 (LSB, MSB)

A Binary World

The binary system is a way of describing any number by using only two digits: 1 and 0 (bits). This system is used by computers and electronic circuits because 1 and 0 can be easily represented by “on” and “off” status in a circuit. Now, you might ask, “how is it possible to represent any number using only two digits?” The answer is simple: by concatenating several bits together and assigning an exponentially increasing value to the next bit. This may sound complicated, but, in fact, it is not. If we have a system that has only one bit available we can represent only two numbers: 0 and 1 (Figure 3.60).

If, to this system a second bit is added, now we have four different combinations available: 00, 01, 10, and 11. Therefore we can represent four numbers in total, respectively: 0, 1, 2, and 3 (Figure 3.61). Each additional bit in a binary system allows us to double the numbers we can represent with that system.

It is very simple to find out how many numbers can be described by a certain bit system. The formula is 2 power of n, where n is the number of bit of the system. For example a 4-bit system allows me to represent sixteen numbers (from 0 to 15).