MIDI Specification

From CockosWiki

Jump to: navigation, search

Standard Midi messages consist of 2 or 3 consecutive bytes. Each byte is usually described by two hex characters. In Reaper, Midi events are encoded using the midi spec in the StateChunkAndRppMidiFormat.

Contents

Byte 1 - Message Type

Message Type. Two characters, the first is Message Type (listed below) and the second is MIDI Channel Number (0x0->0xF). For example, 0x90 means Note On, MIDI Channel Zero. The Message type also indicated the number of bytes in the midi message. For example, a Note On message will always contain a total of 3 bytes; one Message Type byte, and two data bytes (Note Number and Velocity).

  • 0x8n - Note Off. This message is sent when a note is stopped.
  • 0x9n - Note On. This message is sent when a note is started.
  • 0xAn - Polyphonic Key Pressure (Aftertouch). This message is usually sent by pressing down on the key after it has been pressed.
  • 0xBn - Control Change. Sent when a controller value changes. Controllers include devices such as pedals and levers. Controller numbers 120-127 are reserved as "Channel Mode Messages".
  • 0xCn - Program Change. Sent when a patch number changes.
  • 0xDn - Channel Aftertouch. This message is usually sent by pressing down on the key after it has been pressed - but it is different from Polyphonic Key Pressure (Aftertouch) which is per note. This is per channel - use this message to send the single greatest pressure value (of all the currently depressed keys).
  • 0xEn - Pitch Wheel. This message is sent to indicate a change in the pitch wheel. The pitch wheel is measured by a fourteen bit value. Center (no pitch change) is 2000H. Sensitivity is a function of the transmitter
The 'F' Message Types are an exception. The second character is part of the message type and does not represent a MIDI channel.
  • 0xF0 - System Exclusive Start, with data1 being the manufacturer's ID and data2 the data itself. This message makes up for all that MIDI doesn't support. Data1 is usually a seven-bit Manufacturer's I.D. code. If a device recognizes the I.D. code as its own, it will listen to the rest of the message, otherwise it will be ignored. System Exclusive is used to send data in bulk, such as patch parameters and other non MIDI spec data. (Note: Only Real-Time messages may be interleaved with a System Exclusive.) This message also is used for extensions called Universal Exclusive Messages.
  • 0xF1 - MIDI Time Code, Quarter Frame
  • 0xF2 - System Common, Song Pointer, with data1 and data2 being LSB and MSB respectively. This is an internal 14 bit register that holds the number of MIDI beats (1 beat = six MIDI clock messages) since the start of the song.
  • 0xF3 - System Common, Song Select, with data1 being the Song Number, data2 unused
  • 0xF4 - Undefined. (Reserved)
  • 0xF5 - Undefined. (Reserved)
  • 0xF6 - Tune Request. This is a request of all analog synthesizers to tune their oscillators
  • 0xF7 - System Exclusive End, data1 and data2 unused
  • 0xF8 - System Realtime, Timing Clock, Sent 24 times per quarter note when synchronization is required
  • 0xF9 - System Realtime, Measure End
  • 0xFA - System Realtime, Start the current sequence playing. (This message will be followed with Timing Clocks.)
  • 0xFB - System Realtime, Continue at the point the sequence was Stopped
  • 0xFC - System Realtime, Stop the current sequence.
  • 0xFD - Undefined. (Reserved)
  • 0xFE - System Realtime, Active Sensing. Use of this message is optional. When initially sent, the receiver will expect to receive another Active Sensing message each 300ms (max), or it will be assume that the connection has been terminated. At termination, the receiver will turn off all voices and return to normal (non-active sensing) operation.
  • 0xFF - System Realtime, Reset. Reset all receivers in the system to power-up status. This should be used sparingly, preferably under manual control. In particular, it should not be sent on power-up.

Byte 2 - Data1

Data1, the data in this field varies and depends on Message Type. note: 7 useful bits (MSB reserved by the MIDI norm, i.e. the max value is 0x7F, not 0xFF)

  • Note Number, for Message Type 0x8
  • Note Number, for Message Type 0x9
  • Note Number, for Message Type 0xA
  • Controller Number, for Message Type 0xB

Controller Number

Controller #DescriptionData2 format (if any)
0x00Bank Select (coarse). This is for MIDI devices which have more than 128 Programs. MIDI Program Change messages only support switching between 128 programs; Bank Select Controller (also called Bank Switch) can be used to allow switching between groups (Banks) of 128 programs. For example, a device that has 512 Programs. It could divide these 512 into 4 banks of 128 programs. Program 129 would be the first program within the second bank. So - Send a Bank Select Controller to switch to the second bank (first bank is #0, so tye second is probably #1), and then send a Program Change and select the first Program in bank #1. For MultiTimbral devices each Part usually can be set to its own Bank/Program.

Drum Machines sometimes use Bank Select to switch between "Drum Kits".

NOTE: When a Bank Select is received, the device doesn't change to a patch in the new bank straight away. The Bank Select value is stored by the device and when a Program Change message is received the stored Bank Select value is used to switch to the patch in the new bank. Bank Select must be sent before a Program Change, if you want to change to a patch in a different bank that is. If you want another patch in the same bank there's no need to send a Bank Select. Value Range:

NOTE: Most devices don't have more than 128 banks of 128 Patches each, so they don't need to response to the fine version of this CC.

0x01Modulation Wheel (coarse). Sets the MOD Wheel to a particular value. For MultiTimbral devices each Part usually has its own MOD Wheel setting.
0x02Breath Controller (coarse). The musician can set this controller to affect what he or she chooses. Breath control is a wind player's version of Aftertouch. If a MultiTimbral device, then each Part usually has its own Breath Controller setting.
0x03Continuous controller #3
0x04Foot Contoller (coarse). The musician can set this controller to affect what he or she chooses. This foot pedal is a continuous controller. If a MultiTimbral device, then each Part usually has its own Foot Pedal value.
0x05Portamento Time (coarse). The rate at which the pitch slides between two notes. If a MultiTimbral device, then each Part usually has its own Portamento Time.
0x06Data Entry Slider (coarse). The value of some Registered or Non-Registered Parameter. Which parameter is affected depends upon a preceding RPN or NRPN message (which itself identifies the parameter's number).

This slider may not be used in conjunction with RPN or NRPN messages; the musician can set the slider to control a single parameter directly.

If a MultiTimbral device, then each Part usually has its own RPN and NRPN settings, and Data Entry slider setting.

0x07Main Volume (coarse). The device's volume level. If a MultiTimbral device, then each Part has its own volume. In this case, a device's master volume may be controlled by another method such as the Univeral SysEx Master Volume message, or take its volume from one of the Parts, or be controlled by a General Purpose Slider controller.

NOTE: Almost all devices ignore the Fine adjust (#39) for Volume, and just implement Coarse adjust (#7) because 14-bit resolution isn't needed. In this case, maximum is 127 and off is 0.

0x08Stereo Balance (coarse). Affects:

The device's stereo balance (assuming that the device has stereo audio outputs). If a MultiTimbral device, then each Part usually has its own Balance. This is generally when Balance becomes useful, because then you can use Pan, Volume, and Balance controllers to internally mix all of the Parts to the device's stereo outputs. Typically, Balance would be used on a Part that had stereo elements (where you wish to adjust the volume of the stereo elements without changing their pan positions), whereas Pan is more appropriate for a Part that is strictly a "mono instrument".

NOTE: Almost all devices ignore the Fine adjust (#40) for Balance, and just implement Coarse adjust (#8) because 14-bit resolution isn't needed.

0x09Continuous controller #9
0x0APan (coarse). The Pan (Left/Right) setting for a device. If a MultiTimbral device, then each Part usually has its own pan position. Pan is then used, along with Volume, and Balance controllers to internally mix all of the Parts to the device's stereo outputs.

NOTE: Almost all devices ignore the Fine adjust (#42) for Pan, and just implement Coarse adjust (#10) because 14-bit resolution isn't needed for this.

0x0BExpression (sub-Volume) (coarse). This is a percentage of the value set by Volume Controller). Expression divides the current volume into 16,384 steps (or 128 if 8-bit instead of 14-bit resolution is used). Volume Controller is used to set the overall volume of the entire musical part, while Expression is used for crescendos and diminuendos. This message makes it possible to adjust the overall volume of a part without having to adjust every single MIDI message comprising a crescendo or diminuendo. When Expression is at 100% the volume represents the true setting of Volume Controller. Lower values of Expression subtract from the setting of Volume Controller. When Expression is 0% then volume is off. When Expression is 50% then the volume is cut in half. All this is within the upper limit set by Volume Controller.

If a MultiTimbral device, then each Part usually has its own Expression level.

NOTE: Almost all devices ignore the Fine adjust (#43) for Expression, and just implement Coarse adjust (#11) because 14-bit resolution isn't needed.

0x0CEffect Control 1 (coarse)
0x0DEffect Control 2 (coarse)
0x0EContinuous controller #14
0x0FContinuous controller #15
0x10General Purpose Slider 1
0x11General Purpose Slider 2
0x12General Purpose Slider 3
0x13General Purpose Slider 4
0x14Continuous controller #20
0x15Continuous controller #21
0x16Continuous controller #22
0x17Continuous controller #23
0x18Continuous controller #24
0x19Continuous controller #25
0x1AContinuous controller #26
0x1BContinuous controller #27
0x1CContinuous controller #28
0x1DContinuous controller #29
0x1EContinuous controller #30
0x1FContinuous controller #31
0x20Bank Select (fine), usually ignored
0x21Modulation Wheel
0x22Breath Controller
0x24Foot Contoller
0x25Portamento Time
0x26Data Entry Slider
0x27Main Volume
0x40Sustain Pedal0x00-0x3F (off) 0x40-0xFF (on)
0x41Portamento0x00-0x3F (off) 0x40-0xFF (on)
0x42Sostenato pedal0x00-0x3F (off) 0x40-0xFF (on)
0x43Soft pedal0x00-0x3F (off) 0x40-0xFF (on)
0x60Data Increment0x7F
0x61Data Decrement0x7F
0x62Non-Registered Parameter NumberLSB
0x63Non-Registered Parameter NumberMSB
0x64Registered Parameter NumberLSB
0x65Registered Parameter NumberMSB
0x79Reset All Controllers, When Reset All Controllers is received, all controller values are reset to their default values0x7F
0x7ALocal, When Local Control is Off, all devices on a given channel will respond only to data received over MIDI. Locally played data, etc. will be ignored. Local Control On restores the functions of the normal controllers00 (off) / 0x7F (on)
0x7BAll Notes Off00
0x7COmni Off00
0x7DOmni On00
0x7EMono0x00-0x0A
0x7FPoly00
  • Program Number, for Message Type 0xC
  • Pressure, for Message Type 0xD
  • LSB (Least Significant Byte), for Message Type 0xE
  • 0xFn Message types are documented in RPP field 3 above

Byte 3 - Data2

Data2, the data in this field varies and depends on Message Type note: 7 useful bits

  • Velocity, for Message Types 0x8 and 0x9
  • Pressure, for Message Type 0xA
  • Data, for Message Type 0xB, the format of this will be dependant on the MIDI device being controlled, see Data1 Message Type 0xB for details.
  • Not Used for Message Type 0xC
  • Not Used for Message Type 0xD
  • MSB (Most Significant Byte) for Message Type 0xE
  • F? Message types are documented in RPP field 3 above
Personal tools