MIDI Registered Parameter Number (RPN)

The MIDI registered parameter number (RPN) is a value carried by a MIDI controller messages with controller hexadecimal values of 0x64 and 0x65. Such message specifies that subsequent data entry MIDI controller messages or data button increment / decrement controller messages are to affect a specific type of controller that has been registered with the International MIDI Association under the value specified by the registered parameter number.

The registered parameter numbers are thus a way to extend available MIDI controller messages beyond the limit of 128 possible controllers. The MIDI pitch wheel message for example changes the amount of pitch of a MIDI channel and the value of the new MIDI pitch can be between 0x0000 and 0x3FFF. 0x2000 is always center and specifies no pitch change. 0x0000 is usually (but not always) two semitones lower and 0x3FFF is usually (but not always) two semitones higher. The MIDI controller message table and other MIDI messages do not provide a way to define the interval 0x0000 to 0x3FFF strictly in terms of semitones or in any other way. The International MIDI Association, however, has registered a parameter number for the MIDI controller messages with controller values of 0x64 and 0x65 that allows the pitch interval to be strictly defined with subsequent data entry MIDI controller messages.

Example

Consider a scenario in which a MIDI device receives the following two messages.

0xB0 0x64 0x00
0xB0 0x65 0x00

The status byte 0xB0 shows that both are MIDI controller messages for channel 0. The first controller message has controller value of 0x64, which means that this is a Registered Parameter Number (fine, or lower bits) controller. The second controller value is 0x65, which means that this is a Registered Parameter Number (coarse, or higher bits) controller. The two last bytes of the two messages have the value 0x00 and 0x00, which will tell the MIDI device that the range of the pitch bend is about to change. These two values have been registered with the International MIDI Association to carry this kind of information. In summary, the two messages above tell the MIDI device that the pitch bend range is about to change. The MIDI device should then expect data entry or data increment / decrement messages that will define the new pitch range.

To actually make a change to the pitch range, the MIDI device should receive messages similar to the two messages that follow. Suppose that the MIDI device receives the following messages.

0xB0 0x06 0x02
0xB0 0x26 0x03

The status byte 0xB0 shows that both messages are controller messages for channel 0. The first message has a controller value of 0x06, which means that this is a Data Entry (coarse) controller and the second message has a controller value of 0x26, which means that this is a Data Entry (fine) controller. Since the MIDI device is waiting for a pitch range change, it will interpret the third byte of each message as follows: The coarse data entry is 0x02, which means that the pitch wheel will go +/- 2 semitones. The fine data entry is 0x03, which means that the pitch wheel will go +/- 3 cents. Thus, the range of the pitch shift has been fully specified. The pitch shift can move two semitones and three cents down to 0x0000 or two semitones and three cents up to 0x3FFF.

According to the MIDI protocol, the MIDI device should also receive the following two messages.

0xB0 0x64 0x7F
0xB0 0x65 0x7F

The status byte 0xB0 shows that these two messages are MIDI controller messages for channel 0. They carry the controller values of 0x64 and 0x65 and mean RPN fine and coarse controllers. They have the values 0x7F which signifies the end of the controller sequence.

Protocol for sending controller messages with registered parameter numbers

To properly use the registered parameter number (RPN) controller, a MIDI device must receive a sequence of messages as follows.

  1. Two controller messages with controller numbers 0x64 and 0x65 and values that specify the registered parameter numbers and define what is to follow. The values of the third bytes of these two messages will be combined into a 14-bit value by dropping the most significant bit of each byte. The resulting 14-bit value is registered with the International MIDI Association (IMA) and describes a specific purpose of what is to follow (i.e., 0x0000 means a new pitch bend range as in the example above; other values are shown below).
  2. One or two data entry messages that specify what is to be done with the specific controller. Data entry messages have controller values of 0x06 and 0x26 (coarse and fine respectively). The fine data entry message (0x26) can be omitted depending on the registered parameter number defined in the two controller messages above. The values of the third bytes of the two data entry controller messages are also combined in a 14-bit value by omitting the most significant bit of each byte. The 14-bit value has different significance depending on the type of controller being affected. If the RPN is a pitch bend range as in the example above and if, for example, the value sent with the data entry messages is 0x0103 (which, when split into two 7-bit values, translates to 0x02 and 0x03) then the pitch bend will vary +/- two semitones and three cents as in the example above. Alternative to data entry controller messages, the MIDI device could also receive data button increment or data button decrement messages. These messages are MIDI controller messages with controller values of 0x60 and 0x61 and instead of specifying the exact value of the controller these messages increase or decrease respectively its current value. An example using these controllers is provided below.
  3. Two controller messages with controller numbers 0x64 and 0x65 and with values 0x7F and 0x7F signifying the end of this controller sequence. These two messages are optional, but are a good practice, as if not sent, the coarse and fine controller numbers would remain set forever in practice and a random data entry message could have unintended effects.

Defined RPNs

The following is a list of RPN values for the 14-bit values of the 0x64 and 0x65 controllers that have been registered with the IMA.

0x0000 – Pitch bend range
0x0001 – Fine tuning
0x0002 – Coarse tuning
0x0003 – Tuning program change
0x0004 – Tuning bank select
0x0005 – Modulation depth range

Pitch bend range: The pitch bend RPN sequence adjusts the range of the MIDI pitch wheel message. It needs both data entry (coarse and fine) messages.

Fine tuning: The fine tuning RPN sequence adjusts the tuning of a channel. It also needs both data entry messages. If the 14-bit value of the data entry messages is 0x2000, then tuning is central with A = 440 Hz. The full range (0x0000 to 0x3FFF of the 14-bit value) means two semitones. Thus, the tuning can move down one semitone or up one semitone and since one semitone is equal to 100 cents, since the distance between the center 0x2000 and each of the limits (up and down) is 8192 decimal, one single step increment is 100 / 8192 = 0.0122 (approximately) cents. The value 0x2001 for example would mean that A is 440 Hz plus 0.0122 cents, which is A = 440.0031 Hz.

Coarse tuning: The coarse tuning RPNs use only the coarse data entry message to tune, with 0x20 representing central tuning of A = 440 Hz and with increments of whole semitones (e.g., 0x21 would be a whole semitone displacement up).

Tuning program and tuning bank: The tuning program change and tuning bank change are not widely used. It is likely that these messages select tunings different than the equal tempered tuning.

Modulation depth range: The modulation depth range is designed to affect the depth of a vibrato, but neither the maximum and minimum depth nor the default depth is set for General MIDI. Those are left up to the manufacturer. According to the MIDI Manufacturer Association, the message may even affect something else than a vibrato.

The first three registered parameter numbers above (pitch bend range, fine tuning, and coarse tuning) are required by General MIDI 1. The modulation depth range was added in General MIDI 2. The remaining two parameter numbers were presumably defined later.

Example

To tune channel 0 with coarse tuning to the A = 440 Hz, the MIDI device should first receive the following two messages

0xB0 0x65 0x00
0xB0 0x64 0x02

With status byte 0xB0 these are two controller messages for channel 0. The controller numbers are 0x65 and 0x64, which would be interpreted as RPN coarse and fine. The values 0x00 and 0x02 have binary representation 0x00000000 and 0x00000010 and will form the 14-bit value 0x00000000000010, which is 0x0002 hexadecimal and will be interpreted as coarse channel tuning. This is enough to specify that the coarse tuning of channel 0 will be adjusted.

The MIDI device should then receive the following message.

0xB0 0x06 0x40

With status byte 0xB0 this is a controller messages for channel 0. The controller value is 0x06, which means that this is a coarse data entry messages. The message value is 0x40, which has binary representation of 0x01000000 and forms the upper seven bits of the 14-bit value 0x10000000000000, which is 0x2000. This value would be interpreted as central tuning, or tuning to A = 440 Hz. Note that the fine data entry message for coarse channel tuning is unnecessary.

The MIDI device should then receive the following two messages to mark the end of the RPN sequence.

0xB0 0x64 0x7F
0xB0 0x65 0x7F

Example

To adjust the fine tuning of channel 0 the MIDI device should first receive the following two messages.

0xB0 0x65 0x00
0xB0 0x64 0x01

The values 0x00 and 0x01 have the 14-bit hexadecimal value of 0x0001, which means that this is the beginning of a fine channel tuning message.

The MIDI device should then receive the following two messages.

0xB0 0x06 0x40
0xB0 0x26 0x01

These messages have values of 0x40 and 0x01, which form the 14-bit hexadecimal value of 0x2001. This would be interpreted as the tuning A = 440.0031 Hz approximately.

The MIDI RPN controller sequence should then be closed with the regular two closing sequence messages 0xB0 0x64 0x7F and 0xB0 0x65 0x7F.

Example

Suppose that the MIDI tuning is already set the tuning to 0x2001 (A = 440.0031 Hz) and we would like to change it to 0x2002. Instead of sending a full sequence of RPN controllers, one could use the Data Increment controller (even before closing the RPN sequence).

The data increment message would be as follows.

0xB0 0x60 0x00

0xB0 is a controller message for channel 0. 0x60 specifies that this is a data button increment message. Since we are working with a fine channel tuning sequence, the tuning will be increased by one cent from 0x2001 to 0x2002. The last byte (0x00) in the message above is unused and could be anything.

Non-registered parameter numbers (NRPN)

Non-registered parameter numbers work similarly, except that they use controller numbers 0x62 and 0x63 and do not have to be registered with the IMA. Thus, it is up to the manufacturers to use them as they please and there are no pre-defined standards.

See also:
Musical Instrument Digital Interface (MIDI)

Comments

Hey,

thanks for the great info.

I think you've got an error in the line:

"with the data entry messages is 0x2003 then the pitch bend will vary +/- two semitones and three cents"

That should probably be 0x0203.

Cheers!

Thanks for making me take a look at this. Actually, the two values are 0x02 and 0x03, translated to binary 00000010 and 00000011. When they are combined into a 14-bit value and the top most bits of both are removed, we get 0000010 0000011. This translates to 0x0103 hexadecimal.

This looks strange, but it is all because of that removal of the topmost bit. I never understood the necessity of forming 14-bit values in MIDI. It is possible, because only status bytes carry a topmost bit of 1. This by itself is a good thing for devices recognizing running status. The 14-bit values still seem overly complex though. It may have been done to save the amount of data passed back and forth.

Thanks for the correction! Yeah, when I deal with 14-bit values in MIDI and I want to represent them as 4 hex digits, I actually pad each 7-bit half with an eigth zero bit at the top to make it easier to deal with. So, 0x0203 would be correct in that case (I think), but you're right that technically, 0x0103 is correct without the "padding" (but makes it even harder to read).

I may be dense though and need some sleep! :)

Some time ago I played with the MIDI pitch wheel message, cause of this post. That message is another place where 14-bit values occur. The only way that message worked out was when I used the same treatment as with the 0x0103. I am assuming that these RPN messages here work the same way, but, to be honest, I haven't tested them. If, at some point, you play with any other 14-bit values and you get something different, let me know. I'll also test some of these again, but probably not very soon. (For the pitch, I was bit shifting by one bit left or right as needed).

Hey in your examples you sometimes send signals in this order:
0xB0 0x64 0x00
0xB0 0x65 0x00

and on another occation in this:
0xB0 0x65 0x00
0xB0 0x64 0x02

does it make a difference?

Yes. One is the beginning of the RPN sequence of messages. The other one is the end.

Add new comment

Filtered HTML

  • Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.