30
Useful Information
•Decimal and Hexadecimal
It is common to use 7-bit Hexadecimal numbers in MIDI communication.
The following is a conversion table between decimal numbers and 7-bit
Hexadecimal numbers.
* To indicate a decimal number for the MIDI channel, Bank number, and
Program number, add one to the values in the table.
* The resolution of 7-bit Hexadecimal numbers is 128. Use several bytes for
values which require higher resolution.
i.e. The number “aa bbH” in 7-bit Hexadecimal is “aa x 128 + bb” in
Decimal form.
* A signed number (with a sign +/-) is indicated as 00H = -64, 40H = 0,
7FH=+63.
So the signed number “aaH” in 7-bit Hexadecimal is “aa - 64” in Decimal
form.
In the case of two bytes, it is regarded as 00 00H = 8192,
40 00H = 0, 7F 7FH=+8191.
So the signed number “aa bbH” in 7-bit Hexadecimal is “aa bbH - 40 00H =
(aa x 128 + bb) - (64 x 128)” in Decimal form.
* The data indicated as “nibbled” is a 4-bit Hexadecimal number.
i.e. “0a 0bH” is “a x 16 + b.”
<Example 1> Convert “5AH” in Hexadecimal to a Decimal number.
(By using the table) 5AH = 90
<Example 2> Convert “12 34H” in 7-bit Hexadecimal to a Decimal number.
(By using the table) 12H = 18, 34H = 52
So,
18 x 128 + 52 = 2356
<Example 3> Convert “0A 03 09 0D” in nibblized form to a Decimal number.
(By using the table) 0AH = 10, 03H = 3, 09H = 9, 0DH = 13
So,
((10 x 16 + 3) x 16 + 9) x 16 + 13 = 41885
•Example of actual MIDI messages
<Example 1> 92 3E 5F
“9n” is a status of a Note On message, and “n” is a MIDI channel number.
The second byte is the Note number, and the third is Velocity.
2H = 2, 3EH = 62, 5FH = 95
So, this is a Note On message of MIDI channel=3, Note number=62 (D4) and
Velocity=95.
<Example 2> CE 49
“Cn” is a status of a Program change message, and “n” is a MIDI channel num-
ber.
The second byte is a Program number.
EH = 14, 49H = 73
So, this is a Program change message of MIDI channel=15,
Program number= 74 (Flute in GS).
Decimal
Hexa-
decimal Decimal
Hexa-
decimal Decimal
Hexa-
decimal Decimal
Hexa-
decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
00H
01H
02H
03H
04H
05H
06H
07H
08H
09H
0AH
0BH
0CH
0DH
0EH
0FH
10H
11H
12H
13H
14H
15H
16H
17H
18H
19H
1AH
1BH
1CH
1DH
1EH
1FH
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
20H
21H
22H
23H
24H
25H
26H
27H
28H
29H
2AH
2BH
2CH
2DH
2EH
2FH
30H
31H
32H
33H
34H
35H
36H
37H
38H
39H
3AH
3BH
3CH
3DH
3EH
3FH
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
40H
41H
42H
43H
44H
45H
46H
47H
48H
49H
4AH
4BH
4CH
4DH
4EH
4FH
50H
51H
52H
53H
54H
55H
56H
57H
58H
59H
5AH
5BH
5CH
5DH
5EH
5FH
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
60H
61H
62H
63H
64H
65H
66H
67H
68H
69H
6AH
6BH
6CH
6DH
6EH
6FH
70H
71H
72H
73H
74H
75H
76H
77H
78H
79H
7AH
7BH
7CH
7DH
7EH
7FH
<Example 3> EA 00 28
“EnH” is a status of a Pitch bend change message, and “n” is a MIDI chan-
nel number.
The second byte (00H) is an LSB and the third (28H) is an MSB of a Pitch
bend value.
The Pitch bend value is :
28 00H - 40 00H = 40 x 128 + 0 - (64 x 128 + 0) = 5120 - 8192 = -3072
So, this is a Pitch bend change message of MIDI channel=11,
Pitch bend value = -3072
If the Pitch bend sensitivity is set to 2 semitones, and the Pitch bend value -
8192 (00 00H) is defined as -200 cents,
The actual pitch bend value of this message is :
-200 x (-3072) / (-8192) = -75 cent
•Example of Roland System Exclusive messages
and Checksum
Roland System Exclusive messages (DT1) have a Checksum at the end of
the data (just before EOX) to be able to check for communication errors.
The Checksum is determined by values of address and data (or size) includ-
ed in the message.
<How to calculate Checksums>
(“H” indicates Hexadecimal.)
The error checking process employs a sum-check error detection. It pro-
vides binary bit figures whose lower 7 bits are zero when values for an
address, data (or size) and the Checksum are summed.
One practical equation to determine Checksum is;
If the address is “ad bb ccH” and the data (or the size) is “dd ee ffH”
ad + bb + cc + dd + ee + ff = sum
sum / 128 = quotient ... remainder
128 - remainder = checksum
<Example 1> Set “REVERB MACRO” to “ROOM 3”
According to the Parameter Address Map, the Address of REVERB MACRO
is 40 01 30H, and the Value corresponding to ROOM 3 is 02H.
So, the message should be :
F0 41 10 42 12 40 01 30 02
??
F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status
(4) Model ID (GS)
(2) ID (Roland)
(5) Command ID (DT1)
(3) Device ID (16)
(6) End of Exclusive
The Checksum is :
40H + 01H + 30H + 02H = 64 + 1 + 48 + 2 = 115 (sum)
115 (sum) / 128 = 0 (quotient) ... 115 (remainder)
checksum = 128 - 115 (remainder) = 13 = 0DH
Therefore, the message to send is : F0 41 10 42 12 40 01 30 02 0D F7
<Example 2> Set “MASTER TUNE” to +23.4 cents by System Exclusive
The Address of “MASTER TUNE” is 40 00 00H. The Value should be nib-
blized data whose resolution is 0.1 cents, and which is a signed value
(00 04 00 00H (= 1024) = 0 ).
+23.4[cents] = 234 + 1024 = 1258 = 04 EAH = 00 04 0E 0AH (nibblized)
So, the message should be :
F0 41 10 42 12 40 00 00 00 04 0E 0A
??
F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status
(4) Model ID (GS)
(2) ID (Roland)
(5) Command ID (DT1)
(3) Device ID (16)
(6) End of Exclusive
The Checksum is :
40H + 00H + 00H + 00H + 04H + 0EH + 0AH = 64 + 0 + 0 + 0 + 4 + 14 +
10 = 92 (sum)
92 (sum) / 128 = 0 (quotient) ... 92 (remainder)
checksum = 128 - 92 (remainder) = 36 = 24H
Therefore, the message to send is :
F0 41 10 42 12 40 00 00 00 04 0E 0A 24 F7
SCB-55.QX4 01.6.19 8:59 AM Page 30