MewMMLPad

Learn from Sample Tunes — understand MML features by example

🌐 日本語

This page reads through real MML pieces, one at a time, and explains which commands produce which effects. For the spec of each command on its own, see the MML Reference.

Ubiquitous Letters

A demo piece by mewlist. It uses 8 channels (A–H), interleaving bass, lead, pad, and arpeggio. Source: Gist

Full text

# Ubiquitous Letters - mewlist
A T135

ABCDEFGH {=*} PC $glissando=32 $BendRange=2

A L16 Q1 PL64 $Accent=On V100 v60
B L16 Q8 LV12 $accent=on V60  v30
C L16 Q8 LV12 $accent=on V50  v30
D L1  Q8                 V127 
E L1  Q8                 V100
F L1  Q8                 V64
G L1  Q8                 V32  K7
H L16 Q1                 V127 PR64 

% SeqA !Xxrx ) rxXx ) rrXr ) rxXr ( Xxrx ( rxXx ( rxxr rXxr

A o3 [C ^g >d E <E ^b >g  D<]4
A o3 [C ^g >d E <E ^b >g  D<]4
A o3 [C-^g >d E <E ^b >a  G<]4
A o3 [C-^g >d E <E ^b >g- D<]4
B o5 !X{D}  [%SeqA]4
C o5 !X{E}  [%SeqA]2
C o5 !X{G}  [%SeqA]1
C o5 !X{G-} [%SeqA]1
D o2 a1+1  x_4>c1+1 <b1+1  x_4>d1+1
E o3 e1+1  x_4 g1+1  g1+1  x_4 a1+1
F o4 <a2  x_4>c1+1  x_4e1+1  d1+1 ~ f#&x2
G o4 <a2  x_4>c1+1  x_4e1+1  d1+1 ~ g&x2
H o4 [ v100 [ {g^>cef#gb<}2   (50 ]2 r1 ]2
H o4 [ v100 [ {d^g>df#a>d<<}2 (50 ]2 r1 ]2

Let’s read through it from the top.

Line 1: comment

# Ubiquitous Letters - mewlist

Lines that start with # are ignored. Useful for the title or author. Comments after ; work the same way.

Tempo

A T135

Channel A sets T135 — tempo 135 BPM. T moves the BPM slider for standalone playback. It is ignored inside a DAW, where the DAW’s tempo wins.

Common initialization across all channels

ABCDEFGH {=*} PC $glissando=32 $BendRange=2

This is the key idea: concatenating channel letters applies the same commands to all of them. Anything following ABCDEFGH (with a space) takes effect on channels A through H.

Token What it does
{=*} Reset all key signatures (treat as C major)
PC Set pan to center
$glissando=32 Default glissando step is 1/32
$BendRange=2 Pitch-bend range is 2 semitones

Per-channel initial settings

A L16 Q1 PL64 $Accent=On V100 v60
B L16 Q8 LV12 $accent=on V60  v30
C L16 Q8 LV12 $accent=on V50  v30
D L1  Q8                 V127 
E L1  Q8                 V100
F L1  Q8                 V64
G L1  Q8                 V32  K7
H L16 Q1                 V127 PR64 

Each channel sets its “default length / gate / pan / velocity” in one line.

Command Effect
L16 Default length = sixteenth note
L1 Default length = whole note (for long tones)
Q1 Shortest gate (staccato, 1/8)
Q8 Longest gate (full gate)
PL64 Pan 64 left
PR64 Pan 64 right
$Accent=On Turn on Accent mode → uppercase uses V, lowercase uses v velocity
V100 v60 Accent 100, non-accent 60
LV12 Step size for ( and ) velocity nudges set to 12 (default 8)
K7 Raise the key by 7 semitones (only on channel G)

A few places use lowercase $accent=on; the value is interpreted the same way.

Alias (macro) definition

% SeqA !Xxrx ) rxXx ) rrXr ) rxXr ( Xxrx ( rxXx ( rxxr rXxr

Lines starting with % are alias (macro) definitions. SeqA packs a 16-note rhythm pattern under one name.

Breaking the body down:

Token Meaning
!X Expand the variable X (each channel later sets a different note for X)
x Re-trigger the previous pitch (lowercase = non-accent side)
X Same re-trigger (uppercase = accent side)
r Rest (lowercase)
) Raise velocity by LV (here 12)
( Lower velocity by LV

So the pattern alternates “X / x / r” while pushing velocity ) ) ) ( ( ( — a crescendo into a decrescendo across the same rhythm.

Channel A: main melody + slurs

A o3 [C ^g >d E <E ^b >g  D<]4
A o3 [C ^g >d E <E ^b >g  D<]4
A o3 [C-^g >d E <E ^b >a  G<]4
A o3 [C-^g >d E <E ^b >g- D<]4
  • o3 sets the starting octave to 3 (lowercase o also works).
  • [ ... ]4 repeats four times.
  • ^ is slur: C ^g means “play C, then go to g without re-attacking”.
  • > and < raise/lower the octave per note.
  • C- is C♭ (flat). The - goes after the note name (e.g. g- is g♭).
  • Lining up four similar lines with small variations gives subtle motion within a longer phrase.

Channels B, C: rhythmic parts using variables and macros

B o5 !X{D}  [%SeqA]4
C o5 !X{E}  [%SeqA]2
C o5 !X{G}  [%SeqA]1
C o5 !X{G-} [%SeqA]1
Token Meaning
!X{D} Assign D to variable X (inline definition)
%SeqA Expand the alias defined earlier
[%SeqA]4 Repeat SeqA four times

This expands !X inside SeqA to that channel’s note name (D / E / G / G♭). Variables are per-channel, so X on B and X on C are independent.

Channel C cycles [%SeqA]2[%SeqA]1[%SeqA]1, swapping the variable between EGG♭ to vary the phrase across four rounds.

Channels D, E: long tones + pitch bend

D o2 a1+1  x_4>c1+1 <b1+1  x_4>d1+1
E o3 e1+1  x_4 g1+1  g1+1  x_4 a1+1

New tokens here:

Token Meaning
a1+1 Length 1+1 = whole + whole (a 2-bar long tone)
x Re-trigger the previous pitch
x_4>c1+1 Bend starting from x → reach >c1+1 over a quarter-note’s time (overall length 1+1)

So it alternates “hold for 2 bars → bend into the next note → hold for 2 bars” — a bass-line shape.

The pitch-bend syntax is source(delay) _ (transition) target(total_length):

  • x = source (re-trigger previous pitch)
  • _4 = delay = quarter note (you can also read it as “spend the remaining time bending”)
  • >c1+1 = target

For the full syntax, see the pitch bend section of the MML Reference.

Channels F, G: pads with glissando

F o4 <a2  x_4>c1+1  x_4e1+1  d1+1 ~ f#&x2
G o4 <a2  x_4>c1+1  x_4e1+1  d1+1 ~ g&x2

New symbols:

Token Meaning
~ Glissando. d1+1 ~ f#&x2 plays d for two whole notes then glissandos up to f#.
& Tie. f#&x2 ties f# to the next x (with $TieMode=Slur, no re-attack).
f# Same as f+ (F sharp).

Channel G had K7 set at the start, so the notes you read are shifted up 7 semitones. F and G share the same melodic shape, but F is in the original key and G stacks a perfect fifth above — they overlap deliberately.

Channel H: fast arpeggios with tuplets

H o4 [ v100 [ {g^>cef#gb<}2   (50 ]2 r1 ]2
H o4 [ v100 [ {d^g>df#a>d<<}2 (50 ]2 r1 ]2

The key idea here is the tuplet { }.

Token Meaning
{g^>cef#gb<}2 Pack all the inner notes into the length of a half note.
g^>c Slur g into >c (inside a tuplet, ^ and & still work).
> < Octave changes inside a tuplet persist outside { } too.
(50 Subtract 50 from velocity (a one-shot strong drop).
r1 Whole-note rest.

The outer [ ... ]2 double loop runs “arpeggio ×2 → decrescendo → whole rest” twice. Writing a slightly different second line on the same pattern gives you A-section / B-section style alternation.


Quick reference of features used here

If you’ve followed along, you have hands-on exposure to the following commands. For the full spec, see the MML Reference.

Structural

  • Multi-channel writing (ABCDEFGH ...)
  • Repeat [...]N, nestable
  • Alias % Name body, expand with %Name
  • Variable !X{value} inline, expand with !X (per-channel)

Pitch and length

  • Octave: On / < / >
  • Accidentals: C+ C# C- C=
  • Length arithmetic: 1+1, 4-32, etc.
  • Re-trigger same pitch: X / x (accent-aware)
  • Rest: R / r

Expression

  • Slur ^ — connect at full gate
  • Tie & — behavior set by $TieMode
  • Pitch bend _ — flexible source / transition / total length
  • Glissando ~ — chromatic interpolation
  • Tuplet {...}N

Settings

  • Default length L, gate Q, pan P / PL / PR / PC
  • Key shift K, key signature {=*} {+f} {-eab}
  • Accent $Accent=On + uppercase / lowercase V / v
  • Nudge step LV (= lv), ( ) to nudge
  • Bend range $BendRange
  • Default glissando $glissando

Next steps

Once you’ve copied the sample and gotten it running, try these:

  • Change the tempo: turn T135 into T90 or T180.
  • Change the tone: open Settings in the header and pick a different waveform and ADSR per channel.
  • Change the key: shift K7 to K3 or K-5 and listen to the difference.
  • Rewrite the macro: change the body of % SeqA ... to alter the rhythm of all four channels at once.

Once you’re comfortable, start by building your own short macros and variables to make rhythm patterns — that’s the path to writing structured MML.