next up previous
Next: Tracks and Channels Up: Reference Manual Previous: Overview and Introduction

Subsections


Running MMA

MMA is a command line program. To run it, simply type the program name followed by the required options. For example,

$ mma test

processes the file test2.1 and creates the MIDI file test.mid.

Command Line Options

The following command line options are available:

Option Description
Debugging and other aids to figuring out what's going on.
-v Show program's version number and exit.
-d Enable LOTS of debugging messages. This option is mainly designed for program development and may not be useful to users.2.2
-o A debug subset. This option forces the display of complete filenames/paths as they are opened for reading. This can be quite helpful in determining which library files are being used.
-p Display patterns as they are defined. The result of this output is not exactly a duplicate of your original definitions. Most notable are that the note duration is listed in MIDI ticks, and symbolic drum note names are listed with their numeric equivalents.
-s Display sequence info during run. This shows the expanded lists used in sequences. Useful if you have used sequences shorter (or longer) than the current sequence length.
-r Display running progress. The bar numbers are displayed as they are created complete with the original input line. Don't be confused by multiple listing of ``*'' lines. For example the line
33 Cm * 2
would be displayed as:

88: 33 Cm *2
89: 33 Cm *2

This makes perfect sense if you remember that the same line was used to create both bars 88 and 89.

-e Show parsed/expanded lines. Since MMA does some internal fiddling with input lines, you may find this option useful in finding mismatched BEGIN blocks, etc.
-c Display the tracks allocated and the MIDI channel assignments after processing the input file. No output is generated.
Commands which modify MMA 's behaviour.
-S Set a macro. If a value is needed, join the value to the name with a '='. For example:

$ mma myfile -S tempo=120

will process the file myfile.mma with the variable $Tempo set with the value ``120''. You need not specify a value:

$ mma myfile -S test

just sets the variable $test with no value.

-n Disable generation of MIDI output. This is useful for doing a test run or to check for syntax errors in your script.
-mBARS Set the maximum number of bars which can be generated. The default setting is 500 bars (a long song!2.3). This setting is needed since you can create infinite loops by improper use of the GOTO command. If your song really is longer than 500 bars use this option to increase the permitted size.
-Mx Generate type 0 or 1 MIDI files. The parameter ``x'' must be set to the single digit ``0'' or ''1''. For more details, see the MIDISMF section here.
-0 Generate a syncronization tick at the start of every MIDI track. This is a one tick note on/off event at offset 0. It can be useful in multi-track syncronization.
Maintaining MMA 's database.

-g

Update the library database for the files in the LIBPATH. You should run this command after installing new library files or adding a new groove to an existing library file. If the database (stored in the files in each library under the name .mmaDB) is not updated, MMA will not be able to auto-load an unknown groove. Please refer to the detailed discussion here for details.


The current installation of MMA does not set directory permissions. It simply copies whatever is in the distribution. If you have trouble using this option, you will probably have to reset the permissions on the lib directory.


MMA will update the groove database with all files in the current LIBPATH. All files must have a ``.mma'' extension. Any directory containing a file named MMAIGNORE will be ignored. Note, that MMAIGNORE consists of all uppercase letters and is usually an empty file.

-G Same as the ``-g'' option (above), but the uppercase version forces the creation of a new database file--an update from scratch just in case something really goes wrong.
File commands.

-i

Specify the RC file to use. See details here.

-fFILE

Set output to FILE. Normally the output is sent to a file with the name of the input file with the extension ``.mid'' appended to it. This option lets you set the output MIDI file to any filename.
The following commands are used to create the documentation. As a user you should probably never have a need for any of them.
-Dk Print list of MMA keywords. For editor extension writers.
-Dxl Expand and print DOC commands used to generate the standard library reference for Latex processing. No MIDI output is generated when this command is given. Doc strings in RC files are not processed. Files included in other files are processed.
-Dxh Same as -Dxl, but generates HTML output. Used by the mklibdoc.py tool.

Lines and Spaces

When MMA reads a file it processes the lines in various places. The first reading strips out blank lines and comments of the ``//'' type.

On the initial pass though the file any continuation lines are joined. A continuation line is any line ending with a single `` \''--simply, the next line is concatenated to the current line to create a longer line.

Unless otherwise noted in this manual, the various parts of a line are delimited from each other by runs of whitespace. Whitespace can be tab characters or spaces. Other characters may work, but that is not recommended, and is really determined by Python's definitions.

Programming Comments

MMA is designed to read and write files; it is not a filter.2.4

As noted earlier in this manual, MMA has been written entirely in Python.There were some initial concerns about the speed of a ``scripting language'' when the project was started, but Python's speed appears to be entirely acceptable. On an AMD Athlon 1900+ system running Mandrake Linux 10.1, most of songs compile to MIDI in well under one second. If you need faster results, you're welcome to recode this program into C or C++, but it would be cheaper to buy a faster system, or spend a bit of time tweaking some of the more time intensive Python loops.

I've done a bit of testing with Psyco http://psyco.sourceforge.net/ and have found speed increases in the order of 15% to 20%. Output seems fine, so use it if speed is important to you.



Footnotes

...test2.1
Actually, the file test or test.mma is processed. Please read section file extensions.
... users.2.2
A number of the debugging commands can also be set dynamically in a song. See the debug section here for details.
... song!2.3
500 bars with 4 beats per bar at 200 BPM is about 10 minutes.
... filter.2.4
A filter mode could be added to MMA , but I'm not sure why this would be needed).

next up previous
Next: Tracks and Channels Up: Reference Manual Previous: Overview and Introduction
bob 2007-03-07