Notes, rest, wait and key-off

While it's easy to be put off by the apparent complexity of the Music Markup Language, writing MML files is easier than it looks, as the Language uses standard music notation as its basis.

# Notes : <note><accidental(s)><len>

<note> (c, b, d, e, f, g, a or b)
The note of the scale you'd like to play.

<accidental(s)> (+ or -)
+ acts like a sharp, i.e. raise the note by a semitone.
- acts like a flat, i.e. lower the note by a semitone.

Accidentals are optional, and you can chain sharps/flats indefinitely.

<len> (1 — INT_MAX)
Standard note length. Optional.

# Rest : r<len>

<len> (1 — INT_MAX)
Standard note length. Optional.

This will silence the channel immediately, it is therefore not like the key-off command k<len>. If used on the E channel (the DPCM track), it will be silenced too if the #DPCM-RESTSTOP option is used; otherwise it will do nothing, and act as a w<len>.

# Wait : w<len>

<len> (1 — INT_MAX)
Standard note length. Optional.

Similar to the r<len> command, in that it tells the compiler to advance through the track by <len>; however, w<len> does not change the state of the track. It is like a rest but does not necessarily introduce silence.

# Key-off : k<len>

<len> (1 — INT_MAX)
Standard note length. Optional.

This tells that the note has ended1. It could be thought as a ordinary rest, but when used on a track with active release commands (@vr<num> and potentially @@r<num> macro calls) the difference is perceptible. The current note enters its release part of the sound.

# Direct notation : n<num>,<len>

<num> (-INT_MAXINT_MAX)
Note number.

<len> (1 — INT_MAX)
Standard note length. Optional.

Direct notation is an alternate way to the notes of the scale to write music. It is best used on the Noise and DPCM channels, since those two are percussive channels.

The noise channel has a limited amount of notes it can play (16, to be precise). These range between n-16 and n15 (or nx-f and nxf in hex). n16 (or nx10) causes the channel to loop back to n0.
Note that the noise channel will play periodic noise if negative values are used. The more negative the value, the higher the pitch. This loops back to n-1 at n-17.
As for the DPCM channel, the sample number in the @DPCM<num> macro definition corresponds to the note number in Direct Notation, meaning @DPCM0 corresponds to n0, @DPCM1 corresponds to n1 and so on.

Therefore, as you can see, Direct Notation makes those two channels much more readable.

# “Super direct notation” : @n<num>,<len>

<num> (0x0008 $<$ num $\leq$ 0x07f2)
Value to write to the frequency register
directly.

<len> (1 — INT_MAX)
Standard note length. Optional.

Super Direct Notation is an even more accurate but complicated system, where you write directly to the frequency register. Oddly, this command cannot be used with the NAMCO163 or the VRC-VII.

# “Data thru” : x<num>,<len>

<num> (-INT_MAXINT_MAX)
Note number.

<len> (1 — INT_MAX)
Length
in frames.

This is another specific command where you specify a note number and a duration in frames for your note. It could be useful for sound effects, but obviously the timing of the entire track ahead is quite involved, so use with caution.

NOTE: there is not a more “direct” notation than the @n<num>,<num> and the x<num>,<num>, that is, there isn't a “ultra direct notation” with a direct register write (as in @n<num>,<num> macro) with a duration specified in frames (as in this macro).

page revision: 31, last edited: 23 May 2014 16:52