| 1 | <HTML> |
| 2 | <HEAD><TITLE> |
| 3 | Mup MIDI output |
| 4 | </TITLE></HEAD> |
| 5 | <BODY> |
| 6 | <P> |
| 7 | <A HREF="pstools.html"><-- previous page</A> |
| 8 | |
| 9 | <A HREF="index.html">Table of Contents</A> |
| 10 | <H1> |
| 11 | MIDI OUTPUT |
| 12 | </H1> |
| 13 | <P> |
| 14 | Mup will optionally produce MIDI output |
| 15 | <A HREF="cmdargs.html#moption">(using the -m command line argument).</A> |
| 16 | Mup is first and foremost a music publication program, |
| 17 | so its MIDI capabilities have a few limitations. |
| 18 | However, the MIDI output is quite useful for "proofreading" |
| 19 | (or perhaps we should say "proof-listening"). |
| 20 | It is often easier to spot a typo in Mup input by |
| 21 | listening to it than to look at the output. Mup provides enough MIDI |
| 22 | control to do virtually all of what MIDI supports, and will be adequate |
| 23 | for many people. Others however, may find they want a separate MIDI editor |
| 24 | for really serious MIDI work. |
| 25 | </P> |
| 26 | <P> |
| 27 | The following section assumes a general knowledge of MIDI. If you are not |
| 28 | familiar with MIDI, there are many books available on the subject |
| 29 | at most music stores or computer book stores. |
| 30 | </P> |
| 31 | <P> |
| 32 | Each |
| 33 | <A HREF="param.html#vscheme">voice</A> |
| 34 | is put on a separate MIDI track. The first track contains |
| 35 | general information such as key and time signature. The next track will be for |
| 36 | staff 1, voice 1. If staff 1 has a second voice, that will be the next |
| 37 | track, otherwise it will be voice 1 of staff 2, if any, and so forth, |
| 38 | one track for each voice, top to bottom. |
| 39 | </P> |
| 40 | <P> |
| 41 | Output is in MIDI file format 1, with a default of 120 quarter notes |
| 42 | per minute, 192 ticks per quarter note. MIDI channel 1 is used by default for |
| 43 | all voices. If you want to use different instrument sounds for different |
| 44 | voices, you will need to specify a different channel for each voice, then |
| 45 | specify the MIDI "program" for that voice. This is demonstrated in some |
| 46 | of the examples later in this section. |
| 47 | </P> |
| 48 | <P> |
| 49 | Mup MIDI output will handle |
| 50 | <A HREF="bars.html">repeats</A> |
| 51 | and |
| 52 | <A HREF="bars.html#endings">first and second endings,</A> |
| 53 | but it does not know anything about "D.S. al coda" or anything of that sort. |
| 54 | It is possible to work around this limitation to some extent using |
| 55 | <A HREF="macros.html">macros.</A> |
| 56 | For example, a section between a "sign" and a "jump to coda" symbol could |
| 57 | be put inside a macro definition, then the macro can be called. Then later |
| 58 | in the piece, where the "D. S." occurs the macro can be called again if MIDI |
| 59 | is defined. For example: |
| 60 | <BR><PRE> |
| 61 | // an introductory section, ends with a sign |
| 62 | 1: c;d;e;f; |
| 63 | mussym above all: 5 "sign"; |
| 64 | bar |
| 65 | |
| 66 | // define macro for section between sign and |
| 67 | // symbol to "jump to coda" |
| 68 | define SECTION |
| 69 | 1: g;a;g;; |
| 70 | mussym above all: 5 "coda"; |
| 71 | bar |
| 72 | @ |
| 73 | |
| 74 | // print/play the section just defined by |
| 75 | // the macro |
| 76 | SECTION |
| 77 | |
| 78 | // now do the music up to the D.S. |
| 79 | 1: e;f;2g; |
| 80 | ital above 1: 1 "D. S. al Coda"; |
| 81 | dblbar |
| 82 | |
| 83 | // human player would now flip back to |
| 84 | // the sign, so do the MIDI equivalent: |
| 85 | // play that section again. |
| 86 | ifdef MIDI |
| 87 | SECTION |
| 88 | endif |
| 89 | |
| 90 | // now do the coda |
| 91 | 1: e;d;2c; |
| 92 | rom above 1: 0 "Coda"; |
| 93 | endbar |
| 94 | </PRE><BR> |
| 95 | </P> |
| 96 | <P> |
| 97 | Mup mainly just outputs the note information. |
| 98 | Mup will recognize |
| 99 | <A HREF="octave.html">octave marks,</A> |
| 100 | and move notes up or down appropriately. |
| 101 | It recognizes |
| 102 | <A HREF="pedal.html">piano pedal marks.</A> |
| 103 | It does not attempt to interpret tempo or dynamics marks |
| 104 | specified by |
| 105 | <A HREF="textmark.html">"rom," "boldital," etc. or ornaments in</A> |
| 106 | <A HREF="mussym.html">"mussym" statement.</A> |
| 107 | It does interpret |
| 108 | <A HREF="bars.html#reh">rehearsal marks</A> |
| 109 | as cue points. |
| 110 | It handles |
| 111 | <A HREF="chrdattr.html#chstyle">grace notes,</A> |
| 112 | <A HREF="roll.html">rolls,</A> |
| 113 | <A HREF="chrdattr.html#slashes">slashes,</A> |
| 114 | and |
| 115 | <A HREF="ichdattr.html#alt">alternation groups.</A> |
| 116 | You can control how legato the music is by using |
| 117 | <A HREF="param.html#release">the Mup "release" parameter.</A> |
| 118 | </P> |
| 119 | <P> |
| 120 | Some styles of music are often |
| 121 | written in "swing time," meaning the |
| 122 | players are expected to play pairs of notes with the first twice |
| 123 | as long as the second, even though they are written as if they were the |
| 124 | same duration, or as if the first were three times as long as the second. |
| 125 | The most common example would be where the written notation shows |
| 126 | two eighth notes like 8;; or a dotted rhythm like 8.;16; |
| 127 | but the musician "knows" that the composer really intended it |
| 128 | to be played as if it were a triplet {4;8;}3; |
| 129 | The |
| 130 | <A HREF="param.html#swing">swingunit</A> |
| 131 | parameter can be used to get Mup MIDI output to automatically follow |
| 132 | that performance convention. |
| 133 | </P> |
| 134 | <P> |
| 135 | A MIDI editing program will probably be necessary to add some effects. |
| 136 | However, it is possible to specify certain directives for MIDI. |
| 137 | They are of the form: |
| 138 | <BR><PRE> |
| 139 | <B>midi</B> <I>S V</I><B>:</B> <I>begintime "keyword=value";</I> |
| 140 | </PRE><BR> |
| 141 | The <I>S</I> and <I>V</I> specify the staff and voice for which the directive is |
| 142 | to apply. As elsewhere in Mup, an omitted voice will default to voice 1, |
| 143 | and both staff and voice can be given as a list. |
| 144 | Certain keywords apply to the entire score. In that case the form |
| 145 | <BR><PRE> |
| 146 | <B>midi all:</B> <I>begintime "keyword=value";</I> |
| 147 | </PRE><BR> |
| 148 | is used instead. |
| 149 | The items specified using "all" are placed on the first track, the track |
| 150 | containing score-wide information. They are not applied to the |
| 151 | voices on the other tracks. |
| 152 | </P> |
| 153 | <P> |
| 154 | The <I>begintime</I>, as elsewhere in Mup, |
| 155 | gives the beat into the measure where the MIDI output is to be placed. |
| 156 | If notes are to be turned on or off at the same instant in time as the |
| 157 | <I>begintime</I>, first all "note off" commands are generated, then the "midi" |
| 158 | command events, then "note on" commands. |
| 159 | </P> |
| 160 | <P> |
| 161 | The <I>keyword=value</I> gives specific information of |
| 162 | what MIDI output to generate. The following keywords are currently supported: |
| 163 | <TABLE BORDER=4> |
| 164 | <TR> |
| 165 | <TD><B>keyword</B></TD> <TD><B>values</B></TD> <TD><B>meaning</B></TD> <TD><B>midi S V</B></TD> <TD><B>midi all</B></TD> |
| 166 | </TR> |
| 167 | <TR> |
| 168 | <TD>program</TD> <TD>0-127</TD> <TD>program change (new instrument)</TD> <TD>yes</TD> <TD>no</TD> |
| 169 | </TR> |
| 170 | <TR> |
| 171 | <TD>parameter</TD> <TD>0-127,0-127</TD> <TD>parameter</TD> <TD>yes</TD> <TD>yes</TD> |
| 172 | </TR> |
| 173 | <TR> |
| 174 | <TD>channel</TD> <TD>1-16</TD> <TD>channel</TD> <TD>yes</TD> <TD>no</TD> |
| 175 | </TR> |
| 176 | <TR> |
| 177 | <TD>chanpressure</TD> <TD>0-127</TD> <TD>channel pressure (after touch)</TD> <TD>yes</TD> <TD>yes</TD> |
| 178 | </TR> |
| 179 | <TR> |
| 180 | <TD>tempo</TD> <TD>10-1000</TD> <TD>tempo, quarter notes per minute</TD> <TD>no</TD> <TD>yes</TD> |
| 181 | </TR> |
| 182 | <TR> |
| 183 | <TD>seqnum</TD> <TD>0-65535</TD> <TD>sequence number</TD> <TD>yes</TD> <TD>yes</TD> |
| 184 | </TR> |
| 185 | <TR> |
| 186 | <TD>text</TD> <TD>text</TD> <TD>text meta event</TD> <TD>yes</TD> <TD>yes</TD> |
| 187 | </TR> |
| 188 | <TR> |
| 189 | <TD>copyright</TD> <TD>text</TD> <TD>copyright notice</TD> <TD>yes</TD> <TD>yes</TD> |
| 190 | </TR> |
| 191 | <TR> |
| 192 | <TD>name</TD> <TD>text</TD> <TD>sequence/track name</TD> <TD>yes</TD> <TD>yes</TD> |
| 193 | </TR> |
| 194 | <TR> |
| 195 | <TD>instrument</TD> <TD>text</TD> <TD>instrument name</TD> <TD>yes</TD> <TD>yes</TD> |
| 196 | </TR> |
| 197 | <TR> |
| 198 | <TD>marker</TD> <TD>text</TD> <TD>marker meta event</TD> <TD>yes</TD> <TD>yes</TD> |
| 199 | </TR> |
| 200 | <TR> |
| 201 | <TD>cue</TD> <TD>text</TD> <TD>cue point</TD> <TD>yes</TD> <TD>yes</TD> |
| 202 | </TR> |
| 203 | <TR> |
| 204 | <TD>port</TD> <TD>0-127</TD> <TD>MIDI port</TD> <TD>yes</TD> <TD>yes</TD> |
| 205 | </TR> |
| 206 | <TR> |
| 207 | <TD>onvelocity</TD> <TD>1-127</TD> <TD>note on velocity</TD> <TD>yes</TD> <TD>no</TD> |
| 208 | </TR> |
| 209 | <TR> |
| 210 | <TD>offvelocity</TD> <TD>0-127</TD> <TD>note off velocity</TD> <TD>yes</TD> <TD>no</TD> |
| 211 | </TR> |
| 212 | <TR> |
| 213 | <TD>hex</TD> <TD>hex data</TD> <TD>arbitrary MIDI data</TD> <TD>yes</TD> <TD>yes</TD> |
| 214 | </TR> |
| 215 | </TABLE> |
| 216 | |
| 217 | </P> |
| 218 | <P> |
| 219 | The keywords can be abbreviated to their first three or more letters, |
| 220 | except "chanpressure" which requires at least five letters to differentiate |
| 221 | it from "channel" ("cha" or "chan" will be interpreted as channel). |
| 222 | In most cases, the "=" is followed by either a number or some text. Exceptions |
| 223 | to this are discussed in the next few paragraphs. |
| 224 | </P> |
| 225 | <P> |
| 226 | The "parameter" keyword is followed by 2 numbers, separated by a comma. |
| 227 | The first is the parameter number, the second is the parameter value. |
| 228 | Thus to set parameter 7 (which is the volume parameter) to 90 for voice |
| 229 | 2 of staff 3, starting at the beginning of the measure, you can use: |
| 230 | <BR><PRE> |
| 231 | midi 3 2: 0 "parameter=7,90"; |
| 232 | </PRE><BR> |
| 233 | </P> |
| 234 | <P> |
| 235 | The "onvelocity" and "offvelocity" keywords can have one or more values, |
| 236 | separated by commas. If there is only one value, it applies to all notes |
| 237 | in each chord. If there is more than one value, the first value applies |
| 238 | to the top note of the chord, the second value to the second-from-the-top |
| 239 | note, and so forth. If there are more notes in a chord than there are |
| 240 | values specified, the last value specified applies to all of the remaining |
| 241 | notes. So, for example, if you want to emphasize the top note of each |
| 242 | chord because it is the melody, you can specify two values, as in |
| 243 | <BR><PRE> |
| 244 | midi 1: 1 "onvelocity=76, 60"; |
| 245 | </PRE><BR> |
| 246 | which would cause the top note to have a velocity of 76 and all other |
| 247 | notes to have a velocity of 60. |
| 248 | </P> |
| 249 | <P> |
| 250 | The "hex" form can be used to insert any arbitrary MIDI data into |
| 251 | the MIDI file. The value consists of any even number of hexadecimal digits. |
| 252 | Spaces and tabs can be included in the value field for readability. |
| 253 | </P> |
| 254 | <P> |
| 255 | Note that Mup uses the MIDI standard, |
| 256 | which numbers instruments from 0 through 127, |
| 257 | but some MIDI playback programs follow a convention of numbering them |
| 258 | from 1 through 128. |
| 259 | </P> |
| 260 | <P> |
| 261 | Here are some examples: |
| 262 | <BR><PRE> |
| 263 | midi all: 0 "tempo=72"; |
| 264 | midi 1-2 1-2: 0 "channel=2"; 0 "program=14"; 3.5 "program=76"; |
| 265 | midi all: 3 "hex= ff 00 02 00 01"; // sequence number 1 |
| 266 | midi 3,6: 0 "channel=5"; 0 "prog=15"; 0 "instr=dulcimer"; |
| 267 | // set parameter 7 (usually volume) to 100 |
| 268 | midi 2: "par = 7, 100"; |
| 269 | </PRE><BR> |
| 270 | </P> |
| 271 | <P> |
| 272 | Here is a more extensive example of how midi commands might be used |
| 273 | in a song: |
| 274 | <BR><PRE> |
| 275 | score |
| 276 | staffs=2 |
| 277 | vscheme=2o |
| 278 | |
| 279 | staff 2 |
| 280 | clef=bass |
| 281 | |
| 282 | voice 2 2 |
| 283 | // Make the bottom voice more staccato |
| 284 | release=50 |
| 285 | |
| 286 | music |
| 287 | |
| 288 | // Set the tempo. |
| 289 | // Start out at 108 quarter notes per minute, |
| 290 | // but on count 4, slow down to 96 per minute. |
| 291 | midi all: 0 "tempo=108"; 4 "tempo=96"; |
| 292 | |
| 293 | // Put each voice on a different channel |
| 294 | // using a different instrument sound. |
| 295 | // The program numbers correspond to the |
| 296 | // General MIDI sounds as noted. |
| 297 | midi 1 1: 0 "channel=1"; 0 "program=68"; //oboe |
| 298 | midi 1 2: 0 "channel=2"; 0 "program=11"; //vibraphone |
| 299 | midi 2 1: 0 "channel=6"; 0 "program=60"; //french horn |
| 300 | midi 2 2: 0 "channel=4"; 0 "program=35"; //fretless bass |
| 301 | |
| 302 | // Make the top voice louder, and put an |
| 303 | // accent on the third beat |
| 304 | midi 1 1: 0 "onvelocity=86"; 3 "onvelocity=100"; 4 "onvel=86"; |
| 305 | |
| 306 | // Set maximum reverb on french horn part, |
| 307 | // starting at the second beat. |
| 308 | // (Reverb is parameter 91) |
| 309 | midi 2 1: 2 "parameter=91, 127"; |
| 310 | |
| 311 | // Set chorus on oboe to 75, from the beginning. |
| 312 | // (Chorus is parameter 93) |
| 313 | midi 1 1: 0 "param=93, 75"; |
| 314 | |
| 315 | // Pan the bass part to middle of left side. |
| 316 | // (Pan is parameter 10, with a value of 0 being hard left, |
| 317 | // 64 in the center, and 127 being hard right, so 32 is |
| 318 | // half way to the left.) |
| 319 | midi 2 2: 0 "parameter=10, 32"; |
| 320 | |
| 321 | // Now the music to be played... |
| 322 | 1 1: e;d;2c; |
| 323 | 1 2: c;b-;2g-; |
| 324 | 2 1: g;f;2e; |
| 325 | 2 2: c;g-;2c; |
| 326 | bar |
| 327 | </PRE><BR> |
| 328 | </P> |
| 329 | <HR> |
| 330 | <P> |
| 331 | <A HREF="pstools.html"><-- previous page</A> |
| 332 | <A HREF="index.html">Table of Contents</A></P> |
| 333 | </BODY></HTML> |