# How to create MIDI strings to switch banks/programs

unrealBook uses HEX for the MIDI strings. You are probably familiar with decimal (0-9,10 etc). Hex is just another way to describe a number. Luckily you can easily convert to hex using google (just type in 64 as hex) or a decimal to hex converter.

Hex is just another way to describe a number. Decimal and hex cannot be mixed in unrealBook.
Decimal 127 = HEX 7F

Reference this article for how to switch banks using bank select/program change.

The basic idea is write your MIDI codes as hex.
A full MIDI Bank select looks like this in hex:
B0 00 51MSB (Coarse) Bank select
B0 20 01LSB (Fine) Bank select
C0 42

In unrealBook, you can simply type in:

B0 00 51
B0 20 01
C0 42

A note about channels. In the above B0 and C0 denote message types, but the 0 is the channel number. There are 16 channel numbers from 0-15. So a program change on channel 1 is: C0, channel 2 is C1, channel 3 is C2 etc...
So in the above example, to send on channel 2, the message would look like this:

B1 00 51
B1 20 01
C1 42

for channel 3:

B2 00 51
B2 20 01
C2 42

Channels 1-16 look like this in HEX
0 1 2 3 4 5 6 7 8 9 A B C D E F

Besides, the channel in the messages, what parts matter?
Take a look at this:

B0 00 xx
B0 20 yy
C0 zz

In this case xx is the "coarse" bank select number (MSB)
yy is the "fine" bank select number (LSB)
zz is the program change number.

These are the only numbers you need to be concerned with.
So let's say in HEX xx should 65, yy should be 51 and zz should be 5

B0 00 65
B0 20 51
C0 5

What if xx is 77 decimal, yy is 34 decimal and zz is 127 decimal????
Use a decimal to hex converter to get the 3 values.

77 decimal is 4D hex
34 decimal is 22 hex
127 decimal is 7F hex

So the string now looks like:

B0 00 4D
B0 20 22
C0 7F

The Motif ES uses either 0, 127 or 63 for the MSB (first string).
decimal 0 is hex 0
decimal 127 is hex 7F
decimal 63 is hex 3F

According to the Motif ES MIDI chart, a GM voice is MSB 0, LSB 0 and and program change (0..127)

B0 00 00
B0 20 00
C0 01 <- would dial up the 2nd program since it is zero based (0 is the first program)

GM drums are MSB 127, LSB 0

B0 00 00
B0 20 7F
C0 00 <- would dial up the 1st drum since it is zero based (0 is the first program)

Preset bank 6 is MSB 63 and LSB 5

B0 00 3F <- 3F hex is decimal 63
B0 20 5 <- 5 hex is decimal 5
C0 00 <- would dial up the 1st drum since it is zero based (0 is the first program)

What if you just needed to send a program change?

C0 zz

where zz is the program change number.

To recap, if your values are already in hex, just use the hex number. If they are in decimal, then just use a decimal to hex converter and then use that hex value for your MIDI strings.

---- FA06

Here is a generic sample bank select MSB, LSB and program change:
B0 00 00 <- BANK MSB
B0 20 00 < BANK LSB
C0 00 <- PROGRAM

The FA06 chart is as follow:

BANKMSB - 085
BANKLSB 000-003
PROGRAM NUMBER 01-128

So the FA06 chart says BANK MSB is decimal 85 and BANK LSB is 0-3.
So in unrealBook type in:

85 in the dec <->Hex converter and you will see 85 is decimal 55.
So the first string is:

B0 00 55 <--- the last number is changed for BANK MSB

For BANK LSB, the last number is changes from 0-3 so:

B0 20 00 to B0 20 03

and for the PROGRAM NUMBER: (it's really zero based) 0-127.

So for the final message;

C0 00 selects the first program, C0 01 selects the second and so on.

The full message to send to the FA06:

B0 00 55
B0 20 00 or B0 20 01 or B0 20 02 or B0 20 03 (zero to 3 on the chart)
C0 00  first program, C0 01 second program - al the way to C0 7F