At any given time, Mondrian has a current state consisting of several properties, many of which are familiar MIDI values. The user-accessible properties are listed in the table below. In addition, Mondrian has an internal state that keeps track of timing and such.
If a sequence of commands is enclosed in parentheses (), then any state changes inside the parentheses are local to the contents of the parentheses, i.e., after the closing parenthesis the state reverts to what it was at the opening parenthesis.
| Property | Admissible values | Default |
| note | 0..127 | 60 |
| velocity | 0..127 | 64 |
| off velocity | 0..127 | 64 |
| controller | 0..127 | 0 |
| channel | 0..15 | 0 |
| track | 1..256 (upper bound can be changed) | 1 |
| scale | ascending list of integers between 0 and 11 | 0 2 4 5 7 9 11 (major scale) |
| gap | note length | None |
| time shift | very small integer | 0 |
| offset | note length | None |
| xp, xq | positive integers | 1 |
Notes on some properties:
Generally speaking, Mondrian commands are words or characters that may be preceded by a number n, such as 160T, or 3+.
| Command | Behavior with number n | Behavior without number |
| a | aftertouch event for current key with velocity n | aftertouch event with current velocity |
| b | pitch bend event with value n | pitch bend 0 |
| B | pitch bend event with value -n | pitch bend 0 |
| c | set current channel to n | no action |
| C | set current controller to n | no action |
| d | increase time shift by n | set time shift to 0 |
| D | decrease time shift by n | set time shift to 0 |
| n | set current note to n | no action |
| o | set off velocity to n | no action |
| p | channel pressure event with value n | channel pressure with current velocity |
| P | program change event with value n | no action |
| R | set resolution (MIDI ticks per quarter, 24..960) | no action |
| s | show current state as well as n | show current state |
| t | set current track to n | no action |
| T | set tempo to n bpm (1..600) | no action |
| v | set current velocity to n | no action |
| V | send control change event for current controller, value n | no action |
| w | set current offset to n | set offset to None |
| > | move up n steps in scale | move up one step in scale |
| < | move down n steps in scale | move down one step in scale |
| + | move up n half steps | move up one half step |
| - | move down n half steps | move down one half step |
| / | increase velocity by n | increase velocity by 16 |
| \ | decrease velocity by n | decrease velocity by 16 |
Since the resolution of MIDI files cannot be changed once it has been set, the resolution command R must not occur more than once. Moreover, it must occur before the first note event; if the first note event occurs before the resolution has been set, then Mondrian chooses a default resolution of 96 ticks per quarter.
Note events are triggered by numbers that are not followed by any of the commands listed here, i.e., a note event is a number followed by any of the following: space, tab, newline, #, |, (, ), [, ], !, $, ", even EOF. In other words, note events are the default, which improves keystroke efficiency.
The number n defines the duration of a note in the following way: If n consists of just one digit, then the duration is 2^-n, e.g., 0 means a whole note, 1 a half note, 2 a quarter note, etc. If n consists of more than one digit, then the last digit serves as an exponent, and the rest as a multiplier. For instance, 54 means 5*2^-4=5/16, 33 means 3*2^-3=3/8, 172 means 17*2^-2=17/4, etc.
| Command | Behavior with number n | Behavior without number |
| g | set gap to duration defined by n | set gap to 0 |
| h | play note of duration defined by n, but do not advance time | hold note until explicitly turned off |
| N | send note off event for note n | send note off event for current note |
| r | rest of duration defined by n | no action |
When Mondrian encounters a note event, it schedules the event at the current time and advances the current time by the duration of the note, so that note events are played consecutively. Brackets [] and vertical bars | are used to stack such lines on top of each other and play them simultaneously. Specifically, when Mondrian encounters an opening bracket, it saves the current time t0. When it encounters a vertical bar, it resets the current time to t0. When it encounters a closing bracket, it advances the current time to t0 plus the duration of the longest line enclosed by the brackets.
This construction can be repeated indefinitely, i.e., you can stack up lines, align stacks and notes in sequences, then form stacks of such compound sequences, etc.
Macros are defined by enclosing the contents of the macro in exclamation marks, followed by a word (a word starts with a letter or an underscore ("_"); the rest of the word may contain letters, digits, and the characters "_-+=;:.,~@"). For instance, !127v!fff will define a new macro called fff, and calling it will set the current velocity to 127 (fortissimo). If a number n precedes the label of the macro, then the macro is called n times. Macros can contain anything except macro definitions.
"scales.mon" would include the file scales.mon.
If the MONDRIANPATH environment variable is set, then it
will be interpreted as a search path for include files.Adding pitch bend to notes is similar to building chords. For instance, in order to play a whole note, pitch bend up after one eighth, then return to normal pitch after another five eights, we can write [0|3r 40B 53r B].