MML Command Reference
The performance commands written inside a part body ([partN] /
[pcmPartX]). Commands are case-insensitive. Whitespace, tabs, and line breaks may be
used freely (they're stripped during parsing).
Conductor part commands [conductorPart] only
| Command | Format | Description |
|---|---|---|
T | T120 | Changes tempo to the given value (decimal point ignored). |
R | R1 R4. | A rest (elapsed time). A
number is the note length (2 = half note), . adds a dot, 6/12/24 for triplets. |
J | J | A loop jump point (only one is honored per song). |
[conductor]
[conductorPart]
R1 R1 J
T120 R4 T115 R4 T110 R4
T80
[conductorPartEnd]
See the MML File Structure page for the full placement rules.
FM / PCM(long) part common commands
An FM voice part ([partN]) and a PCM voice part with partType: long
([pcmPartX]) share the same command grammar.
| Command | Format | Description |
|---|---|---|
C D E F G A B | C4 | The notes of the scale (do re mi fa so la ti). |
R | R4 | A rest. |
| number (length) | C4 C4. C6 C12 |
Attached after a note/rest to give its length. 2 = half note, 4 = quarter note, etc.
. adds a dot (×1.5 length). 6/12/24 for triplets. |
# + - | C#4 C+4 C-4 | Raises
or lowers the preceding note by a semitone. # and + both mean sharp;
- means flat. |
[ ] | [C4E4G4] | A chord. Only notes and octave
markers may appear inside [/] (other commands are ignored). To mix
different octaves within one chord, prefix each note individually with O. |
O | O4 | Sets the octave; applies to every following note. |
> | > | Drops the octave by one (applies going forward). |
< | < | Raises the octave by one (applies going forward). |
L | L4 | Sets the default note length (4 if the number
is omitted). Any following note/rest with no explicit length uses this one (e.g. L4 CDRE
is equivalent to C4D4R4E4). |
Q | Q2 | Sets the gate time (staccato) as a fraction of the note's length (4 if the number is omitted). 1 = 25%, 2 = 50%, 3 = 75%, 4 = 100%. Applies going forward. |
V | V100 | Sets velocity (64 if the number is omitted). Applies going forward. |
P | P-7 | Changes pan within the part, on the same
-16(left)-16(right) scale as [partSetting]. |
@ | @2 | Switches the voice ID; applies to every following note. |
& | C1&C1&C1 | Ties same-pitch notes together. Only the first note attacks; the sustain lasts the combined length of every tied note. Tying two different pitches together is ignored. |
|: :| | |: L4 C D E :|*2 | Pattern repeat. The commands
between |: and :| repeat *n times (once if *n is
omitted). Any other command may appear inside the enclosure. |
# | # comment | A line whose first non-whitespace
character is # is a comment and is ignored. |
O3 C4D4E4F#4
G8A8B8
O4 C16C#16D16e16 F2R4G8
Portamento (pitch glide) long only
Writing && between two notes glides smoothly (a portamento) from the first
note's pitch to the second's. A note length may follow && to set the glide's
own duration.
L2 C &&4 E
[C E G]
&&
[D F G B]
| Rule | Description |
|---|---|
| When it fires | The portamento begins right as the second note is triggered. |
| Length | A note length may follow, e.g. &&4. If omitted (just
&&), or invalid (e.g. longer than the second note itself), the glide length
defaults to 50% of the second note's own length. |
| Staccato on the first note | A staccato (Q) setting on the first note is
overridden so the portamento can actually take place. |
| A rest in between | If a rest sits between the two notes, the portamento is disabled. |
| Single note ↔ chord | Neither single-note-to-chord nor chord-to-single-note supports portamento. |
| Chord → chord | Supported. The interval between the two chords' lead notes is applied to each corresponding note of the chord (even if the chords differ in size or interval). |
| Supported parts | FM voice parts and PCM voice parts with partType: long
only. Not available on a PCM oneShot part. |
Pitch bend long only
Placing a symbol immediately before or after a note applies a pitch bend at note-on or right before note-off. Pitch changes are simple linear ramps.
| Notation | Meaning | Interval | Bend length |
|---|---|---|---|
_/note | Pitch bend up at note-on (starts lower, bends up to the written note) | after _ (1 = semitone, 2 = whole tone, ...) | after
/ |
_\note | Pitch bend down at note-on (starts higher, bends down to the written note) | after _ | after \ |
note/_ | Pitch bend up at note-off (plays the written note, bends up right before it ends) | after / | after _ |
note\_ | Pitch bend down at note-off (plays the written note, bends down right before it ends) | after \ | after _ |
Examples
# Note-on bend: starts 2 semitones low, bends up to C over a quarter note (whole note is a half note)
L2 _2/4 C2
# Note-off bend: C plays for a quarter note, then bends down over the remaining quarter note
C2\2_4
# Interval and bend length omitted (defaults: 1 semitone, 50% of the note's own length)
L1 _/[C E G]
| Rule | Description |
|---|---|
| Omitted interval / bend length | Defaults: interval = 1 (a semitone), bend length = 50% of the target note's own length. |
| Combined with staccato | If the target note has a staccato setting, the bend length is shortened to match its actual, shortened sounding time. |
| Applied to chords | A chord may also be pitch-bent. |
| Supported parts | FM voice parts and PCM voice parts with partType: long
only. Not available on a PCM oneShot part. |
PCM(oneShot) part commands [pcmPartX] partType: oneShot only
A oneShot voice's command stream is written per assigned note (sample), each wrapped in
{ }. Multiple note blocks may appear within one part.
| Command | Format | Description |
|---|---|---|
X | X | Triggers the sample assigned to this note. Normally plays through to the WAV's own natural end, but if the same sample is triggered again before playback finishes, the earlier hit is stopped in favor of the new one. |
R | R4 | A rest. |
| number (length) | X4 X4. | Attached after a note/rest
to set its length (2 = half note, etc). . adds a dot. |
L | L4 | Sets the default note length (4 if omitted). |
V | V100 | Sets velocity (64 if omitted). Applies going forward. |
@, [ ]
(chords), # + - (accidentals), O/</> (octave
commands), Q (staccato), and P (pan) are all unavailable in a oneShot part
(they're silently ignored if written). These all relate to pitch, but a oneShot "note" instead
selects which sample plays - the two concepts don't compose.C1 {
V100 L4 X R X8 X8 X
X R X8 X8 X
}
E1 {
V100 L4 R X R X
R X R X8 X8 X
}
F#1 {
L8 V70 X V50 X X X V70 X V50 X X X
V70 X V50 X X X V70 X V50 X X X
X
}
In the example above, C1, E1, and F#1 (each
the sample assigned via the PCM voice YAML's voiceSetting) each get their own,
independent rhythm pattern. Note names must match the PCM voice file's
voiceSetting[].note values.