From: Subject: Changing patches over MIDI using Bank Select Controller Date: Tue, 8 Jul 2008 17:33:00 -0700 MIME-Version: 1.0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Location: http://web.archive.org/web/20070613034926/www.borg.com/~jglatt/tutr/bank.htm X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 =EF=BB=BF Changing patches over MIDI using Bank Select = Controller

When the MIDI spec was first developed, it wasn't foreseen that = anyone would=20 need more than 128 patches on a given module. (Back then, most didn't = even have=20 anywhere near that number of patches). So, the MIDI Program Change = message was=20 hardwired to have a limit of counting only from 1 to 128.

Later, modules with more than 128 patches came on the market. People = needed=20 some way of being able to switch to these extra patches, but which was = still=20 compatible with the old way of switching patches. The manufacturers = adopted a=20 scheme of arranging patches in "banks" (ie, groups of usually 128 = patches). For=20 example, the first 128 patches in a module may be "bank 1". The next 128 = patches=20 may be "bank 2". Etc. Theoretically, there can be up to 16,384 banks on = a=20 module.

The technique that the manufacturers adopted for MIDI control over = patch=20 changing is to have the musician first select the bank that contains his = desired=20 patch, and then select the patch within that bank. For example, assume = that a=20 musician wants to select the patch "Gungho" which happens to be the = third patch=20 in the second bank. First the musician would have to send one or two = (depending=20 upon how the manufacturer arranged patches into banks) MIDI messages to = select=20 the second bank (MIDI counts this as bank 1, since MIDI considers bank = number 0=20 to actually be the first bank). Then, the musician sends a MIDI message = to=20 select the third patch (again, MIDI considers patch number 0 to be the = first=20 patch in a bank, so the third patch would actually be number 2). So, = selecting a=20 patch is a two-step (ie, 2 or 3 message) process. First, you send the = Bank=20 Select message(s) to switch to the desired bank. Then you send an = ordinary=20 Program Change message to select which one of the 128 possible patches = in that=20 bank you desire.

The Bank Select messages are actually MIDI Controller messages, just = like=20 Volume, Pan, Sustain Pedal, Wind, and other controllers. Specifically, = the=20 controller number for the "Most Significant Byte" (ie, MSB) of Bank = Select is=20 controller 0. The controller number for "Least Significant Byte" (ie, = LSB) of=20 Bank Select is controller 32. The data for these messages are the bank = number=20 you want to select. (Sometimes the MSB Bank Select is referred to as the = coarse=20 adjustment for bank, and the LSB Bank Select is referred to as the fine=20 adjustment).

NOTE: We need to use 2 messages to contain the bank number = because,=20 due to MIDI's design, it's not possible to transmit a value greater than = 128 in=20 just one controller message. Remember that a bank number can go as high = as=20 16,384, and you need 2 MIDI controller messages to send such a large = value. But,=20 since most modules do not have more than 128 banks anyway, these modules = typically only use the MSB message (ie, controller number 0) to select = bank, and=20 ignore any LSB message (ie, controller number 32). So then, here are the = two=20 messages (in hexadecimal, assuming MIDI channel 1, and assuming that the = module=20 only uses the MSB Bank Select controller) to select that "Gungho" = patch:

B0 00 01 Switch to bank 2 (NOTE: only the = MSB=20 message needed)
C0 02 Switch to the third patch in = this=20 bank

The patch doesn't actually change until the module receives the = Program=20 Change message. The Bank Select message(s) must precede the Program = Change=20 message. Otherwise, the module would select the third patch in whatever = bank the=20 module was currently set to. (In other words, when the module receives = Bank=20 Select messages, it doesn't change any patches. Rather, it simply notes = what the=20 "current bank" is, and any subsequent Program Change messages will = switch to=20 patches within that bank. What this also means is that you don't = necessarily=20 need to send Bank Select before every individual Program Change. If = you're=20 switching to a patch in the same bank as whatever patch you've currently = selected, then you can omit the Bank Select messages since the module = will then=20 assume the same bank).

The following, real-world example concerns a Roland module. Before=20 proceeding, you should read The architecture of = Roland=20 sound modules if you're unfamiliar with the way that Roland arranges = Patches=20 into "Banks".

Let's look at the JV-90 as an example. Look under the "MIDI = Implementation"=20 chapter of the manual. Follow the "Receive Data" section until you get = to=20 "Control Change" and "Bank Select". (The article Understanding the = MIDI=20 Implementation in your Roland manual helps guide you through this = chapter of=20 the manual). As is so typical of Roland, the company uses the MIDI spec = in a=20 clever way. Rather than using the data bytes of both the MSB and LSB = messages=20 "added" together to make up a single bank number, Roland sort of uses = the MSB=20 message to select the "component" that you wish to access, and the LSB = message=20 to select the bank within that component (ie, some components contain = several=20 banks, such as the factory patches in ROM).

Look at the following list: (Note that I'm using a fixed pitch font = to line=20 up the columns)

Bank   Bank    Program     Media
MSB    LSB     Change
80      0      1 - 64      Internal (ie, User custom presets in RAM)
80      0      65 - 128    Data Card
81      0      1 - 64      JV-90 Preset A (ie, factory patches on Voice =
Expansion)
81      0      65 - 128    JV-90 Preset B (ie, factory patches on Voice =
Expansion)
81      1      1 - 64      Preset A (ie, factory patches in ROM)
81      1      65 - 128    Preset B (ie, factory patches in ROM)
81      2      1 - 64      Preset C (ie, factory patches in ROM)
81      2      65 - 128    Preset D (ie, factory patches in ROM)
82      0      1 - 64      Data Card
83      0      1 - 128     PCM Card
84      0      1 - 128     Expansion Board (ie, factory patches on Wave =
Expansion)
84      1      1 - 128     Expansion Board (129 - 256)

Let's say that you want to select the third patch on the factory = presets "B"=20 group. Look at "Preset B". In order to select from these patches, first = you must=20 send an MSB Bank Select with the decimal value 81 (ie, hexadecimal 51). = Next,=20 you must send an LSB Bank Select with the value 1. Finally, you can send = a=20 Program Change. The patches in this bank are numbered 65 to 128 (ie, the = first=20 patch in the "Preset B" is number 65 -- actually it is 64 in our Program = Change=20 message since we always subtract 1 to account for MIDI assuming 0 as the = first=20 patch in a bank). So the third patch in Preset B is #67 (really 66, or=20 hexadecimal 42). Here are the 3 messages (assuming MIDI channel 1):

B0 00 51 MSB (Coarse) Bank = select
B0 20 01 LSB (Fine) Bank select
C0 42 Program = Change

Let's select the first patch in User RAM (ie, "Internal" as Roland = calls it=20 in the above chart). We need an MSB Bank Select of 80 (hexadecimal 50), = an LSB=20 Bank Select of 0, and then a Program Change to patch 1 (actually 0) = since the=20 patches are numbered 1 to 64 here.

B0 00 50 MSB (Coarse) Bank = select
B0 20 00 LSB (Fine) Bank select
C0 00 Program = Change

Of course, if you subsequently want to select another patch in this = same=20 bank, then you can skip sending the 2 Bank Select messages. After all, = "User=20 RAM" is now the current bank.

Although most Roland sound modules use Bank Select controller in ways = similiar to the JV-90, your unit may have different components and = different=20 bank numbers used to select them. You need to look up the appropriate = chart in=20 your Roland manual. It will be found in the "MIDI Implementation" = chapter, under=20 the RECEIVE DATA main section, CONTROL CHANGE subsection, and "Bank = Select"=20 sub-subsection.


Some sequencer programs allow you to setup an "instrument definition" = wherein=20 you simply enter the above 3 messages and then specify the name of the = patch.=20 For example, maybe this patch is called "Gungho". You can tell your = sequencer=20 that whenever you select "Gungho" from a list of patch names, the = sequencer will=20 then automatically insert the above 3 messages into your track at some = specified=20 point where you want to switch to the "Gungho" patch. It's a lot easier = to setup=20 that instrument definition once, detailing the messages to insert for = each patch=20 name, and then from there, only deal with selecting patch names from = some list=20 rather than needing to remember what Bank Select and Program Change = messages=20 need to be inserted. But of course, in order to create such a = definition, you=20 need to understand the above (once anyway -- and then you can forget = about it=20 all -- after the nightmares subside).

For example, you can go into CakeWalk's Settings->Assign = Instruments menu=20 item, and click on "Define Instruments" to create a new instrument = definition=20 for your MIDI module. Unfortunately, I think that CakeWalk's instrument=20 definition is most unintuitive and convoluted because you have to first = dig your=20 way down to the "Define names" dialog box, skipping a whole dialog of = settings,=20 in order to enter all the banks of patch names prior to even defining = what sort=20 of bank select your module uses and what those banks are. This "bottom = up"=20 approach may save some time if you're dealing with a module whose banks = tend to=20 include a lot of duplicate patches, but it's really a pain for modules = whose=20 banks do not contain duplicate patches. I'd prefer to first choose the = "bank=20 select method", and then have CakeWalk guide me through the = naming/numbering of=20 a bank, immediately followed by each patch name/number in that bank, and = so on=20 for however many more banks there are. Worse, it appears that you have = to enter=20 the Banks by editing a rather freeform text file. For this reason, the = creation=20 of CakeWalk instrument definitions is a perilous and difficult = undertaking for=20 all but the most patient and experienced.

Once you have an instrument definition, you can insert a Bank Select = (MSB and=20 LSB) and Program Change in a CakeWalk track simply using the Insert = menu's=20 "Bank/Patch change".

The very first Bank Select and Program Change events, if they appear = before=20 any note events in a track, are automatically extracted by CakeWalk and = used to=20 set the "Bank" and "Patch" fields in CakeWalk's track display. So, you = use these=20 two fields to enter your values for any initial Bank and Program Change = at=20 playback start. Then, if you want to change the Bank and/or Patch = somewhere in=20 the middle of the track (ie, after notes have already been played, = you'll have=20 use CakeWalk's Insert menu to insert "Bank/Patch change". Choose a Bank = and a=20 Patch, and enter the desired time where it should be inserted, and = CakeWalk will=20 insert the Bank Select and Program Change events in the track at that = desired=20 point. You should see these shown in the Event List. If you don't have a = CakeWalk instrument definition file for your MIDI module, then you'll = need to=20 manually insert the desired Bank controller events yourself using Insert = menu's=20 "Series of Controllers". Do this once to choose "Bank Select" controller = (ie,=20 the coarse, or MSB one) and its desired Value and Time. (If your unit = also=20 requires the LSB or "fine" value for Bank Select, you'll need to repeat = this to=20 choose "Bank Select (fine)" controller and set its value/time). Then use = the=20 "Bank/Patch change" just to pick out one of the 128 patches in the = bank.