File: node16.html

package info (click to toggle)
mma 0.12-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,020 kB
  • ctags: 1,143
  • sloc: python: 5,235; makefile: 37
file content (1004 lines) | stat: -rw-r--r-- 35,563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.70)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Low Level MIDI Commands</TITLE>
<META NAME="description" CONTENT="Low Level MIDI Commands">
<META NAME="keywords" CONTENT="mma">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="mma.css">

<LINK REL="next" HREF="node17.html">
<LINK REL="previous" HREF="node15.html">
<LINK REL="up" HREF="mma.html">
<LINK REL="next" HREF="node17.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html511"
  HREF="node17.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="file:/usr/lib/latex2html/icons/next.png"></A> 
<A NAME="tex2html509"
  HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="file:/usr/lib/latex2html/icons/up.png"></A> 
<A NAME="tex2html503"
  HREF="node15.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="file:/usr/lib/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html512"
  HREF="node17.html">Other Commands and Directives</A>
<B> Up:</B> <A NAME="tex2html510"
  HREF="mma.html">Reference Manaul</A>
<B> Previous:</B> <A NAME="tex2html504"
  HREF="node15.html">Variables, Conditionals and Jumps</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html513"
  HREF="node16.html#SECTION001610000000000000000">Channel</A>
<LI><A NAME="tex2html514"
  HREF="node16.html#SECTION001620000000000000000">ChannelPref</A>
<LI><A NAME="tex2html515"
  HREF="node16.html#SECTION001630000000000000000">ChShare</A>
<LI><A NAME="tex2html516"
  HREF="node16.html#SECTION001640000000000000000">MIDI</A>
<LI><A NAME="tex2html517"
  HREF="node16.html#SECTION001650000000000000000">MidiFile</A>
<LI><A NAME="tex2html518"
  HREF="node16.html#SECTION001660000000000000000">MIDISeq</A>
<LI><A NAME="tex2html519"
  HREF="node16.html#SECTION001670000000000000000">MIDIVoice</A>
<LI><A NAME="tex2html520"
  HREF="node16.html#SECTION001680000000000000000">MIDIClear</A>
<LI><A NAME="tex2html521"
  HREF="node16.html#SECTION001690000000000000000">MIDIinc</A>
<LI><A NAME="tex2html522"
  HREF="node16.html#SECTION0016100000000000000000">Pan</A>
<LI><A NAME="tex2html523"
  HREF="node16.html#SECTION0016110000000000000000">Portamento</A>
<LI><A NAME="tex2html524"
  HREF="node16.html#SECTION0016120000000000000000">ChannelVolume</A>
</UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION001600000000000000000"></A>
<A NAME="sec-mididirectives"></A>
<BR>
Low Level MIDI Commands
</H1>

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

<P>
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.

<P>

<H1><A NAME="SECTION001610000000000000000"></A>  <A NAME="set-channel"></A>
<BR>
Channel
</H1>

<P>
As noted in the Tracks and Channels chapter (<A HREF="node3.html#sec-tracks"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 SRC="file:/usr/lib/latex2html/icons/crossref.png"></A>), <I><B>MMA</B></I> 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 <I>Channel</I> command.

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

<P>
Let us assume that you want the <I>Bass</I> track assigned to MIDI channel 8. Simply use:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass Channel 8  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

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

<P>
<A NAME="channel0"></A>
<P>
You can disable a channel at any time by using a channel number of 0:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio-1 Channel 0 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will disable the Arpeggio-1 channel, freeing it for use by other tracks. A warning message is generated. Disabling a track without a valid channel is fine. When you set a channel to 0 the track is also disabled. You can restart the track with the <I>On</I> command (<A HREF="node17.html#set-on"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 SRC="file:/usr/lib/latex2html/icons/crossref.png"></A>).

<P>
You don't need to have a valid MIDI channel assigned to a track to do things like: <I>Pan</I>, <I>Portamento</I>, <I>ChannelVolume</I> 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.

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

<P>
MIDI channel settings are <I>not</I> saved in <I>Grooves</I>.

<P>
<I><B>MMA</B></I> 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, a new ``track name'' is inserted at the current song offset.

<P>
A more general method is to use <I>ChannelPref</I> detailed below.

<P>

<H1><A NAME="SECTION001620000000000000000">
ChannelPref</A>
</H1>  

<P>
If you prefer to have certain tracks assigned to certain channels you can use the <I>ChannelPref</I> command to create a custom set of preferences. By default, <I><B>MMA</B></I> assigns channels starting at 16 and working down to 1 (with the expection of drum tracks which are all assigned channel 10). If, for example, you would like the <I>Bass</I> track to be on channel 9, sustained bass on channel 3, and <I>Arpeggio</I> on channel 5, you can have a command like:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>ChannelPref  Bass=9  Arpeggio=5 Bass-Sus=3  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Most likely this will be in your <I>mmarc</I> file.

<P>
You can use multiple command lines, or have multiple assignments on a single line. Just make sure that each item consists of a trackname, an ``='' and a channel number in the range 1 to 16.

<P>

<H1><A NAME="SECTION001630000000000000000"></A>  <A NAME="set-chshare"></A>
<BR>
ChShare
</H1>

<P>
<I><B>MMA</B></I> 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.

<P>
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.

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

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio Sequence A16 z 
<BR>
Arpeggio Voice Piano1 
<BR>
Scale Sequence z S8 
<BR>
Scale Voice Piano1  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
In this example, <I><B>MMA</B></I> will use different MIDI channels for the <I>Arpeggio</I> and the <I>Scale</I>. Now, if you force channel sharing:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Scale ChShare Arpeggio </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
both tracks will use the same MIDI channel.

<P>
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?

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio Sequence A16 z 
<BR>
Arpeggio Voice Piano1 Strings 
<BR>
Scale Sequence z S8 
<BR>
Scale ChShare Arpeggio </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
You might think that this would work, but it doesn't. <I><B>MMA</B></I> 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 <I>Arpeggio</I>) it will not know that the voice has been changed to ``Strings'' by the <I>Scale</I> track.

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

<P>
One more example which doesn't work:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio Sequence A8 
<BR>
Scale Sequence S4 
<BR>
Arpeggio Voice Piano1 
<BR>
Scale Voice Piano1 
<BR>
Scale ChShare Arpeggio  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
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 <I><B>MMA</B></I> 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.

<P>
When a <I>ChShare</I> 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 <I><B>MMA</B></I>'s normal dynamic channel allocation scheme. This may cause is a depletion of avaiable channels.

<P>
Please note that we've never found it really necessary to use the <I>ChShare</I> command, so it might have more problems than outlined here. But, to do some testing we do use the command to share <I>Bass</I> and <I>Walk</I> channels in a few groove files.

<P>
This command will always display a warning message.

<P>
For another, simpler, way of reassigning MIDI tracks and letting <I><B>MMA</B></I> do most of the work for you, refer to the <I>Delete</I> command (<A HREF="node17.html#sec-delete"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 SRC="file:/usr/lib/latex2html/icons/crossref.png"></A>).

<P>

<H1><A NAME="SECTION001640000000000000000">
MIDI</A>
</H1> 

<P>
The complete set of MIDI commands is not limitless--but from this end it seems that adding commands to suit every possible configuration is never-ending. 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.

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

<P>
For example, you might want to start a song off with a MIDI reset:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDI 0xF0 0x05 0x7e 0x7f 0x09 0x01 0xf7 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The values passed to the MIDI command are normal integers; however, they must all be in the range of 0x00 to 0xff. In most cases it is easiest to use hexadecimal numbers by using the ``0x'' prefix. But, you can use plain decimal integers if you prefer.

<P>
In the above example:

<P>
<DL COMPACT>
<DT>&nbsp;&nbsp;0xF0</DT>
<DD>Designates a SYSEX message

<P>
</DD>
<DT>&nbsp;&nbsp;0x05</DT>
<DD>The length of the message 

<P>
</DD>
<DT>&nbsp;&nbsp;0x7e</DT>
<DD>...The actual message
</DD>
</DL>

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

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDI 0xff 0x59 0x02 0xff 0x00 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Some <B>cautions:</B>

<UL>
<LI><I><B>MMA</B></I> makes no attempt to verify the validity of the data!

<P>
</LI>
<LI>The ``Length'' field must be manually calculated.

<P>
</LI>
<LI>Malformed sequences can create unplayable MIDI files. In extreme situations, these might even damange your synth. You are on your own with this command ...be careful.

<P>
</LI>
<LI>The <I>Midi</I> directive always places data in the <I>Meta</I> 		track at the current time offset into the file. This should not be a problem.

<P>
</LI>
</UL>

<P>
Cautions aside, an include file which the author uses has been included in the main distribution as includes/init.mma. You might want to have the command:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MMAstart init </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
in your <I>mmarc</I> file. The file is pretty well commented and it sets a synth up to something reasonably sane.

<P>
If you need a brief delay after a raw MIDI command, it is possible to insert a silent beat with the <I>BeatAdjust</I> command (<A HREF="node12.html#beatadjust"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 SRC="file:/usr/lib/latex2html/icons/crossref.png"></A>). See the file includes/reset.mma for an  example.

<P>

<H1><A NAME="SECTION001650000000000000000"></A>  <A NAME="midismf"></A>
<BR>
MidiFile
</H1>

<P>
This option controls some fine points of the generated MIDI file. The command is issued with a series of paramaters in the form ``MODE=VALUE''. You can have mulitple settings in a single <I>MidiFile</I> command.

<P>
<I><B>MMA</B></I> can generate two types of SMF (Standard MIDI Files):
<DL COMPACT>
<DT>0.</DT>
<DD>This file contains only one track into which the data for all the different channel tracks has been merged. A number of syths which accept SMF (Casio, Yamaha and others) only accept type 0 files.

<P>
</DD>
<DT>1.</DT>
<DD>This file has the data for each MIDI channel in its own track. This is the default file generated by <I><B>MMA</B></I>.

<P>
</DD>
</DL>

<P>
You can set the filetype in an RC file (or, for that matter, in any file processed by <I><B>MMA</B></I>) with the command:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MidiFile SMF=0 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
or

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MidiFile SMF=1 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
You can also set it on the command line with the -M option. Using the command line option will override the <I>MidiSMF</I> command if it is in a RC file.

<P>
By default <I><B>MMA</B></I> uses ``running status'' when generating MIDI files. This can be disabled with the command:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MidiFile Running=0 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
or enabled (but this is the default) with:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MidiFile Running=1 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Files generated without running status will be about 20 to 30% larger than their compressed counterparts. They may be useful for use with braindead sequencers and in debugging generated code. There is no command line equivalent for this option.

<P>

<H1><A NAME="SECTION001660000000000000000">
MIDISeq</A>
</H1> 

<P>
It is possible to associate a set of MIDI controller messages with certain beats in a sequence. For example, you might want to have the Modulation Wheel set for the first beats in a bar, but not for the third. The following example shows how:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Seqsize 4 
<BR>
Begin Bass-2 
<BR>
Voice NylonGuitar 
<BR>
Octave 4 
<BR>
Sequence { 1 4 1 90; 2 4 3 90; 3 4 5 90; 4 4 1+ 90} 
<BR>
MIDIDef WheelStuff 1 1 0x7f ; 2 1 0x50; 3 1 0 
<BR>
MidiSeq WheelStuff 
<BR>
Articulate 90 
<BR>
End 
<BR>	  
<BR>
C  <IMG
 WIDTH="14" HEIGHT="18" ALIGN="BOTTOM" BORDER="0"
 SRC="img22.png"
 ALT="$*$"> 4 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The <I>MidiSeq</I> command is specific to a track and is saved as part of the <I>Groove</I> definition. This lets style file writers use enhanced MIDI features to dress up their sounds.

<P>
The command has the following syntax:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>TrackName MidiSeq &lt;Beat&gt; &lt;Controller&gt; &lt;Datum&gt; [ ; ...]  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
where:
<DL>
<DT><STRONG>Beat</STRONG></DT>
<DD>is the Beat in the bar. This can be an integer (1,2, etc.)  or a floating point value (1.2, 2.25, etc.). It must be 1 or greater and less than the end of bar (in <B>4/4</B> it must be less than 5).

<P>
</DD>
<DT><STRONG>Controller</STRONG></DT>
<DD>A valid MIDI controller. This can be a value in the range 0x00 to 0x7f or a symbolic name. See <A HREF="node23.html#sec-controllers"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 SRC="file:/usr/lib/latex2html/icons/crossref.png"></A> for a list of defined names.

<P>
</DD>
<DT><STRONG>Datum</STRONG></DT>
<DD>All controller messages use a single byte ``parameter'' in the range 0x00 to 0x7f.

<P>
</DD>
</DL>

<P>
You can enter the values in either standard decimal notation or in hexadecimal with the prefixed ``0x''. In most cases, your code will be clearer if you use values like ``0x7f'' rather than the equivalent ``127''.

<P>
The MIDI sequences specified can take several forms:

<P>

<OL>
<LI>A simple series like:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDISeq 1 ReleaseTime 50; 3 ReleaseTime 0  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
in this case the commands are applied to beats 1 and 3 in each bar of the sequence.

<P>
</LI>
<LI>As a set of names predefined in an <I>MIDIDef</I> command:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDIdef Rel1 1 ReleaseTime 50; 3 ReleaseTime 0 
<BR>
MIDIdef Rel2 2 ReleaseTime 50; 4 ReleaseTime 0 
<BR>
MIDISeq Rel1 Rel2  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Here, the commands defined in ``Rel1'' are applied to the first bar in the sequence, ``Rel2'' to the second. And, if there are more bars in the sequence than definitions in the line, the series will be repeated for each bar.

<P>
</LI>
<LI>A set of series enclosed in { } braces. Each braced series is applied to a different bar in the sequence. The example above could have been does as:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDISeq { 1 ReleaseTime 50; 3 ReleaseTime 0 }  &#92;
<BR>		   { 2 ReleaseTime 50; 4 ReleaseTime 0 }  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
</LI>
<LI>Finally, you can combine the above into different combinations. For example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDIDef Rel1 1 ReleaseTime 50 
<BR>
MIDIDef Rel2 2 ReleaseTime 50  
<BR>
MIDISeq { Rel1; 3 ReleaseTime 0 } { Rel2; 4 ReleaseTime 0 }  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
</LI>
</OL>

<P>
You can have specify different messages for different beats (or different messages/controllers for the same beat) by listing them on the same <I>MidiSeq</I> line separated by ``;''s. 

<P>
If you need to repeat a sequence for a measure in a sequence you can use the special notation ``/'' to force the use of the previous line. The special symbol ``z'' or ''-'' can be used to disable a bar (or number of bars). For example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass-Dumb MIDISeq 1 ReleaseTime 20 z / FOOBAR  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
would set the ``ReleaseTime'' sequence for the first bar of the sequence, no MIDISeq events for the second and third, and the contents of ``FOOBAR'' for the fourth.

<P>
To disable the sending of messages just use a single ``-'':

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass-2 MidiSeq - // disable controllers </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>

<H1><A NAME="SECTION001670000000000000000">
MIDIVoice</A>
</H1> 

<P>
Similar to the <I>MIDISeq</I> command discussed in the previous section, the <I>MIDIVoice</I> command is used to insert MIDI controller messages into your files. Instead of sending the data for each bar as <I>MIDISeq</I> does, this command just sends the listed control events at the start of a track and then, if needed, at the start of each bar. 

<P>
Again, a short example. Let us assume that you want to use the ``Release Time'' controller to sustain notes in a bass line:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Seqsize 4 
<BR>
Begin Bass-2 
<BR>
Voice NylonGuitar 
<BR>
MidiVoice 1 ReleaseTime 50 
<BR>
Octave 4 
<BR>
Sequence { 1 4 1 90; 2 4 3 90; 3 4 5 90; 4 4 1+ 90} 
<BR>
Articulate 60 
<BR>
End 
<BR>	  
<BR>
C  <IMG
 WIDTH="14" HEIGHT="18" ALIGN="BOTTOM" BORDER="0"
 SRC="img22.png"
 ALT="$*$"> 4 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
should give an interesting effect.

<P>
The syntax for the command is:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Track MIDIVoice &lt;beat&gt; &lt;controller&gt; &lt;Datum&gt; [; ...]  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
This syntax is identical to that discussed in the section for <I>MIDISeq</I>, above. The &lt;beat&gt;value is required for the command--it determines if the data is sent before or after the <I>Voice</I> command is sent. Some controllers are reset by a voice, others not. My experiments show that <I>Bank</I> should be sent before, most others after. Using a ``beat'' of ``0'' forces the MidiVoice data to be sent before the Voice control; any other ``beat'' value causes the data to be sent after the Voice control. In this silly example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Voice Piano1 
<BR>
MidiVoice {0 Bank 5; 1 ReleaseTime 100}  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
we end up with MIDI data being created something like:

<P>
<P>
<BLOCKQUOTE>0 Param Ch=xx Con=00 val=05 
<BR>
0 ProgCh Ch=xx Prog=00 
<BR>
0 Param Ch=xx Con=72 val=80		

</BLOCKQUOTE>

<P>
All the MIDI events occur at the same offset, but the order is (may be) important.

<P>
By default <I><B>MMA</B></I> assumes that the MIDIVoice data is to be used only for the first bar in the sequence. But, it's possible to have a different sequence for each bar in the sequence (just like you can have a different <I>Voice</I> for each bar). In this case, group the different data groups with {} brackets:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass-1 MIDIVoice {1 ReleaseTime 50} {1 ReleaseTime 20}  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
This list is stored with other <I>Groove</I> data, so is ideal for inclusion in a style file.

<P>
If you want to disable this command after it has been issued you can use the form:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Track MIDIVoice - // disable </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Some technical notes:

<P>

<UL>
<LI><I><B>MMA</B></I> tracks the events sent for each bar and will not duplicate sequences.

<P>
</LI>
<LI>Be cautious in using this command to switch voice banks. If you don't switch the voice bank back to a sane value you'll be playing the wrong instruments!

<P>
</LI>
<LI>Do use the <I>MIDIClear</I> command (below) to ``undo'' anything you've done via a <I>MIDIVoice</I> command.	
</LI>
</UL>

<P>

<H1><A NAME="SECTION001680000000000000000">
MIDIClear</A>
</H1> 

<P>
As noted earlier in this manual you should be very careful in programming MIDI sequences into your song and/or library files. Doing damage to a synthesizer is probably a remote possibility ...but leaving it in a unexpected mode is likely. For this reason we have included the <I>MIDIClear</I> command as a companion to the <I>MIDIVoice</I> and <I>MIDISeq</I> commands.

<P>
Each time a MIDI track (not necessary the same as a <I><B>MMA</B></I> track) is ended or a new <I>Groove</I> is started, a check is done to see if any MIDI data has been inserted in the track with a <I>MIDIVoice</I> or <I>MIDISeq</I> command. If it has, a further check is done to see if there is an ``undo'' sequence defined via a <I>MIDIClear</I> command. That data is then sent; or, if data has not be defined for the track, a warning message is displayed.

<P>
The <I>MIDIClear</I> command uses the same syntax as <I>MIDIVoice</I> and <I>MIDISeq</I>; however, you can not specify different sequence for different bars in the sequence:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass-Funky MIDIClear 1 Modulation 0; 1 ReleaseTime 0 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
As in <I>MIDIVoice</I> and <I>MIDISeq</I> you can include sequences defined in a <I>MIDIDef</I>. The &lt;beat&gt;offsets are required, but ignored.

<P>

<H1><A NAME="SECTION001690000000000000000">
MIDIinc</A>
</H1> 

<P>
<I><B>MMA</B></I> has the ability to include a user supplied MIDI file at any point of its generated files. These included files can be used to play a melodic solo over a <I><B>MMA</B></I> pattern or to fill a section of a song with something like a drum solo.

<P>
When the <I>MIDIinc</I> command is encountered the current line is parsed for options, the file is inserted into the stored MIDI stream, and processing continues. The include has no effect on any song pointers, etc.

<P>
<I>MIDIinc</I> has a number of options, mostly set in the form OPTION=VALUE. Following are the recognized values:

<P>
<DL>
<DT><STRONG>FILENAME</STRONG></DT>
<DD>The filename of the file to be included. This must be a complete filename. No processing or expansion is done by <I><B>MMA</B></I> on the name.

<P>
</DD>
<DT><STRONG>VOLUME</STRONG></DT>
<DD>An adjustment for the volume of all the note on events in the included MIDI file. The adjustment is specified as a percentage with values under 100 decreasing the volume and over 100 increased it. If the resultant volume (velocity) is less than 1 a velocity of 1 will be used; if it is over 127, 127 will be used.

<P>
</DD>
<DT><STRONG>OCTAVE</STRONG></DT>
<DD>Octave adjustment for all notes in the file. Values in the range -4 to 4 are permitted. Notes in drum tracks (channel 10) will not be effected.

<P>
</DD>
<DT><STRONG>TRANSPOSE</STRONG></DT>
<DD>Transposition adjustment settings in the range -24 ot 24 are permitted. If you do not set a value for this the global transpose setting will be applied (expecting channel 10, drum, notes).

<P>
</DD>
<DT><STRONG><I>TRACK</I></STRONG></DT>
<DD>A trackname must be be set into which notes are inserted. You can set more than one track/channel if you wish. For example, if you had the option <I>DRUM=10</I> any notes in the MIDI file with a channel 10 setting would be inserted into the <I><B>MMA</B></I> <I>Drum</I> track. Similarity, <I>Solo-Tenor=1</I> will copy notes from channel 1 into the <I>Solo-Tenor</I> track. If the track doesn't exist, it will be created. Note: this means that the channel assignment in your included file and the new <I><B>MMA</B></I> generated file will most likely be different.

<P>
</DD>
</DL>

<P>
A complete example of usage is shown in the files in the directory <TT><A NAME="tex2html60"
  HREF="egs/frankie">egs/frankie</A></TT> in the distribution. A short example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MIDIinc File=test.mid Solo-Piano=1 Drum=10 Volume=70 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will include the MIDI file ``test.mid'' at the current position and assign all notes in channel 1 to the <I>Solo-Piano</I> track and the notes from channel 10 to the <I>Drum</I> track. The volumes for all the notes will be adjusted to 70
A few notes:

<P>

<UL>
<LI>MIDI files to be included do not have to have the same tempo. MIDI adjusts this automatically on playback. However, the internal setting for beat division should be the same. <I><B>MMA</B></I> assumes a beat division of 192 (this is set in bytes 12 and 13 of the MIDI file). If the included file differs a warning is printed and <I><B>MMA</B></I> will attempt to adjust the timings.

<P>
</LI>
<LI>All files are parsed to find the offset of the first note-on event; notes to be included are set with their offsets compensated by that time. This means that any silence at the start of the included file is skipped. If you want the included file to start somewhere besides the start of the current bar you can use a <I>Beatadjust</I> before the <I>MidiInc</I>--use another to move the pointer back right after the include to keep the song pointer correct.

<P>
</LI>
<LI>Not all events in the included files are transferred: notably all system and meta events are ignored.

<P>
</LI>
<LI>If you want to apply different <I>Volume</I> or other options to different tracks, just do multiple includes of the same file (with each include using a different track and options).

<P>
</LI>
</UL>

<P>

<H1><A NAME="SECTION0016100000000000000000">
Pan</A>
</H1> 

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

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Bass Pan 4  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
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.

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

<P>
<I>Pan</I> is not saved or restored by <I>Groove</I> commands, nor is it effected by <I>SeqClear</I>. A <I>Pan</I> 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 <I>Pan</I> will be in use until another <I>Pan</I> is encountered.

<P>
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.

<P>
We use Pan for much cruder purposes. When creating accompaniment tracks for our jazz group, we set all the bass tracks (Bass, Walk, Bass-1, 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.

<P>
Because your MIDI keyboard most likely does not do a reset between tunes, you should probably undo any <I>Pan</I> effects at the end of your file. Example:<A NAME="tex2html61"
  HREF="#foot5750"><SUP>16.1</SUP></A>
<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Include swing 
<BR>
Groove Swing
<BR>
Bass Pan 0
<BR>
Walk Pan 0
<BR>
1 C
<BR>
2 C
<BR>		...
<BR>
123 C
<BR>
Bass Pan 64
<BR>
Walk Pan 64  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>

<H1><A NAME="SECTION0016110000000000000000">
Portamento</A>
</H1> 

<P>
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:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio Portamento 30 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

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

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Arpeggio Portamento 0 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
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.

<P>

<H1><A NAME="SECTION0016120000000000000000"></A>  <A NAME="channelvol"></A>
<BR>
ChannelVolume
</H1>

<P>
MIDI devices equipped with mixer settings can make use of the ``Channel'' or ``Master'' volume settings.<A NAME="tex2html62"
  HREF="#foot5743"><SUP>16.2</SUP></A>
<P>
<I><B>MMA</B></I> doesn't set any channel volumes without your knowledge. If you want to use a set of reasonable defaults, look at the file <TT><A NAME="tex2html63"
  HREF="includes/init.mma">includes/init.mma</A></TT> which sets all channels other than ``1'' to ``100''. Channel ``1'' is assumed to be a solo/keyboard track and is set to the maximum volume of ``127''.

<P>
You can set all or selected <I>ChannelVolume</I>s:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>ChannelVolume 99 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will set all channels to ``99''. And:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Chord ChannelVolume 55 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will set only the Chord track channel. For most users, the use of this command is <I>not</I> 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.

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

<P>

<P>
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot5750">... Example:</A><A
 HREF="node16.html#tex2html61"><SUP>16.1</SUP></A></DT>
<DD>This is much easier to do with the MMAStart and MMAEnd options (see chapter <A HREF="node20.html#sec-paths">20</A>).

</DD>
<DT><A NAME="foot5743">... settings.</A><A
 HREF="node16.html#tex2html62"><SUP>16.2</SUP></A></DT>
<DD>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.

</DD>
</DL><HR>
<!--Navigation Panel-->
<A NAME="tex2html511"
  HREF="node17.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="file:/usr/lib/latex2html/icons/next.png"></A> 
<A NAME="tex2html509"
  HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="file:/usr/lib/latex2html/icons/up.png"></A> 
<A NAME="tex2html503"
  HREF="node15.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="file:/usr/lib/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html512"
  HREF="node17.html">Other Commands and Directives</A>
<B> Up:</B> <A NAME="tex2html510"
  HREF="mma.html">Reference Manaul</A>
<B> Previous:</B> <A NAME="tex2html504"
  HREF="node15.html">Variables, Conditionals and Jumps</A>
<!--End of Navigation Panel-->
<ADDRESS>
Bob
2004-12-02
</ADDRESS>
</BODY>
</HTML>