Subsections

- Voice
- Patch
  - Patch Set
  - Patch Rename
  - Patch List
  - Ensuring It All Works

#
Patch Management

Modern music keyboards and synthesizers are capable of producing a bewildering variety of sounds. Many consumer units priced well under $1000.00 contain several hundred or more unique voices. But, “out of the box” MMA supports only 128 “General MIDI”22.1 preset voices. These voices are assigned the values 0 to 127. We refer to the various voices as “tones”, “instruments”, or “patches”.22.2

#
Voice

The MIDI instrument or voice used for a track is set with:

Chord-2 Voice Piano1

Voices apply only to the specified track. The actual instrument can be specified via the MIDI instrument number, an “extended” value, or with the symbolic name. See the tables in the MIDI voicing section for lists of the standard, recognized names.

You can create interesting effects by varying the voice used with drum tracks. By default “Voice 0” is used. However, you can change the drum voices. The supplied library files do not change the voices since this is highly dependent on the MIDI synth you are using.

You can specify a different VOICE for each bar in a sequence. Repeated values can be represented with a “/”:

Chord Voice Piano1 / / Piano2

It is possible to set up translations for the selected voice: see VOICETR.

# Patch

In addition to the 128 standard voices mandated by the MIDI standards (referred to as the GM voices) MMA also supports extended voice banks.

The rest of this chapter presents features which are highly dependent your hardware. It is quite possible to create midi files which sound very different (or even awful, or perhaps not at all) on other hardware. We recommend that you do not use these features to create files you want to share!

A typical keyboard will assign instruments to different voice banks. The first, default, bank will contain the standard set of 128 GM instruments. However, you can select different banks, each with a variety of voices, by changing the current voice bank. This switching is done by changing the value of MIDI Controller 0, 32 or both. You'll need to read the manual for your hardware to figure this out.

In order to use voices outside of the normal GM range MMA uses an extended addressing mode which includes values for the patch and controllers 0 and 32. Each value is separated from the others with a single “.”. Two examples would include 22.33.44 and 22.33. The first value is the Patch Number, the second is a value for Controller 0. The third value, if present, is the setting for Controller 32.

My Casio Wk-3000 lists Bank-53, Program-27 as "Rotary Guitar". It's easy to use this voice directly in a VOICE command:

Chord Voice 27.53

Yes, but who wants all those “funny” numbers in their MMA files? Well, no one that I know. For this reason the PATCH command has been developed. This command lets you modify existing patch names, list names and create new ones.

PATCH takes a variety of options. We suggest you read this section and examine some of the included example files before venturing out on your own. But, really, it's not that complicated.

Unless otherwise noted, you can stack a number of different options onto the same PATCH line.

## Patch Set

The SET option is used to assign one or more patch values to symbolic names. Going back to my Casio example, above, I could use the following line to register the voice with MMA

Patch Set 27.53=RotaryGuitar

The assignment consists of two parts or keys joined by a “=” sign. No spaces are permitted. The left part of the assignment is a value. It can be a single number in the range 0 to 127; or 2 or 3 numbers joined by “.”s. The right right part is a symbolic name. Any characters are permitted (but no spaces!).

After the assignment you can use “RotaryGuitar” just like any other instrument name:

Chord Voice rotaryguitar

Note that once the voice has been registered you don't need to worry about the case of individual letters.

It's even possible to register a number of voices in this manner:

Patch set 27.53=RotaryGuitar 61.65=BASS+TROMBONE

Just make sure that the SET assignments are the last thing on the PATCH line.

It is relatively easy to load entire sets of extended patch names by creating special MMA include files. For example, for a Casio WK-3000 keyboard you might have the file `includes/casio-wk3.mma` with a large number of settings. Here's a snippet:

Begin Patch Set 0.48=GrandPiano 1.48=BrightPiano 2.48=ElecGrandPiano 3.48=Honky-Tonk1 ... End

Now, at the top of your song file or in a MMARC file insert the command:

include casio-wk30022.3

A file like this can be created by hand or you can convert existing an existing file to a format understands. A number of “patch” files exist for the popular “Band in a Box” program from PGMusic. There files may be subject to copyright, so use them with respect. No patch files are included in this distribution, but many are freely available on the internet. For a start you might want to look at `http://www.pgmusic.com/support_miscellaneous.htm`. These files cannot be read my MMA , so we have included a little conversion utility `util/pg2mma.py`. There is a short file with instructions `util/README.pg2mma`.

The SET option will issue warning messages if you redefine existing instrument names or addresses. We suggest that you edit any configuration files so that they have unique names and that you do not rename any of the standard GM names.

## Patch Rename

The naming of patches is actually quite arbitrary. You'll find that different manufacturers use different names to refer to the same voices. Most of the time this isn't a major concern, but you have the freedom in MMA to change any patch name you want. For example, MMA calls the first voice in the GM set “Piano1”. Maybe you want to use the name “AcousticGrand”. Easy:

Patch Rename Piano1=AcousticGrand

Each RENAME option has a left and right part joined by an “=” sign. The left part is the current name; the right is the new name. Please note that after this command the name “Piano1” will not be available.

You can have any number of items in a list; however, they must be the last items on the PATCH line.

## Patch List

After making changes to MMA 's internal tables you might want to check to make sure that what you meant is what you got. For this reason there are three different versions of the LIST command.

List=GM
  Lists the current values of the GM voices,
List=EXT
  Lists the extended voices,
List=All
  Lists both the GM and extended voices.

For example, the command:

Patch List=EXT

will produce a listing something like:

0.48=GrandPiano 1.48=BrightPiano 2.48=ELEC.GrandPiano ...

## Ensuring It All Works

If you are going to use any of the extended patches in your MIDI files you may need to do some additional work.

Your hardware may need to be in a “special” mode for any of the extended patches to take effect. What we suggest is that you use the MIDI command (details here) to do some initialization. For an example please look at the file `includes/init.mma` which we include in our personal files. This file sets the volume, pan and controller values to known settings. It's easy to modify this file to match your hardware setup.

To use a file like `includes/init.mma` just include a line like:

include init

in your mmarc file. See the Path section of this manual for details (here).

To help keep things sane, MMA checks each track as it is closed. If an extended voice has been used in that track it resets the effected controllers to a zero state. In most cases this means that if you finish playing the file your keyboard will be returned to a “default” state.

However, you might wish to generate some explicit MIDI sequences at the end of a generated file. Just write another file like the `init.mma` file we discussed above. You can insert this file by placing a line like:

include endinit

at the end of your song file. Or, use the MMAEND command detailed here.

You can get about as complicated as you want with all this. One scheme you might consider is to use macros to wrap your extended patch code. For example:

if def Casio include casio-wk3000 include init.file.for.casio.mma endif Groove somegroove if def Casio Chord Voice ROtaryGuitar Endif 1 Cm 2 Dm ...more chords if def Casio include restore-file-for-casio.mma endif

Now, when you compile the file define the macro on the command line:

$ mma -SCASIO filename

This defines the macro so that your wrappers work. To compile for the GM voicing, just skip the “-SCASIO”.

An alternate method is to use the VOICETR command (details here). Using a similar example we'd create a song file like:

if def Casio include casio-wk3000 include init.file.for.casio.mma VoiceTR Piano1=RotaryGuitar ChoralAhhs=VoxHumana endif Groove somegroove 1 Cm 2 Dm ...more chords if def Casio include restore-file-for-casio.mma endif

Notice how, in this example, we don't need to wrap each and every VOICE line. We just create a translation table with the alternate voices we want to use. Now, when the GROOVE is loaded the various voices will be changed.

#### Footnotes

... MIDI”22.1
  The General MIDI or GM standard was developed by the MIDI Manufactures Association.
... “patches”.22.2
  “Patch” a bit of a historical term dating back to the times when synthesizers cost a lot of money and used bits of wire and cable to “patch” different oscillators, filters, etc. together.
... casio-wk300 22.3
  Refer to INCLUDE (here) for details on file placement.