next up previous
Next: Other Commands and Directives Up: Reference Manaul Previous: Variables, Conditionals and Jumps

Subsections


Low Level MIDI Commands

The commands discussed in this chapter directly effect your MIDI output devices.

Not all MIDI devices are equal. Many of the effects in this chapter may be ignored by your devices. Sorry, but that's just the way MIDI is.


Channel

As noted in the Tracks and Channels chapter ([*]), MMA assigns MIDI channels dynamically as it creates tracks. In most cases this works fine; however, you can if you wish force the assignment of a specific MIDI channel to a track with the Channel command.

You cannot assign a channel number to a track if it already defined (well, see the section ChShare, below, for the inevitable exception), nor can you change the channel assignments for any of the Drum tracks.

Let us assume that you want the Bass track assigned to MIDI channel 8. Simply use:

Bass Channel 8

Caution: If the selected channel is already in use an error will be generated. Due to the way MMA allocates tracks, if you really need to manually assign track we recommend that you do this in a MMArc file.

You can disable a channel at any time by using a channel number of 0:

Arpeggio1 Channel 0

will disable the Arpeggio1 channel, freeing it for use by other tracks. A warning message is generated. Disabling a track without a valid channel is fine.

You don't need to have a valid MIDI channel assigned to a track to do things like: Pan, Portamento, ChannelVolume or even the assignment of any music to a track. MIDI data is created in tracks and then sent out to the MIDI buffers. Channel assignment is checked and allocated at this point, and an error will be generated if no channels are available.

It's quite acceptable to do channel reassignments in the middle of a song. Just assign channel 0 to the unneeded track first.

MIDI channel settings are emphnot saved in Grooves.

MMA inserts a MIDI ``track name'' meta event when the channel buffers are first assigned at a MIDI offset of 0. If the MIDI channel is reassigned, no new ``track name'' is inserted.


ChShare

MMA is fairly conservative in its use of MIDI tracks. ``Out of the box'' it demands a separate MIDI channel for each of its tracks, but only as they are actually used. In most cases, this works just fine.

However, there are times when you might need more tracks than the available MIDI channels or you may want to free up some channels for other programs.

If you have different tracks with the same voicing, it's quite simple. For example, you might have an arpeggio and scale track:

Arpeggio Sequence A16 z
Arpeggio Voice Piano1
Scale Sequence z S8
Scale Voice Piano1

In this example, MMA will use different MIDI channels for the Arpeggio and the Scale. Now, if you force channel sharing:

Scale ChShare Arpeggio

both tracks will use the same MIDI channel.

This is really foolproof in the above example, especially since the same voice is being used for both. Now, what if we wanted to use a different voice for the tracks?

Arpeggio Sequence A16 z
Arpeggio Voice Piano1 Strings
Scale Sequence z S8
Scale ChShare Arpeggio

You might think that this would work, but it doesn't. MMA ignores voice changes for bars which don't have a sequence, so it will set ``Piano1'' for the first bar, then ``Strings'' for the second (so far, so good). But, when it does the third bar (an Arpeggio) it will not know that the voice has been changed to ``Strings'' by the Scale track.

So, the general rule for track channel sharing is to use only one voice.

One more example which doesn't work:

Arpeggio Sequence A8
Scale Sequence S4
Arpeggio Voice Piano1
Scale Voice Piano1
Scale ChShare Arpeggio

In this example we have an active scale and arpeggio sequence in each bar. Since both use the same voice, you may think that it will work just fine ...but it may not. The problem here is that MMA will generate MIDI on and off events which may overlap each other. One or the other will be truncated. If you are using a different octave, it will work much better. It may sound okay, but you should probably find a better way to do this.

When a ChShare directive is parsed the ``shared'' channel is first checked to ensure that it has been assigned. If not currently assigned, the assignment is first done. What this means is that you are subverting MMA's normal dynamic channel allocation scheme. This may cause is a depletion of avaiable channels.

Please note that we've never found it necessary to use the the ChShare command, so it might have more problems than outlined here.

This command will always display a warning message.

MIDI

The complete set of MIDI commands is not limitless--but from this end it seems that adding commands to suit every possible configuration is neverending. So, in an attempt to satisfy everyone, we've added a command which will place any arbitray MIDI stream in your tracks. In most cases this will be a MIDI ``Sysex'' or ``Meta'' event.

The data can be placed in the meta track or a specific voicing track.

For example, you might want to start a track off with a MIDI reset:

MIDI F0 05 7e 7f 09 01 f7

This is a series of hexadecimal values. Each value must be a valid hex number in the range 0 to 0xff. The leading ``0''s in the values 0x00 to 0x0f are optional, but recommended.

In the above example:

  F0
Designates a SYSEX message

  05
The length of the message

  7e
...The actual message

Another example places the key signature of F major (1 flat) in the meta track:

MIDI ff 59 02 ff 0

Some cautions:

Cautions aside, I have created an include file which I insert into all my midi files. The file is in the main distribution as includes/init.mma. In my mmarc file I have the command:

MMAstart init

The file is pretty well commented and it sets my synth up to something reasonably sane.

If you need a brief delay after a raw MIDI command, it is possible to insert a silent beat with the BeatAdjust command ([*]). See the file includes/reset.mma for an example.

Pan

In MIDI-speak ``pan'' is the same as ``balance'' on a stereo. By adjusting the Pan for a track you can direct the output to the left, right or both speakers. Example:

Bass Pan 4

This command is only available in track mode. The data generated is not sent into the MIDI stream until musical data is created for the relevant MIDI channel.

The value specified must be in the range 0 to 127, and must be an integer.

Pan is not saved or restored by Groove commands, nor is it effected by SeqClear. A Pan is inserted directly into the MIDI track at the point at which it is encountered in the music file. This means that the effect of Pan will be in use until another Pan is encountered.

Pan can be used in MIDI compositions to emulate the sound of an orchestra. By assigning different values to different groups of instruments, you can get the feeling of strings, horns, etc. all placed in the ``correct'' position on the stage.

We use Pan for much cruder purposes. When creating accompaniment tracks for our jazz group. We set all the bass tracks (Bass, Walk, Bass1, etc) to a Pan 0. Now, when practicing at home we can have a ``full band''; and the bass player can practice without the generated bass lines simply by turning off the left speaker.

Because your MIDI keyboard most likely does not do a reset between tunes, you should probably undo any Pan effects at the end of your file. Example:

Include swing
Groove Swing
Bass Pan 0
Walk Pan 0
1 C
2 C
...
123 C
Bass Pan 64
Walk Pan 64

Portamento

This sets the MIDI portamento (in case you're new to all this, portamento is like glissando between notes--wonderful, if you like trombones! To enable portamento:

Arpeggio Portamento 30

The parameter can be any value between 1 and 127. To turn the sliding off:

Arpeggio Portamento 0

This command will work with any track (including drum tracks). However, the results may be somewhat ``interesting'' or ``disappointing'', and many MIDI devices don't support portamento at all. So, be cautious. The data generated is not sent into the MIDI stream until musical data is created for the relevant MIDI channel.


ChannelVolume

MIDI devices equipped with mixer settings can make use of the ``Channel'' or ``Master'' volume settings.15.1

By default, MMA sets all the tracks it uses to 100. This should permit the playing of unused channels for a melody by the performer.

You can set all or selected ChannelVolumes:

ChannelVolume 99

will set all channels to ``99''. And:

Chord ChannelVolume 55

will set only the Chord track channel. For most users, the use of this command is not recommended since it will upset the balance of the library grooves. If you need a track softer or louder you should use the volume setting for the track.

The data generated is not sent into the MIDI stream until musical data is created for the relevant MIDI channel.



Footnotes

...15.1
We discovered this on our keyboard after many frustrating hours attempting to balance the volumes in the library. Other programs would change the keyboard settings, and not being aware of the changes, we'd end up scratching our heads.

next up previous
Next: Other Commands and Directives Up: Reference Manaul Previous: Variables, Conditionals and Jumps
2004-04-19