20
MIDI Implementation
■ Example of an Exclusive Message and Calculating a
Checksum
Roland Exclusive messages (RQ1, DT1) are transmitted with a checksum at the end (before F7)
to make sure that the message was correctly received. The value of the checksum is
determined by the address and data (or size) of the transmitted Exclusive message.
● How to calculate the checksum
(hexadecimal numbers are indicated by “H”)
The checksum is a value derived by adding the address, size, and checksum itself and
inverting the lower 7 bits.
Here’s an example of how the checksum is calculated. We will assume that in the Exclusive
message we are transmitting, the address is aa bb cc ddH and the data or size is ee ffH.
aa + bb + cc + dd + ee + ff = sum
sum ÷ 128 = quotient ... remainder
128 - remainder = checksum
<Example1> Setting CHORUS TYPE of PATCH to CHORUS 1 (DT1)
According to the “Parameter Address Map” (p. 7), the start address of Temporary Patch is 30
00 00 00H, the offset address of PATCH CHORUS at PATCH is 02 00H, and the address of
CHORUS TYPE is 00 00H. Therefore the address of CHORUS TYPE of PATCH CHORUS is;
30 00 00 00H
02 00H
+) 00 00H
30 00 02 00H
CHORUS 1 has the value of 01H.
So the system exclusive message should be sent is;
F0 41 10 00 00 21 12 30 00 02 00 01 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status
(2) ID (Roland)
(3) Device ID (17)
(4) Model ID (V-Synth GT)
(5) Command ID (DT1)
(6) End of Exclusive
Then calculate the checksum.
30H + 00H + 02H + 00H + 01H = 48 + 0 + 2 + 0 + 1 = 51 (sum)
51 (sum) ÷ 128 = 0 (quotient) ... 51 (remainder)
checksum = 128 - 51 (remainder) = 77 = 4DH
This means that F0 41 10 00 00 21 12 30 00 02 00 01 4D F7 is the message should be sent.
<Example2> Getting the data (RQ1) of TONE T-FX in TONE:003
According to the “Parameter Address Map” (p. 7), the start address of TONE:003 is 20 02
00 00H, and the offset address of PATCH MFX is 00 02 00H.
Therefore the start address of PATCH MFX in PATCH:003 is;
20 02 00 00H
+) 00 02 00H
20 02 02 00H
As the size of TONE T-FX is 00 00 01 04H, the system exclusive message should be sent is;
F0 41 10 00 00 21 11 20 02 02 00 00 00 01 04 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status
(2) ID (Roland)
(3) Device ID (17)
(4) Model ID (V-Synth GT)
(5) Command ID (RQ1)
(6) End of Exclusive
Then calculate the checksum.
20H + 02H + 02H + 00H + 00H + 00H + 01H + 04H = 32 + 2 + 2 + 0 + 0 + 0 + 1 + 4 = 41 (sum)
117 (sum) ÷ 128 = 0 (quotient) ... 41 (remainder)
checksum = 128 - 41 (remainder) = 87 = 57H
This means that F0 41 10 00 00 21 11 20 02 02 00 00 00 01 04 57 F7 is the message
should be sent.
<Example3> Getting Temporary Patch data (RQ1)
According to the “Parameter Address Map” (p. 7), the start address of Temporary Patch is
assigned as following:
30 00 00 00 Temporary Patch
The offset address of Patch is also assigned as follows:
00 00 00 Patch Common
:
00 02 00 Patch Chorus
:
00 04 00 Patch Reverb
:
00 06 00 Patch Controller
:
00 08 00 Patch Tone (1:UPPER)
:
00 0A 00 Patch Tone (2:LOWER)
:
00 0C 00 Patch Arpeggio (Note 1)
:
00 1B 00 Patch Arpeggio (Note 16)
As the data size of Patch Arpeggio is 00 00 00 42H, summation of the size and the start
address of Temporary Patch Arpeggio (Note 16) will be;
30 00 00 00H
00 00 1B 00H
+) 00 00 00 42H
30 00 1B 42H
And the size that have to be got should be;
30 00 1B 42H
-) 30 00 00 00H
00 00 1B 42H
Therefore the system exclusive message should be sent is;
F0 41 10 00 00 21 11 30 00 00 00 00 00 1B 42 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status
(2) ID (Roland)
(3) Device ID (17)
(4) Model ID (V-Synth GT)
(5) Command ID (RQ1)
(6) End of Exclusive
Calculating the checksum as shown in <Example 2>, we get a message of F0 41 10 00 00
21 11 30 00 00 00 00 00 1B 42 73 F7 to be transmitted.