日本語English

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

CommandFormatDescription
TT120Changes tempo to the given value (decimal point ignored).
RR1 R4.A rest (elapsed time). A number is the note length (2 = half note), . adds a dot, 6/12/24 for triplets.
JJA 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.

CommandFormatDescription
C D E F G A BC4The notes of the scale (do re mi fa so la ti).
RR4A 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-4Raises 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.
OO4Sets the octave; applies to every following note.
>>Drops the octave by one (applies going forward).
<<Raises the octave by one (applies going forward).
LL4Sets 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).
QQ2Sets 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.
VV100Sets velocity (64 if the number is omitted). Applies going forward.
PP-7Changes pan within the part, on the same -16(left)-16(right) scale as [partSetting].
@@2Switches the voice ID; applies to every following note.
&C1&C1&C1Ties 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 :|*2Pattern repeat. The commands between |: and :| repeat *n times (once if *n is omitted). Any other command may appear inside the enclosure.
## commentA 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]
RuleDescription
When it firesThe portamento begins right as the second note is triggered.
LengthA 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 noteA staccato (Q) setting on the first note is overridden so the portamento can actually take place.
A rest in betweenIf a rest sits between the two notes, the portamento is disabled.
Single note ↔ chordNeither single-note-to-chord nor chord-to-single-note supports portamento.
Chord → chordSupported. 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 partsFM 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.

NotationMeaningIntervalBend length
_/notePitch bend up at note-on (starts lower, bends up to the written note)after _ (1 = semitone, 2 = whole tone, ...)after /
_\notePitch 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]
RuleDescription
Omitted interval / bend lengthDefaults: interval = 1 (a semitone), bend length = 50% of the target note's own length.
Combined with staccatoIf the target note has a staccato setting, the bend length is shortened to match its actual, shortened sounding time.
Applied to chordsA chord may also be pitch-bent.
Supported partsFM 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.

CommandFormatDescription
XXTriggers 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.
RR4A rest.
number (length)X4 X4.Attached after a note/rest to set its length (2 = half note, etc). . adds a dot.
LL4Sets the default note length (4 if omitted).
VV100Sets velocity (64 if omitted). Applies going forward.
Commands not available in a oneShot part: @, [ ] (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.