14
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 check sum 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 to DELAY (DT1)
According to the “Parameter Address Map” (p. 9), the start address of Temporary Setup is
10 00 00 00H, the offset address of CHORUS at Setup is 04 00H, and the address of
CHORUS TYPE is 00 00H. Therefore the address of CHORUS TYPE of Setup is;
10 00 00 00H
04 00H
+) 00 00H
10 00 04 00H
DELAY has the value of 02H.
So the system exclusive message should be sent is;
F0 41 10 00 00 2B 12 10 00 04 00 02 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RD-700GX) (5) Command ID (DT1) (6) End of Exclusive
Then calculate the checksum.
10H + 00H + 04H + 00H + 02H = 16 + 0 + 4 + 0 + 2 = 22 (sum)
22 (sum) ÷ 128 = 0 (quotient) ... 22 (remainder)
checksum = 128 - 22 (remainder) = 106 = 6AH
This means that F0 41 10 00 43 12 10 00 04 00 02 6A F7 is the message should be sent.
<Example2> Getting Temporary Performance data (RQ1)
cf.) This operation is the same as Bulk Dump Temporary function in Utility.
According to the “Parameter Address Map” (p. 9), the start address of Temporary Setup is
assigned as following:
10 00 00 00H Setup Common
:
10 07 0F 00H Setup Part Tone Wheel (Part: 16)
As the data size of Setup Tone Wheel Parameter is 00 00 00 0BH, summation of the size and
the start address of Setup Tone Wheel Parameter 16 at Temporary Setup will be;
10 07 0F 00H
+) 00 00 00 0BH
10 07 0F 0BH
And the size that have to be got should be;
10 07 0F 0BH
-) 10 00 00 00H
00 07 0F 0BH
Therefore the system exclusive message should be sent is;
F0 41 10 00 00 2B 11 10 00 00 00 00 07 0F 0B ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RD-700GX) (5) Command ID (RQ1) (6) End of Exclusive
Calculating the checksum as shown in <Example 1>, we get a message of F0 41 10 00 00 2B
11 10 00 00 00 00 07 0F 0B 41 F7 to be transmitted.
■ASCII Code Table
Setup Name of MIDI data are described the ASCII code in the table below.
+——————+——————+——————++——————+——————+——————++——————+——————+——————+
| D | H | Char || D | H | Char || D | H | Char |
+——————+——————+——————++——————+——————+——————++——————+——————+——————+
| 32 | 20H | SP || 64 | 40H | @ || 96 | 60H | ` |
| 33 | 21H | ! || 65 | 41H | A || 97 | 61H | a |
| 34 | 22H | " || 66 | 42H | B || 98 | 62H | b |
| 35 | 23H | # || 67 | 43H | C || 99 | 63H | c |
| 36 | 24H | $ || 68 | 44H | D || 100 | 64H | d |
| 37 | 25H | % || 69 | 45H | E || 101 | 65H | e |
| 38 | 26H | & || 70 | 46H | F || 102 | 66H | f |
| 39 | 27H | ` || 71 | 47H | G || 103 | 67H | g |
| 40 | 28H | ( || 72 | 48H | H || 104 | 68H | h |
| 41 | 29H | ) || 73 | 49H | I || 105 | 69H | i |
| 42 | 2AH | * || 74 | 4AH | J || 106 | 6AH | j |
| 43 | 2BH | + || 75 | 4BH | K || 107 | 6BH | k |
| 44 | 2CH | , || 76 | 4CH | L || 108 | 6CH | l |
| 45 | 2DH | — || 77 | 4DH | M || 109 | 6DH | m |
| 46 | 2EH | . || 78 | 4EH | N || 110 | 6EH | n |
| 47 | 2FH | / || 79 | 4FH | O || 111 | 6FH | o |
| 48 | 30H | 0 || 80 | 50H | P || 112 | 70H | p |
| 49 | 31H | 1 || 81 | 51H | Q || 113 | 71H | q |
| 50 | 32H | 2 || 82 | 52H | R || 114 | 72H | r |
| 51 | 33H | 3 || 83 | 53H | S || 115 | 73H | s |
| 52 | 34H | 4 || 84 | 54H | T || 116 | 74H | t |
| 53 | 35H | 5 || 85 | 55H | U || 117 | 75H | u |
| 54 | 36H | 6 || 86 | 56H | V || 118 | 76H | v |
| 55 | 37H | 7 || 87 | 57H | W || 119 | 77H | w |
| 56 | 38H | 8 || 88 | 58H | X || 120 | 78H | x |
| 57 | 39H | 9 || 89 | 59H | Y || 121 | 79H | y |
| 58 | 3AH | : || 90 | 5AH | Z || 122 | 7AH | z |
| 59 | 3BH | ; || 91 | 5BH | [ || 123 | 7BH | { |
| 60 | 3CH | < || 92 | 5CH | \ || 124 | 7CH | | |
| 61 | 3DH | = || 93 | 5DH | ] || 125 | 7DH | } |
| 62 | 3EH | > || 94 | 5EH | ^ || | | |
| 63 | 3FH | ? || 95 | 5FH | _ || | | |
+——————+——————+——————++——————+——————+——————++——————+——————+——————+
D: decimal
H: hexadecimal
* “SP” is space.