<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) 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="node20.html"> <LINK REL="previous" HREF="node18.html"> <LINK REL="up" HREF="mma.html"> <LINK REL="next" HREF="node20.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html608" HREF="node20.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html606" HREF="mma.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html600" HREF="node18.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <BR> <B> Next:</B> <A NAME="tex2html609" HREF="node20.html">Fine Tuning (Translations)</A> <B> Up:</B> <A NAME="tex2html607" HREF="mma.html">Reference Manual</A> <B> Previous:</B> <A NAME="tex2html601" HREF="node18.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="tex2html610" HREF="node19.html#SECTION001910000000000000000">Channel</A> <LI><A NAME="tex2html611" HREF="node19.html#SECTION001920000000000000000">ChannelPref</A> <LI><A NAME="tex2html612" HREF="node19.html#SECTION001930000000000000000">ChShare</A> <LI><A NAME="tex2html613" HREF="node19.html#SECTION001940000000000000000">ForceOut</A> <LI><A NAME="tex2html614" HREF="node19.html#SECTION001950000000000000000">MIDI</A> <LI><A NAME="tex2html615" HREF="node19.html#SECTION001960000000000000000">MIDIClear</A> <LI><A NAME="tex2html616" HREF="node19.html#SECTION001970000000000000000">MIDIFile</A> <LI><A NAME="tex2html617" HREF="node19.html#SECTION001980000000000000000">MIDIGlis</A> <LI><A NAME="tex2html618" HREF="node19.html#SECTION001990000000000000000">MIDIInc</A> <LI><A NAME="tex2html619" HREF="node19.html#SECTION0019100000000000000000">MIDIMark</A> <LI><A NAME="tex2html620" HREF="node19.html#SECTION0019110000000000000000">MIDIPan</A> <LI><A NAME="tex2html621" HREF="node19.html#SECTION0019120000000000000000">MIDISeq</A> <UL> <LI><A NAME="tex2html622" HREF="node19.html#SECTION0019121000000000000000">MIDIDef</A> </UL> <BR> <LI><A NAME="tex2html623" HREF="node19.html#SECTION0019130000000000000000">MIDISplit</A> <LI><A NAME="tex2html624" HREF="node19.html#SECTION0019140000000000000000">MIDITname</A> <LI><A NAME="tex2html625" HREF="node19.html#SECTION0019150000000000000000">MIDIVoice</A> <LI><A NAME="tex2html626" HREF="node19.html#SECTION0019160000000000000000">MIDIVolume</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION001900000000000000000"></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="SECTION001910000000000000000"></A> <A NAME="set-channel"></A> <BR> Channel </H1> <P> As noted in <A HREF="node3.html#sec-tracks">Tracks and Channels</A> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 C<SMALL>HANNEL</SMALL> command. <P> You cannot assign a channel number to a track if it already defined (well, see the section C<SMALL>H</SMALL>S<SMALL>HARE</SMALL>, below, for the inevitable exception), nor can you change the channel assignments for any of the D<SMALL>RUM</SMALL> tracks. <P> Let us assume that you want the <I>Bass</I> track assigned to MIDI channel 8. Simply use: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass Channel 8 </B> </td></tr> </Table> <P> Caution: If the selected channel is already in use an error will be generated. Due to the way <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> allocates tracks, if you really need to manually assign track it is recommended that you do this in a MMA<SMALL>RC</SMALL> file. <P> <A NAME="channel0"></A> <P> You can disable a channel at any time by using a channel number of 0: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio-1 Channel 0 </B> </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 O<SMALL>N</SMALL> command (<A HREF="node21.html#set-on">here</A>). <P> You don't need to have a valid MIDI channel assigned to a track to do things like: MIDIP<SMALL>AN</SMALL>, MIDIG<SMALL>LIS</SMALL>, MIDIV<SMALL>OLUME</SMALL> 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 G<SMALL>ROOVE</SMALL>s. <P> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 C<SMALL>HANNEL</SMALL>P<SMALL>REF</SMALL> detailed below. <P> You can access the currently assigned channel with the $_TRACK_C<SMALL>HANNEL</SMALL> macro. <P> <H1><A NAME="SECTION001920000000000000000"> ChannelPref</A> </H1> <P> If you prefer to have certain tracks assigned to certain channels you can use the C<SMALL>HANNEL</SMALL>P<SMALL>REF</SMALL> command to create a custom set of preferences. By default, <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> assigns channels starting at 16 and working down to 1 (with the expectation 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>ChannelPref Bass=9 Arpeggio=5 Bass-Sus=3 </B> </td></tr> </Table> <P> Most likely this will be in your <SMALL>MMARC</SMALL> 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="SECTION001930000000000000000"></A> <A NAME="set-chshare"></A> <BR> ChShare </H1> <P> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio Sequence A16 z <BR> Arpeggio Voice Piano1 <BR> Scale Sequence z S8 <BR> Scale Voice Piano1 </B> </td></tr> </Table> <P> In this example, <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> will use different MIDI channels for the <I>Arpeggio</I> and the <I>Scale</I>. Now, if you force channel sharing: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Scale ChShare Arpeggio </B> </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 you wanted to use a different voice for the tracks? <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio Sequence A16 z <BR> Arpeggio Voice Piano1 Strings <BR> Scale Sequence z S8 <BR> Scale ChShare Arpeggio </B> </td></tr> </Table> <P> You might think that this would work, but it doesn't. <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 A<SMALL>RPEGGIO</SMALL>) 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio Sequence A8 <BR> Scale Sequence S4 <BR> Arpeggio Voice Piano1 <BR> Scale Voice Piano1 <BR> Scale ChShare Arpeggio </B> </td></tr> </Table> <P> This example has 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 C<SMALL>H</SMALL>S<SMALL>HARE</SMALL> 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 's normal dynamic channel allocation scheme. This may cause is a depletion of available channels. <P> Please note that that the use of the C<SMALL>H</SMALL>S<SMALL>HARE</SMALL> command is probably never really needed, so it might have more problems than outlined here. If you want to see how much a bother channel sharing becomes, have a look at the standard library file <TT><B>frenchwaltz.mma</B></TT>. All this so the accordion bass can use one channel instead of 6. If I were to write it again I'd just let it suck up the MIDI channels. <P> For another, simpler, way of reassigning MIDI tracks and letting <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> do most of the work for you, refer to the <A HREF="node21.html#sec-delete">D<SMALL>ELETE</SMALL> command</A>. <P> <H1><A NAME="SECTION001940000000000000000"> ForceOut</A> </H1> <P> Under normal conditions <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> only generates the MIDI tracks it thinks are valid or relevant. So, if you create a track but insert no note data into that track it will not be generated. An easy way to verify this is by creating file and running <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> with the -c command line option. Lets start off by creating a file you might think will set the keyboard channel on your synth to a TenorSax voice: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Begin Solo-Keyboard <BR> Channel 1 <BR> Voice TenorSax <BR> MIDIVolume 100 <BR> End </B> </td></tr> </Table> <P> If you compile this you should get: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>$ mma test -c <BR> <BR> File 'test' parsed, but no MIDI file produced! <BR> <BR> Tracks allocated: <BR> SOLO-KEYBOARD <BR> <BR> Channel assignments: <BR> 1 SOLO-KEYBOARD <BR> </B> </td></tr> </Table> <P> So, a <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> track was created, but if you compile this file and examine the resulting MIDI file you will find that the voice <I>has not</I> been set. <P> To oversome this, insert the F<SMALL>ORCE</SMALL>O<SMALL>UT</SMALL> command at the end of the track setup. For example, here is a more complete file which will set the keyboard track to TenorSax with a volume of 100, play a bar of accompaniment, set a Trumpet voice with a louder volume, play another bar, and finally reset the keyboard to the default Piano voice. <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Groove BossaNova <BR> <BR> Begin Solo <BR> Channel 1 <BR> Voice TenorSax <BR> MIDIVolume 100 <BR> ForceOut <BR> End <BR> <BR> 1 C <BR> <BR> Begin Solo <BR> Voice Trumpet <BR> MIDIVolume 120 <BR> ForceOut <BR> End <BR> <BR> 2 G <BR> <BR> Begin Solo <BR> Voice Piano1 <BR> MIDIVolume 127 <BR> ForceOut <BR> End <BR> </B> </td></tr> </Table> <P> Note: The same or similar results could be accomplished with the MIDI command; however, it's a bit harder to use and the commands would be in the Meta track. <P> <H1><A NAME="SECTION001950000000000000000"> 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, a command which will place any arbitrary MIDI stream in your tracks has been implemented. In most cases this will be a MIDI ``Sysex'' or ``Meta'' event. <P> For example, you might want to start a song off with a MIDI reset: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDI 0xF0 0x05 0x7e 0x7f 0x09 0x01 0xf7 </B> </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> 0xF0</DT> <DD>Designates a SYSEX message <P> </DD> <DT> 0x05</DT> <DD>The length of the message <P> </DD> <DT> 0x7e</DT> <DD>...The actual message <P> </DD> </DL> <P> Another example places the key signature of F major (1 flat) in the meta track:<A NAME="tex2html61" HREF="#foot8253"><SUP>19.1</SUP></A> <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDI 0xff 0x59 0x02 0xff 0x00 </B> </td></tr> </Table> <P> Some <I>cautions:</I> <UL> <LI> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 damage your synth. You are on your own with this command ...be careful. <P> </LI> <LI>The M<SMALL>IDI</SMALL> 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, <TT><B>includes/init.mma</B></TT> has been included in this distribution. I use this without apparent problems; to use it add the command line: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MMAstart init </B> </td></tr> </Table> <P> in your <SMALL>MMARC</SMALL> 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 <A HREF="node14.html#beatadjust">B<SMALL>EAT</SMALL>A<SMALL>DJUST</SMALL> command</A>. See the file <TT><B>includes/reset.mma</B></TT> for an example. <P> <H1><A NAME="SECTION001960000000000000000"></A> <A NAME="sec-midiclear"></A> <BR> MIDIClear </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 the MIDIC<SMALL>LEAR</SMALL> command has been added as a companion to the MIDIV<SMALL>OICE</SMALL> and MIDIS<SMALL>EQ</SMALL> commands. <P> Each time a MIDI track (not necessary the same as a <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> track) is ended or a new G<SMALL>ROOVE</SMALL> is started, a check is done to see if any MIDI data has been inserted in the track with a MIDIV<SMALL>OICE</SMALL> or MIDIS<SMALL>EQ</SMALL> command. If it has, a further check is done to see if there is an ``undo'' sequence defined via a MIDIC<SMALL>LEAR</SMALL> command. That data is then sent; or, if data has not be defined for the track, a warning message is displayed. <P> The MIDIC<SMALL>LEAR</SMALL> command uses the same syntax as MIDIV<SMALL>OICE</SMALL> and MIDIS<SMALL>EQ</SMALL>; however, you can not specify different sequence for different bars in the sequence: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass-Funky MIDIClear 1 Modulation 0; 1 ReleaseTime 0 </B> </td></tr> </Table> <P> As in MIDIV<SMALL>OICE</SMALL> and MIDIS<SMALL>EQ</SMALL> you can include sequences defined in a MIDID<SMALL>EF</SMALL>. The <beat>offsets are required, but ignored. <P> <H1><A NAME="SECTION001970000000000000000"></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 parameters in the form ``MODE=VALUE''. You can have multiple settings in a single MIDIF<SMALL>ILE</SMALL> command. <P> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 synths 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> . <P> </DD> </DL> <P> You can set the filetype in an RC file (or, for that matter, in any file processed by <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> ) with the command: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiFile SMF=0 </B> </td></tr> </Table> <P> or <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiFile SMF=1 </B> </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 M<SMALL>IDI</SMALL>SMF command if it is in a RC file. <P> By default <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> uses ``running status'' when generating MIDI files. This can be disabled with the command: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiFile Running=0 </B> </td></tr> </Table> <P> or enabled (but this is the default) with: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiFile Running=1 </B> </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 brain-dead sequencers and in debugging generated code. There is no command line equivalent for this option. <P> <H1><A NAME="SECTION001980000000000000000"> MIDIGlis</A> </H1> <P> This sets the MIDI portamento<A NAME="tex2html62" HREF="#foot8115"><SUP>19.2</SUP></A> (in case you're new to all this, portamento is like glissando between notes--wonderful, if you like trombones! To enable portamento: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio MIDIGlis 30 </B> </td></tr> </Table> <P> The parameter can be any value between 1 and 127. To turn the sliding off: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Arpeggio MIDIGlis 0 </B> </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="SECTION001990000000000000000"> MIDIInc</A> </H1> <P> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> pattern or to fill a section of a song with something like a drum solo. <P> When the MIDI<SMALL>INC</SMALL> 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> MIDI<SMALL>INC</SMALL> has a number of options, all set in the form OPTION=VALUE. Following are the recognized options: <P> <DL> <DT><STRONG>FILENAME</STRONG></DT> <DD>The filename of the file to be included. This must be a complete filename. The filename will be expanded by the Python os.path.expanduser() function for tilde expansion. No prefixes or extensions are added by <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> . Examples: F<SMALL>ILENAME</SMALL>=<TT><B>/home/bob/midi/myfile.mid</B></TT>. or F<SMALL>ILENAME</SMALL>=<TT><B> /sounds/myfile.mid</B></TT>. <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 increasing 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. Example: V<SMALL>OLUME</SMALL>=80. <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. Example: O<SMALL>CTAVE</SMALL>=2. <P> </DD> <DT><STRONG>TRANSPOSE</STRONG></DT> <DD>Transposition adjustment settings in the range -24 to 24 are permitted. If you do not set a value for this the global transpose setting will be applied (expecting channel 10, drum, notes). Example: T<SMALL>RANSPOSE</SMALL>=-2. <P> </DD> <DT><STRONG>LYRIC</STRONG></DT> <DD>This option will copy any <I>Lyric</I> events to the <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> meta track. The valid settings are ``On'' or ``Off''. By default this is set to ``Off''. Example L<SMALL>YRIC</SMALL>=On. <P> </DD> <DT><STRONG>TEXT</STRONG></DT> <DD>This option will copy any <I>Text</I> events to the <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> meta track. The valid settings are ``On'' or ``Off''. By default this is set to ``Off''. Example T<SMALL>EXT</SMALL>=On. <P> </DD> <DT><STRONG>START</STRONG></DT> <DD>Specifies the start point <I>of the file to be included</I> in beats. For example, ``Start=22'' would start the include process 22 beats into the file. The data will be inserted at the current song position in your MMA file. The value used must greater or equal to 0 and may be a fractional beat value (18.456 if fine). <P> </DD> <DT><STRONG>END</STRONG></DT> <DD>Specifies the end point <I>of the file to be included</I> in beats. For example, ``End=100'' would disard all data after 100 beats in the file. The value used must be greater that the <I>Start</I> position and can be fractional. <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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> <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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> generated file will most likely be different. Example: S<SMALL>OLO</SMALL>=1 <P> </DD> </DL> <P> A complete example of usage is shown in the files in the directory <TT><B>egs/frankie</B></TT> in the distribution. A short example: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDIinc File=test.mid Solo-Piano=1 Drum=10 Volume=70 </B> </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% of that in the original. <P> 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. <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 (this may surprise you if you have used the optional <I>Start</I> setting). If you want the included file to start somewhere besides the start of the current bar you can use a B<SMALL>EATADJUST</SMALL> before the M<SMALL>IDI</SMALL>I<SMALL>NC</SMALL>--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 (other than text and lyric, see above) are ignored. <P> </LI> <LI>If you want to apply different V<SMALL>OLUME</SMALL> 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="SECTION0019100000000000000000"> MIDIMark</A> </H1> <P> You can insert a MIDI Marker event into the Meta track with this command. The mark can be useful in debugging your MIDI output with a sequencer or editor which supports Mark events (most do). <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiMark Label </B> </td></tr> </Table> <P> will insert the text ``Label'' at the current position. You can add an optional negative or positive offset in beats: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MidiMark 2 Label4 </B> </td></tr> </Table> <P> will insert ``Label4'' 2 beats into the next bar. <P> <H1><A NAME="SECTION0019110000000000000000"> MIDIPan</A> </H1> <P> In MIDI-speak ``pan'' is the same as ``balance'' on a stereo. By adjusting the MIDIP<SMALL>AN</SMALL> for a track you can direct the output to the left, right or both speakers. Example: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass MIDIPan 4 </B> </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> MIDIP<SMALL>AN</SMALL> is not saved or restored by G<SMALL>ROOVE</SMALL> commands, nor is it effected by S<SMALL>EQ</SMALL>C<SMALL>LEAR</SMALL>. A MIDIP<SMALL>AN</SMALL> 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 MIDIP<SMALL>AN</SMALL> will be in use until another MIDIP<SMALL>AN</SMALL> is encountered. <P> MIDIP<SMALL>AN</SMALL> 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> MIDIP<SMALL>AN</SMALL> can be used for much cruder purposes. When creating accompaniment tracks for a mythical jazz group, you might set all the bass tracks (Bass, Walk, Bass-1, etc) set to aMIDIP<SMALL>AN</SMALL> 0. Now, when practicing at home you have a ``full band''; and the bass player can practice without the generated bass lines simply by turning off the left speaker. <P> Because most MIDI keyboard do not reset between tunes, there should be a MIDIP<SMALL>AN</SMALL> to undo the effects at the end of the file. Example:<A NAME="tex2html63" HREF="#foot8256"><SUP>19.3</SUP></A> <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Include swing <BR> Groove Swing <BR> Bass MIDIPan 0 <BR> Walk MIDIPan 0 <BR> 1 C <BR> 2 C <BR> ... <BR> 123 C <BR> Bass MIDIPan 64 <BR> Walk MIDIPan 64 </B> </td></tr> </Table> <P> <H1><A NAME="SECTION0019120000000000000000"> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <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="19" ALIGN="BOTTOM" BORDER="0" SRC="img9.png" ALT="$*$"> 4 </B> </td></tr> </Table> <P> The M<SMALL>IDI</SMALL>S<SMALL>EQ</SMALL> command is specific to a track and is saved as part of the G<SMALL>ROOVE</SMALL> definition. This lets style file writers use enhanced MIDI features to dress up their sounds. <P> The command has the following syntax: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>TrackName MidiSeq <Beat> <Controller> <Datum> [ ; ...] </B> </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 the appendix <A HREF="node27.html#sec-controllers">, here,</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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDISeq 1 ReleaseTime 50; 3 ReleaseTime 0 </B> </td></tr> </Table> <P> in this case the commands are applied to beats 1 and 3 in each bar of the sequence. <P> </LI> </OL> <H2><A NAME="SECTION0019121000000000000000">.</A> </H2> <P> As a set of names predefined in an MIDID<SMALL>EF</SMALL> command: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDIdef Rel1 1 ReleaseTime 50; 3 ReleaseTime 0 <BR> MIDIdef Rel2 2 ReleaseTime 50; 4 ReleaseTime 0 <BR> MIDISeq Rel1 Rel2 </B> </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> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDISeq { 1 ReleaseTime 50; 3 ReleaseTime 0 } \ <BR> { 2 ReleaseTime 50; 4 ReleaseTime 0 } </B> </td></tr> </Table> <P> Finally, you can combine the above into different combinations. For example: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDIDef Rel1 1 ReleaseTime 50 <BR> MIDIDef Rel2 2 ReleaseTime 50 <BR> MIDISeq { Rel1; 3 ReleaseTime 0 } { Rel2; 4 ReleaseTime 0 } </B> </td></tr> </Table> <P> <P> You can have specify different messages for different beats (or different messages/controllers for the same beat) by listing them on the same M<SMALL>IDI</SMALL>S<SMALL>EQ</SMALL> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass-Dumb MIDISeq 1 ReleaseTime 20 z / FOOBAR </B> </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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass-2 MidiSeq - // disable controllers </B> </td></tr> </Table> <P> <H1><A NAME="SECTION0019130000000000000000"> MIDISplit</A> </H1> <P> For certain post-processing effects it is convenient to have each different drum tone in a separate MIDI track. This makes it easier to apply an effect to, for example, the snare drum. Just to make this a bit more fun you can split any track created by <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> . <P> To use this feature: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDISplit <list of channels> </B> </td></tr> </Table> <P> So, to split out just the drum channel<A NAME="tex2html64" HREF="#foot8207"><SUP>19.4</SUP></A> you would have the command: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>MIDISplit 10 </B> </td></tr> </Table> <P> somewhere in your song file. <P> When processing <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> creates an internal list of MIDI note-on events for each tone or pitch in the track. It then creates a separate MIDI track for each list. Any other events are written to another track. <P> <H1><A NAME="SECTION0019140000000000000000"> MIDITname</A> </H1> <P> When creating a MIDI track, <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> inserts a MIDI Track Name event at the start of the track. By default, this name is the same as the associated <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> track name. You can change this by issuing the MIDI<SMALL>T</SMALL>N<SMALL>AME</SMALL> command. For example, to change the C<SMALL>HORD</SMALL> track name you might do something like: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Chord MidiTname Piano </B> </td></tr> </Table> <P> Please note that this <I>only</I> effects the tracks in the generated MIDI file. You still refer to the track in your file as C<SMALL>HORD</SMALL>. <P> <H1><A NAME="SECTION0019150000000000000000"> MIDIVoice</A> </H1> <P> Similar to the MIDIS<SMALL>EQ</SMALL> command discussed in the previous section, the MIDIV<SMALL>OICE</SMALL> command is used to insert MIDI controller messages into your files. Instead of sending the data for each bar as MIDIS<SMALL>EQ</SMALL> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <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="19" ALIGN="BOTTOM" BORDER="0" SRC="img9.png" ALT="$*$"> 4 </B> </td></tr> </Table> <P> should give an interesting effect. <P> The syntax for the command is: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Track MIDIVoice <beat> <controller> <Datum> [; ...] </B> </td></tr> </Table> <P> This syntax is identical to that discussed in the section for MIDIS<SMALL>EQ</SMALL>, above. The <beat>value is required for the command--it determines if the data is sent before or after the V<SMALL>OICE</SMALL> command is sent. Some controllers are reset by a voice, others not. My experiments show that B<SMALL>ANK</SMALL> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Voice Piano1 <BR> MidiVoice {0 Bank 5; 1 ReleaseTime 100} </B> </td></tr> </Table> <P> the MIDI data is created in an order 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 <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 V<SMALL>OICE</SMALL> for each bar). In this case, group the different data groups with {} brackets: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Bass-1 MIDIVoice {1 ReleaseTime 50} {1 ReleaseTime 20} </B> </td></tr> </Table> <P> This list is stored with other G<SMALL>ROOVE</SMALL> 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 Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Track MIDIVoice - // disable </B> </td></tr> </Table> <P> Some technical notes: <P> <UL> <LI> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> 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 MIDIC<SMALL>LEAR</SMALL> command (<A HREF="#sec-midiclear">(details)</A>) to ``undo'' anything you've done via a MIDIV<SMALL>OICE</SMALL> command. <P> </LI> </UL> <P> <H1><A NAME="SECTION0019160000000000000000"></A> <A NAME="channelvol"></A> <BR> MIDIVolume </H1> <P> MIDI devices equipped with mixer settings can make use of the ``Channel'' or ``Master'' volume settings.<A NAME="tex2html65" HREF="#foot8245"><SUP>19.5</SUP></A> <P> <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> doesn't set any channel volumes without your knowledge. If you want to use a set of reasonable defaults, look at the file <TT><B>includes/init.mma</B></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 selected MIDIV<SMALL>OLUME</SMALL>s: <P> <Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3> <tr><td> <B>Chord MIDIVolume 55 </B> </td></tr> </Table> <P> will set 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> Caution: If you use the command with A<SMALL>LL</SMALL>T<SMALL>RACKS</SMALL> you should note that only existing <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> tracks will be effected. <P> <BR><HR><H4>Footnotes</H4> <DL> <DT><A NAME="foot8253">... track:</A><A HREF="node19.html#tex2html61"><SUP>19.1</SUP></A></DT> <DD>This is much easier to do with the KeySig command, <A HREF="node10.html#keysig">here</A> </DD> <DT><A NAME="foot8115">... portamento</A><A HREF="node19.html#tex2html62"><SUP>19.2</SUP></A></DT> <DD>The name ``Glis'' is used because ``MIDIPortamento'' gets to be a bit long to type and ``MIDIPort'' might be interpreted as something to do with ``ports''. </DD> <DT><A NAME="foot8256">... Example:</A><A HREF="node19.html#tex2html63"><SUP>19.3</SUP></A></DT> <DD>This is much easier to do with the MMAStart and MMAEnd options <A HREF="node24.html#sec-paths">(details)</A>. </DD> <DT><A NAME="foot8207">... channel</A><A HREF="node19.html#tex2html64"><SUP>19.4</SUP></A></DT> <DD>In <FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> this will always be channel 10. </DD> <DT><A NAME="foot8245">... settings.</A><A HREF="node19.html#tex2html65"><SUP>19.5</SUP></A></DT> <DD>I discovered this on my 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, I'd end up scratching my head. </DD> </DL><HR> <!--Navigation Panel--> <A NAME="tex2html608" HREF="node20.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html606" HREF="mma.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html600" HREF="node18.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <BR> <B> Next:</B> <A NAME="tex2html609" HREF="node20.html">Fine Tuning (Translations)</A> <B> Up:</B> <A NAME="tex2html607" HREF="mma.html">Reference Manual</A> <B> Previous:</B> <A NAME="tex2html601" HREF="node18.html">Variables, Conditionals and Jumps</A> <!--End of Navigation Panel--> <ADDRESS> bob 2007-03-07 </ADDRESS> </BODY> </HTML>