<-- previous page     Table of Contents    Index    next page -->

MIDI OUTPUT

Basic information

Mup will optionally produce MIDI output (using the -m or -M command line argument). Mup is first and foremost a music publication program, so its MIDI capabilities have a few limitations. However, the MIDI output is quite useful for "proofreading" (or perhaps we should say "proof-listening"). It is often easier to spot a typo in Mup input by listening to it than to look at the output. Mup provides enough MIDI control to do virtually all of what MIDI supports, and will be adequate for many people. Others, however, may find they want a separate MIDI editor for really serious MIDI work.

The following section assumes a general knowledge of MIDI. If you are not familiar with MIDI, there are many books available on the subject at most music stores or computer book stores. There are also many online resources and tutorials. You could start at http://www.midi.org or use your favorite search engine.

Each voice is put on a separate MIDI track. The first track contains general information such as key and time signature. The next track will be for staff 1, voice 1. If staff 1 has a second voice, that will be the next track, otherwise it will be voice 1 of staff 2, if any, and so forth, one track for each voice, top to bottom.

Output is in MIDI file format 1, with a default of 120 quarter notes per minute, 192 ticks per quarter note. MIDI channel 1 is used by default for all voices. If you want to use different instrument sounds for different voices, you will need to specify a different channel for each voice, then specify the MIDI "program" for that voice. This is demonstrated in some of the examples later in this section.

Mup MIDI output will handle repeats and first and second endings, but it does not know anything about "D.S. al coda" or anything of that sort. It is possible to work around this limitation to some extent using macros. For example, a section between a "sign" and a "jump to coda" symbol could be put inside a macro definition; then the macro can be called. Then later in the piece, where the "D. S." occurs, the macro can be called again if MIDI is defined. For example:

// an introductory section, ends with a sign
1: c;d;e;f;
mussym above all: 5 "sign";
bar

// define macro for section between sign and
// symbol to "jump to coda"
define SECTION
1: g;a;g;;
mussym above all: 5 "coda";
bar
@

// print/play the section just defined by
// the macro
SECTION

// now do the music up to the D.S.
1: e;f;2g;
ital above 1: 1 "D. S. al Coda";
dblbar

// human player would now flip back to
// the sign, so do the MIDI equivalent:
// play that section again.
ifdef MIDI
	SECTION
endif

// now do the coda
1: e;d;2c;
rom above 1: 0 "Coda";
endbar

Mup mainly just outputs the note information. Mup will recognize octave marks, and move notes up or down appropriately. It recognizes piano pedal marks. It does not attempt to interpret tempo or dynamics marks specified by "rom," "boldital," etc. or ornaments in "mussym" statement. It does not handle ties to a different voice. It does interpret rehearsal marks as cue points. It handles grace notes, rolls, slashes, and alternation groups. You can control how legato the music is by using the Mup "release" parameter.

Some styles of music are often written in "swing time," meaning the players are expected to play pairs of notes with the first twice as long as the second, even though they are written as if they were the same duration, or as if the first were three times as long as the second. The most common example would be where the written notation shows two eighth notes like 8;; or a dotted rhythm like 8.;16; but the musician "knows" that the composer really intended it to be played as if it were a triplet {4;8;}3; The swingunit parameter can be used to get Mup MIDI output to automatically follow that performance convention.

A separate MIDI editing program may be useful for adding really complicated effects, but it is possible to specify MIDI directives to do almost anything you want. They are of the form:

midi S V: begintime "keyword=value";

The S and V specify the staff and voice for which the directive is to apply. As elsewhere in Mup, an omitted voice will default to voice 1, and both staff and voice can be given as a list. Certain keywords apply to the entire score. In that case the form
midi all: begintime "keyword=value";

is used instead. The items specified using "all" are placed on the first track, the track containing score-wide information. They are not applied to the voices on the other tracks.

The begintime, as elsewhere in Mup, gives the beat into the measure where the MIDI output is to be placed. If notes are to be turned on or off at the same instant in time as the begintime, first all "note off" commands are generated, then the "midi" command events, then "note on" commands.

The keyword=value gives specific information of what MIDI output to generate. The following keywords are currently supported:
keyword values meaning midi S V midi all
program 0-127 program change (new instrument) yes no
parameter 0-127,0-127 parameter yes yes
channel 1-16 channel yes no
chanpressure 0-127 channel pressure (after touch) yes yes
tempo 10-1000 tempo, quarter notes per minute no yes
seqnum 0-65535 sequence number yes yes
text text text meta event yes yes
copyright text copyright notice yes yes
name text sequence/track name yes yes
instrument text instrument name yes yes
marker text marker meta event yes yes
cue text cue point yes yes
port 0-127 MIDI port yes yes
onvelocity 1-127 note on velocity yes no
offvelocity 0-127 note off velocity yes no
hex hex data arbitrary MIDI data yes yes

The keywords can be abbreviated to their first three or more letters, except "chanpressure" which requires at least five letters to differentiate it from "channel" ("cha" or "chan" will be interpreted as channel). In most cases, the "=" is followed by either a number or some text. Exceptions to this are discussed in the next few paragraphs.

The "parameter" keyword is followed by two numbers, separated by a comma. The first is the parameter number, the second is the parameter value. Thus to set parameter 7 (which is the volume parameter) to 90 for voice 2 of staff 3, starting at the beginning of the measure, you can use:

midi 3 2: 0 "parameter=7,90";

The "onvelocity" and "offvelocity" keywords can have one or more values, separated by commas. If there is only one value, it applies to all notes in each chord. If there is more than one value, the first value applies to the top note of the chord, the second value to the second-from-the-top note, and so forth. If there are more notes in a chord than there are values specified, the last value specified applies to all of the remaining notes. So, for example, if you want to emphasize the top note of each chord because it is the melody, you can specify two values, as in

midi 1: 1 "onvelocity=76, 60";

which would cause the top note to have a velocity of 76 and all other notes to have a velocity of 60.

The "hex" form can be used to insert any arbitrary MIDI data into the MIDI file. The value consists of any even number of hexadecimal digits. Spaces and tabs can be included in the value field for readability.

Note that Mup uses the MIDI standard, which numbers instruments from 0 through 127, but some MIDI playback programs follow a convention of numbering them from 1 through 128.

Here are some examples:

midi all: 0 "tempo=72";
midi 1-2 1-2: 0 "channel=2"; 0 "program=14"; 3.5 "program=76";
midi all: 3 "hex= ff 00 02 00 01";   // sequence number 1
midi 3,6: 0 "channel=5"; 0 "prog=15"; 0 "instr=dulcimer";
// set parameter 7 (usually volume) to 100
midi 2: "par = 7, 100";

Here is a more extensive example of how midi commands might be used in a song:

score
	staffs=2
	vscheme=2o

staff 2
	clef=bass

voice 2 2
	// Make the bottom voice more staccato
	release=50

music

// Set the tempo.
// Start out at 108 quarter notes per minute,
// but on count 4, slow down to 96 per minute.
midi all: 0 "tempo=108"; 4 "tempo=96";

// Put each voice on a different channel
// using a different instrument sound.
// The program numbers correspond to the
// General MIDI sounds as noted.
midi 1 1: 0 "channel=1"; 0 "program=68";  //oboe
midi 1 2: 0 "channel=2"; 0 "program=11";  //vibraphone
midi 2 1: 0 "channel=6"; 0 "program=60";  //french horn
midi 2 2: 0 "channel=4"; 0 "program=35";  //fretless bass

// Make the top voice louder, and put an
// accent on the third beat
midi 1 1: 0 "onvelocity=86"; 3 "onvelocity=100"; 4 "onvel=86";

// Set maximum reverb on french horn part,
// starting at the second beat.
// (Reverb is parameter 91)
midi 2 1: 2 "parameter=91, 127";

// Set chorus on oboe to 75, from the beginning.
// (Chorus is parameter 93)
midi 1 1: 0 "param=93, 75";

// Pan the bass part to middle of left side.
// (Pan is parameter 10, with a value of 0 being hard left,
// 64 in the center, and 127 being hard right, so 32 is
// half way to the left.)
midi 2 2: 0 "parameter=10, 32";

// Now the music to be played...
1 1: e;d;2c;
1 2: c;b-;2g-;
2 1: g;f;2e;
2 2: c;g-;2c;
bar


   <-- previous page    Table of Contents    Index    next page -->