Skip to content Skip to navigation

Connexions

You are here: Home » Content » MIDI Messages

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Endorsed by Endorsed (What does "Endorsed by" mean?)

This content has been endorsed by the organizations listed. Click each link for a list of all content endorsed by the organization.
  • IEEE-SPS display tagshide tags

    This module is included inLens: IEEE Signal Processing Society Lens
    By: IEEE Signal Processing SocietyAs a part of collection: "Musical Signal Processing with LabVIEW (All Modules)"

    Comments:

    "A multimedia educational resource for signal processing students and faculty."

    Click the "IEEE-SPS" link to see all content they endorse.

    Click the tag icon tag icon to display tags associated with this content.

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "Musical Signal Processing with LabVIEW (All Modules)"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection: "Musical Signal Processing with LabVIEW (All Modules)"

    Comments:

    "Developed by Rose Hulman Prof Ed Doering, this collection is a multimedia educational resource for students and faculty that augments traditional DSP courses and courses that cover music […]"

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • NI Signal Processing display tagshide tags

    This module is included inLens: Digital Signal Processing with NI LabVIEW and the National Instruments Platform
    By: Sam ShearmanAs a part of collection: "Musical Signal Processing with LabVIEW (All Modules)"

    Comments:

    "This online course covers signal processing concepts using music and audio to keep the subject relevant and interesting. Written by Prof. Ed Doering from the Rose-Hulman Institute of Technology, […]"

    Click the "NI Signal Processing" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

MIDI Messages

Module by: Ed Doering. E-mail the authorEdited By: Erik Luther, Sam Shearman

Summary: Basic MIDI messages include those that produce sound, select voices, and vary a sound in progress, such as pitch bending. In this module you will learn about the most common types of MIDI messages at the byte level, including: Note-On, Note-Off, Program Change, Control Change, Bank Select, Pitch Wheel, and Syste-Exclusive. The General MIDI (GM) standard sound set is also introduced.

Introduction

A MIDI message conveys information between MIDI-capable equipment. For example, a message could indicate that a note should begin sounding, or that a specific type of sound be selected, or that the position of a pitch-bender control has just changed. MIDI messages are typically three bytes long: a status byte followed by two data bytes. Status and data bytes are distinguished by the value of the MSB (most-significant bit); the MSB is set to a “1” for status bytes, and is cleared to a “0” for data bytes.

When the MIDI standard was developed in 1983, MIDI messages were designed for compatibility with serial communications through UARTs (universal asynchronous receiver-transmitters), the digital device “hiding” between the COM port on a desktop computer. In this way standard computer equipment could be interconnected to musical equipment including synthesizers, keyboards, sound modules, and drum machines.

The original MIDI electrical interconnection was designed for compatibility with standard audio cables terminated with DIN-5 connectors. Look at the back of a typical synthesizer, and you will see three connectors that look like this:

Figure 1: Rear-panel MIDI connectors for IN, OUT, and THRU
Figure 1 (connectors.png)

The electrical connection is unidirectional. The MIDI IN connector accepts a signal transmitted from the MIDI OUT connector of another device. Many different devices can be cabled together in a daisy chain, like this:

Figure 2: Typical daisy-chain connection scheme for several MIDI devices
Figure 2 (daisy_chain.png)

Since it is not always desirable to have every single device process and re-transmit received MIDI messages, the MIDI THRU connector offers an electrically-identical version of the signal received on the MIDI IN connector. For example, the sound module and drum machine do not generate MIDI messages, so they can simply pass through the signals. However, the keyboard generates messages, so the MIDI OUT connector must be used.

MIDI messages associated with the actual musical performance -- note on, note off, voice selection, and controller status – use the concept of a channel. For example, suppose that one synthesizer has been configured to associate “Channel 3” with the sound of a cello, and another synthesizer has been configured to associate “Channel 7” with the sound of a flute. When both of these interconnected synthesizers receive a “note on” message for Channel 3, only the first synthesizer will begin to sound a cello; the second synthesizer will ignore the message. In this way, many different devices can be interconnected, and configured to respond individually according to the channel number.

The MIDI standard for electrical interconnection specifies a fixed bit rate of 31.25 kbits/second. In the days of 8-MHz personal computers, 31.25 kbaud was considered quite fast. The rate is adequate to communicate performance information between several interconnected devices without noticeable delay, or latency. Today, however, MIDI messages are more often conveyed through USB. MIDI-to-USB converter boxes are available for older synthesizers that do not support USB directly.

Making a Sound: Note-On and Note-Off Events

As mentioned earlier, most MIDI messages are three bytes in length: a status byte followed by two data bytes. The status byte for the Note-On event is 1001nnnn (0x9n in hexadecimal), where nnnn indicates the channel number. Since a four-bit value selects channel, there are a total of 16 channels available. The channels are called “Channel 1” (nnnn=0000) to “Channel 16” (nnnn=1111).

The first data byte indicates the note number to begin sounding, and the second data byte indicates the velocity at which the key was pressed. Since the MSB (most-significant bit) of a data byte is zero by definition, note number and velocity are each 7-bit values in the range 0 to 127.

Hexadecimal notation is commonly used to describe MIDI messages. For example, the three-byte message 0x93 0x5C 0x42 indicates a Note On event on Channel 4 for note number 92 with velocity 66.

The Note-Off event is similar; its status byte is 1000nnnn (0x8n). For example, the three-byte message 0x83 0x5C 0x35 indicates that note number 92 on Channel 4 should cease sounding, and that the key release velocity was 53. Synthesizers and sound modules generally equate keypress velocity with amplitude; however, they are less likely to use the release velocity. A “Note On” event with zero velocity is equivalent to a “Note Off” event.

The following screencast video shows MIDI Note On and Note Off messages produced by the Roland XP-10 synthesizer and visualized using the MIDI OX software application. MIDI OX is a free MIDI utility that serves as a MIDI protocol analyzer. The video also shows how MIDI OX can play standard MIDI files such as instruments.mid, a short multi-instrument composition that illustrates the concept of MIDI channels:

Figure 3: [video] Visualize MIDI note-on and note-off messages generated by the Roland XP-10 synthesizer
Figure 3 (midi_messages-note.html)

If you plan to start using MIDI OX right away, take a look at the following screencast that explains how to set up MIDI OX to work with a MIDI device such as a synthesizer, and how to set up your soundcard so that you can visualize the MIDI messages produced by a MIDI player such as Winamp or Windows Media Player. You will also need to install the support application called MIDI Yoke, which serves as a virtual MIDI patch bay to interconnect all of the MIDI-related devices on your computer.

Figure 4: [video] Setting up MIDI-OX to view MIDI messages
Figure 4 (midi_messages-MIDI-OX-setup.html)
Figure 5: [video] Setting up your soundcard to work properly with MIDI-OX and a media player
Figure 5 (midi_messages-soundcard-setup.html)

Selecting a Voice: Program Change

The Program Change message selects which of 128 possible voices (also called sounds, tones, or patches) to associate with a particular channel. The status byte for the Program Change message is 1100nnnn (0xCn), where nnnn indicates the channel number. Only one data byte called the program number follows the status byte for this message type. For example, the two-byte message 0xC7 0x5F directs the synthesizer to use program number 95 for all subsequent Note-On and Note-Off messages directed to Channel 8.

The original MIDI standard did not constrain equipment manufacturers in what sounds or voices to associate with program numbers. However, as it soon became apparent that defining standard voices for the 128 program numbers would make it easier for composers to distribute multi-voice (or multitimbral) compositions with the expectation of the listener hearing what the composer had intended. The General MIDI (GM) standard defines 128 basic voices to be associated with the 128 program numbers. Moreover, Channel 10 is always defined as a percussion instrument under the General MIDI standard. See the GM Level 1 Sound Set for a table of voices and percussion key map. Note that the seven-bit program number ranges from 0 to 127; the associated GM voice will range from 1 to 128. The following screencast video gives you a quick tour of the 128 General MIDI voices as they sound on my Roland XP-10 synthesizer.

Figure 6: [video] Tour of the General MIDI sound set as played by the Roland XP-10 synthesizer
Figure 6 (midi_messages-GMtour.html)

The seven-bit program number can select from among a palette of 128 voices, yet musicians and composers find this value too limiting. Equipment manufacturers can easily provide thousands of voices thanks to the falling cost of solid-state memory.

With these facts in mind, it will be easier to understand why selecting a new voice for a channel can produce up to three distinct MIDI messages! The first two messages are Control Change messages, and the third message is a Program Change message. The status byte of a Control Change message is 1011nnnn (0xBn), where nnnn indicates the channel number. The first data byte following the status byte indicates the controller number, and the second data byte indicates the controller value. The Control Change message will be described more fully in the following section. When the Control Change message is used select a voice, the controller number can be either 0x00 or 0x20 to indicate that the second data byte is either the most significant byte or the least significant byte, respectively, of a combined 14-bit bank select value. An example will clarify these concepts.

Suppose that the following three MIDI messages are received by a synthesizer (each message is destined for Channel 1):

0xB0 0x00 0x2F

0xB0 0x20 0x38

0xC0 0x0E

The first message is a Control Change with control number 0x00, so the upper seven bits of the bank select value are 010_1111. The second message is also a Control Change, but the 0x20 control number signifies that the lower seven bits of the bank select value are 011_1000. Thus the first two messages communicate a single 14-bit bank select value of 01_0111_1011_1000. Lastly, the Program Change message indicates that program number 15 is to be used. With all three messages, it is possible to select a unique voice from among 2 raised to the 21st power possible voices (2,097,152 possible voices).

This clever scheme permits newer equipment with more than 128 voices to properly respond to the rich palette of possible voices, while older equipment that only supports the basic 128 voices defined by the General MIDI standard will simply ignore the two bank select messages and respond to the Program Change message. Equipment manufacturers therefore will often define tone variations on a theme defined by the program number. For example, since program number 1 defines “Acoustic Grand Piano,” the bank select technique can be used to define many different types of acoustic grand pianos.

Figure 7: [video] Visualize "Bank Select" and "Program Change" MIDI messages that select different voices
Figure 7 (midi_messages-bankselect.html)

Modifying a Sound: Control Change and Pitch Wheel Change

Musicians need to do more than simply turn a note on and off. To be expressive, a musician needs to be able to modify a sound already in progress. Synthesizers offer various knobs and sliders that can introduce pitch bends and vibrato, for example.

The Control Change message indicates that a control has just been changed. The status byte of a Control Change message is 1011nnnn (0xBn), where nnnn indicates the channel number. The first data byte following the status byte indicates the controller number, and the second data byte indicates the controller value. Since the controller number is seven bits, 128 controller types are possible. Typical controllers include modulation wheel (0x01), main volume (0x07), sustain pedal (0x40), and general-purpose controllers (0x50 to 0x53).

Musicians use a synthesizer’s pitch wheel introduces to bend (temporarily raise or lower) the pitch of the entire keyboard. In order to provide more frequency resolution, the pitch wheel has a dedicated MIDI message; the two data bytes afford fourteen bits of resolution rather than the seven bits of resolution that are possible with a control change message.

The Pitch Wheel Change message indicates that the pitch wheel has just moved. The status byte of a Pitch Wheel Change message is 1110nnnn (0xEn), where nnnn indicates the channel number. The first data byte following the status byte is the lower seven bits of the overall 14-bit position value, and the second data byte contains the upper seven bits of the position value. The nominal value is 0x2000 when the pitch wheel is centered (data byte #1 = 0x00, data byte #2 = 0x40). Moving the pitch wheel to its lower (leftmost limit) produces a value of 0x0000, while moving it to its rightmost limit produces a value of 0x3FFF (data byte #1 = 0x7F, data byte #2 = 0x7F). Note that the Pitch Wheel Change message simply indicates the position of the pitch wheel; the synthesizer may interpret this position in various ways depending on other settings. For example, my synthesizer defaults to a whole step down when the pitch wheel is moved to its left limit, however, it can be adjusted to shift by an entire octave for the same amount of pitch wheel movement.

The following screencast illustrates the MIDI messages generated by the slider controls and pitch wheel.

Figure 8: [video] Visualize "Control Change" MIDI messages produced by a general-purpose slider, and the "Pitch Wheel Change" messages produced by the pitch-bender
Figure 8 (midi_messages-control-pitch.html)

Transferring Data: System Exclusive Messages

The System Exclusive (SysEx) message provides a mechanism to transfer arbitrary blocks of information between devices. For example, the complete configuration of a synthesizer can be uploaded to a computer to be retrieved at a later time. The term “exclusive” indicates that that information pertains only to a particular vendor’s piece of equipment, and that the organization of the information is vendor-specific.

The transfer process begins with the System Exclusive Start message with status byte 11110000 (0xF0). The following data byte is the manufacturer ID. All following bytes must be data bytes in the sense that their most-significant bit is always zero. An arbitrary number of bytes may follow the manufacturer ID. The transfer process ends with the System Exclusive End message with status byte 11110111 (0xF7); no data bytes follow this status byte.

Other Messages

The messages discussed in this module are representative of what you will encounter when working with synthesizers and standard MIDI files, but are by no means a complete listing of all available messages. Refer to the MIDI Manufacturers Association for full details on the MIDI standard; see the specific tables noted in the last section of this module.

For Further Study

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks