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