MIDI Protocol - MIDI messages

Leggi questa pagina in Italiano Lire cette page en Franšais
CDROM Multimedia Audio Course Enjoying this Course?
Download the full version!

As we hinted earlier, a MIDI message is made up of a series of bits arranged according to a scheme that is common to all messages. The following diagram shows a typical MIDI message:

The Midi Protocol - An example of a MIDI message

An example of a MIDI message

The message is made up of three bytes enclosed between two bits, an initial start bit and a final stop bit.

The first of the three bytes is called status byte and its role is to notify what kind of message we have. Status bytes always have their first bit set on 1. Bits 2,3 and 4 indicate the kind of message, and being 3 bits, 8 different kinds of messages are available (23). The last 4 bits of the first byte identify the midi channel, therefore we have 16 available channels. Note that the nibble 0000 (a nibble is a sequence of 4 bits) identifies channel 1 and nibble 1111 (which is worth 15 in decimals) identifies channel 16. In the message we have taken as our example we are transmitting data onto channel 3.

After the status byte we have two data bytes, in other words, two bytes that transport numeric information pertaining to the message defined in the status byte. A data byte always has its first bit set on 0. The last 7 bits of the first data byte describe the played note; with 7 bits we can discern 128 (27) notes (which is usually more than enough if we think that the piano, that has amongst the largest note-extension, has 88 notes). In our example we are playing note 64 (1000000). The second data byte indicates the note's velocity, in other words the intensity at which it was played. All recently produced keyboards with MIDI interface have a function called soft touch which converts the intensity with which a certain key has been played into a value. This way we can reproduce the way the hand touches the keys and accordingly play musical pieces in "pianissimo" or "forte", for example. The value is associated to velocity because many soft touch systems are based on the speed at which a key is pressed on the assumption that the higher the speed is, the greater the played note's intensity. In our case the speed value is 90 (1011010). Clearly the meaning of the data contained in the data byte varies according to the kind of status byte in question. Let's now take a look at the various types of MIDI messages.

20.4.1. Channel voice messages

  1. Note off: interrupts the execution of a note. It has the following format:

    The three bits which identify this kind of message are: 000

    [1 0 0 0 c c c c ] [0 n n n n n n n] [0 v v v v v v v]

    where: c = midi channel (4 bit), n = played note (7 bit), v = velocity (7 bit)

  2. Note on: plays a note. It has the following format:

    The three bits that identify this kind of message are: 001

    [1 0 0 1 c c c c ] [0 n n n n n n n] [0 v v v v v v v]

    where: c = midi channel (4 bit), n = played note (7 bit), v = velocity (7 bit)

  3. Polyphonic aftertouch (key pressure): after a key has been pressed, it can be moved again to create a vibrato effect. This kind of message transports information regarding the said movement. It is rarely used because it requires a sensor for each key, and therefore ends up being pretty expensive.

    The three bits which identify this kind of message are: 010

    [1 0 1 0 c c c c ] [0 n n n n n n n] [0 p p p p p p p]

    where: c = midi channel (4 bit), n = played note (7 bit), p = pressure (7 bit)

  4. Channel pressure (aftertouch): like the previous with the exception that one single sensor is used for the entire keyboard. A movement on a key will apply a vibration to all the other notes being played in that moment on the channel in question. This control can also be applied to other quantities such as a tremolo or a filter's cut-off frequency.

    The three bit that identify this kind of message are: 011

    [1 0 1 1 c c c c ] [0 n n n n n n n] [0 p p p p p p p]

    where: c = midi channel (4 bit), n = played note (7 bit), p = pressure (7 bit)

  5. Program change: with this command we can change the sound that is assigned to a certain channel into another sound.

    The three bits that identify this kind of message are: 100

    [1 1 0 0 c c c c ] [0 p p p p p p p] [0 - - - - - - -]

    where: c= midi channel (4 bit) p= program - sound (7 bit)

  6. Control change: used to control the parameters related to the channel in question, such as: volume, modulation (applied from the joystick available on many keyboards) and pan. If, for example, we wished the volume on a certain instrument to gradually increase, we can send a series of these messages with ever-increasing volume values.

    The three bits that identify this type of message are: 101

    [1 1 0 1 c c c c ] [0 n n n n n n n] [0 v v v v v v v]

    where: c = midi channel (4 bit), n = control code (volume, pan etc.) (7 bit), v = value (7 bit)

  7. Pitch Bending: allows us to carry out bending on a note (if you don't know what this is, ask the Jimi Hendrix wannabee guitarist next door!). In this case 128 different shades of bending are not enough, especially when it comes to slow bending, and a rather annoying 'gapped stairs' effect could be generated. That's why the 7 bit of the second data byte are also used, in order to bring the bending resolution to 14 bit, in other words 16384 different grades.

    The three bits that identify this kind of message are: 110

    [1 1 1 0 c c c c ] [0 B B B B B B B] [0 b b b b b b b]

    where: c = midi channel (4 bit), B = first 7 bits of the bending value, b = last 7 bits



20.4.2. Channel mode messages

In relation to the control change message (belonging to Channel Voice Messages) we can have 127 different codes (the 7 bit of the first data byte). The first 120 pertain to typical parameters such as volume, pan, etc. The last 7 are messages that act on a channel's functioning modes and are:

121 - Reset all controllers: all the devices' parameters are put back to their initial value (the value given when the device is turned on).

122 - Local control on/off: to explain the way this kind of message works let's take a look at the following diagram:

The Midi Protocol - Local control

Local control

On a keyboard that has its own audio output, a key's pressure will act on the circuit which in turn accesses a sound present in the memory and transfers it to the audio output where it becomes a sound. The signal generated by the key and sent to the keyboard's circuits is called local control. If the keyboard is also connected via MIDI, when a key is pressed a copy of the signal notifying which key has been pressed is sent to the MIDI OUT port. However, this signal re-enters the keyboard from the MIDI IN port and then once again acts on the sound bank. Thus an undesirable echo effect is created because the playing of the note is generated by two different events: directly from the pressure on the keyboard's key, and from the signal itself, which has taken a different route passing by the sequencer's MIDI interface. As we can see in the diagram, in a MIDI connection the local control signal gets deactivated, and sorts the problem out.

123 - All notes off: on certain sequencers it is also called panic or reset devices. It can sometimes happen that certain MIDI messages are not received properly and that therefore a "note off" message might not be received, thus leaving a note playing. This message sends a "note off" signal to all the notes.

124-125-126-127: the last 4 messages define the so-called MIDI mode, in other words, the way in which the keyboard interprets the MIDI commands.

124-125 Omni mode off-on: these two messages activate or deactivate the Omni mode. When it is activated, this mode makes sure that the MIDI messages ignore the information concerning the channel and therefore each message is applied to all of the channels. Vice versa, when this mode is deactivated, each message is applied to the channel indicated by the status byte.

126-127 Mono On - Poly On: mono mode means that you can play just one single note at a time on a channel. Poly mode on allows us to play many notes at once on the single channel [47 ].



20.4.3. System messages

These kind of messages are sent simultaneously to all the MIDI channels. This message has the following definition:

[1 1 1 1 t t t t ] [0 d d d d d d d] [0 d d d d d d d]

where: c = midi channel (4 bit), B = first 7 bit of the bending value, b = last 7 bit

There are three kinds of system messages:

20.4.3.1. System common

These include:

  • MTC: Midi Time Code (timing), for a detailed description of this topic please refer to the synchronization section [MTC - MIDI Time Code ] of this course.

  • Song Position Pointer : identifies a particular point in a song using a time-reference code.

  • Song select: selection of a song in the device's memory.

  • End of exclusive: end of system data transmission, which we'll describe later on.


20.4.3.2. System real time

These are short messages (only 1 byte) which get sent together with normal messages. Their purpose is to maintain synchronization between the systems connected via MIDI. These messages are sent continuously at a rate of 24 times every fourth of a note, therefore the number of messages sent in a time unit increases as the bpm of the piece increases. If the amount of MIDI data to be sent is enormous, it could be useful to send the timing messages to a separate MIDI output.


20.4.3.3. System Exclusive

These messages transport specific data of the device that is being used. Every professional MIDI device has this function which allows us to download via MIDI all the memory (or as is sometimes said execute a dump[48 ]). This way all the settings that have been made on the device for a certain job are sent to a computer, where they are stored. If we need to set up the device with completely different configurations it is very handy and time-saving to use the settings saved on a computer in file format and re-transfer them back to the device, once again via MIDI.






[47 ] It's worthwile pointing out the difference between the words polyphonic and multitimbral which indicate different characteristics in a keyboard. By polyphonic what we mean is that the keyboard is capable of playing many notes at the same time on the same MIDI channel. Multitimbral on the other hand, means that a keyboard is able to play more than one instrument at the same time (obviously on different MIDI channels) whereas monotimbral means that only one instrument can be played.

[48 ] In computer science terms this word means the generation of a spare copy of data. In toilets... something different, but you get the idea!








curve 

Read alla about Audiosonica-Wikipedia integration Related topics on Wikipedia

curve 

Latest Comments

curve 

Latest Posts

curve 

Most visited