I recently noticed that I can't map the F4 function in emacs on my Mac. I had to shift my key mappings up by one, e.g., what used to be F4 is now F5. This page documents the current mappings.
python mondrian.py [-s] [-o output.mid] [input.mon ...]
If you haven't patched the Python Midi Package, then Mondrian cannot
write to stdout, so that you will always have to specify an output file.
The -s switch runs Mondrian in strict mode, i.e., the slightest
irregularity will cause Mondrian to quit with an exception. By default,
Mondrian will try to recover from exceptions whenever this is reasonable.
If you have patched Python Midi, then you can use Mondrian in pipes, like this:
python mondrian.py fj.mon | timidity -In order to translate MIDI files to Mondrian code, say
python demondrian.py [-c] [-q n] [-v m] [-o out.mon] [file.mid]
The -c switch enables the compression feature, which tries to
extract macros by detecting regularities of the MIDI file (warning: the
compression feature is still somewhat experimental and may take a long time
to finish). The -q and -v options enable
quantization; -q n rounds note lengths to the closest multiple
of 2^-n, and -v m rounds velocities to the closest multiple of
m.
In theory, the compression feature may be used to mine MIDI files for recurring pieces, such as drum patterns and bass lines; just feed in a MIDI file and see whether any large macros emerge. In practice, though, the compression feature seems to extract macros all over the place, and it's not always clear how to identify the pertinent ones.
The basic idea is that MondrianLive keeps a queue of chunks of music (a chunk might be anything; a note, a measure, an entire song, etc.) that are played in sequence. Whenever the user adds a new chunk, it is added to this queue and will be played after all previous chunks have been played. When MondrianLive reaches the end of this queue, it keeps repeating the last chunk, unless the last chunk is empty, in which case playback will be paused until the next nonempty chunk arrives.
If you have installed the vim plugin, then vim will load it and launch
the MondrianLive sequencer when you open a file with a .mon
extension. When you press F6, MondrianLive will list all devices
that currently accept MIDI input as well as the current contents of the queue.
You can connect the output port(s) of MondrianLive to those devices with tools
like aconnect, or with the map command (see below).
If you press F5, vim sends the current line into MondrianLive, which will interpret it and append it to its queue of chunks of music. If you mark a range of lines (e.g., using vim's visual mode) and press F5, then the entire range will be sent to MondrianLive.
F7 will pause or continue playback, and F8 will stop MondrianLive and clear all current chunks. Playback will start again when you send in a new chunk of code. Of course, MondrianLive will terminate when you leave vim.
The emacs plugin will be loaded when you open a file with a
.mon extension. It behaves much like the vim plugin,
with two small differences. First, every time you press one of the
special function keys, emacs will switch to a buffer that captures the
output of MondrianLive, and you need to press the function key again
in order to get back to your original buffer.
Second, when you press F5, the range of lines defined by the point and the mark is sent to MondrianLive, unless the mark hasn't been set yet, in which case the current line is sent to MondrianLive. (For instance, if you highlight a region with the mouse and press F5, then all the lines intersecting this region will be sent to MondrianLive, so that you don't have too aim too carefully; it's okay if the first and last lines aren't entirely selected)
In order to use MondrianLive outside of vim, launch the interactive Mondrian sequencer by typing
python mondrianlive.py/tmp/mondrianlive.pipe, and you can send code
into MondrianLive by writing to this file. In order to terminate MondrianLive,
just send it a single line containing a dot.
MondrianLive interprets lines of the form
## command parameters## map timidity 0 400 2 will map track 2 to
port 0 of timidity, with a latency of 400ms. The command
## map 129 will make port 0 of client 129 the default target,
with latency 0.
## record 3 16 will limit note lengths to multiples of
eighth notes (since 2^-3=1/8) and velocities to multiples of 16.## write spam.mon
will write the current session to spam.mon. The transcript
indicates how many times each loop has been played, so that you can
reconstruct the entire performance from this file.The basic behavior of MondrianPM is the same as that of MondrianLive.
When you open a file with a .mpm extension, vim will load
the MondrianPM plugin and launch the MondrianPM sequencer. If you press
F6, the plugin will print the list of devices currently
accepting MIDI input as well as the current contents of the queue.
Press F5 in order to send the current line or range to
MondrianPM. The contents of this line or range will be repeated until
you send in the next chunk; sending it a single empty line will pause the
sequencer once it is done playing the chunks that came before.
F7 will pause or continue playback, and F8 will stop MondrianPM and clear all current chunks. Playback will start again when you send in a new chunk of code. Of course, MondrianPM will terminate when you leave vim.
The emacs plugin for MondrainPM behaves much like the vim plugin.
It, too, will be loaded when you open a file with a .mpm
extension. In addition, the comments regarding the emacs plugin for
MondrianLive apply.
If you want to use MondrianPM outside of vim or emacs, just say
python mondrianpm.py and write Mondrian code to the file
/tmp/mondrianpm.pipe.
Like MondrianLive commands, MondrianPM commands are of the form
## command parameters.
## map timidity_port_0
will make the device called 'TiMidity port 0' the default device.