::|CONTENTS
- Command Parameters
- Channel Headers
- Master List
- Compiler Directives
- Compile-Time Macros
- General Commands
- FM Commands
- SSG Commands
- PCM Commands
- Rhythm Commands
- Miscellaneous Commands
- MC.EXE Command Line Arguments
- See Also
This article is basically an English translation of all the commands listed in the PMDMML.MAN manual that comes with the Professional Music Driver distribution.
Command Parameters
Curly braces denote optional parameters; ellipsis denotes one or more parameters.
Any parameter name that does not appear above is an alias for either
number or an arbitrary string depending on the context. Where commas are used to separate command parameters, no whitespace may appear immediately before the comma (expect possibly for the
@ command (3-1)).
number: Any longest string containing only numeral digits and possibly a negative sign. Numbers may be preceded by a
$ symbol to denote hexadecimal numbers.
Unless noted otherwise, the valid range for a number is 0 - 255.
The MML compiler cannot parse hexadecimal numbers larger than $FF.
±number: A number with a mandatory
+ for non-negative values.
Unless noted otherwise, the valid range for a signed number is -128 - 127.
duration: Any of the following:
-
number {
. ...}: A number followed by zero or more dots, representing a usual note value.
-
%number: The number of ticks. The relationship between note values and ticks is established by the
C command (4-11).
The valid range for the ticks representation is 1 - 255. The note value representation must be able to expand to an integer number of ticks between 1 - 255, following the usual definitions of a note value.
identifier: Any longest string not containing any whitespace or newline characters. Identifiers may begin with a number.
note: Any of the following:
c,
d,
e,
f,
g,
a,
b.
sign: Any of the following:
+,
-,
=.
note-event: Any of the following:
-
note{
=}{
sign...}, a note with any number of accidental signs, possibly containing a neutral sign. See the notes at
_{} (4-15) for details of the accidentals.
-
x, which repeats whatever note value was last used in the channel.
-
{note-event shift-specifier note-event}, a portamento from the first note to the second, where
shift-specifier may contain
o commands (4-4), or
<,
> commands (4-5).
op-flag: Any number between 0 and 15 inclusive, which represents all operators whose values sum up to the flag, as a bit-vector:
- Operator 1: 1
- Operator 2: 2
- Operator 3: 4
- Operator 4: 8
-lfo: Either
A, or
B, representing the two software LFOs per channel. It may be omitted, which is then equivalent to
A. This is a suffix; no whitespace should appear between this string and the command preceding it.
-perc: Any of the following:
-
b: Bass kick
-
s: Snare
-
c: Crash cymbal
-
h: Closed hi-hat
-
t: Tom
-
i: Rimshot
As with above this is also a suffix.
PMD supports the following built-in channel headers in YM2608 / OPNA:
- A, B, C, D, E, F (YM2608 FM)
- G, H, I (YM2149F a.k.a. SSG a.k.a. PSG)
- J (PCM / ADPCM depending on current chip)
- K (PMD's internal percussion track, which may use SSG channel 3 or YM2608 rhythm channel)
- Extra headers from splitting the four operators of FM channel 3, declared using
#FM3Extend (2-20)
- Extra headers for the PPZ8 software-mixed PCM channels, declared using
#PPZExtend (2-25)
Channel headers may be cascaded to flush MML commands to multiple channels at the same time, e.g. if OPNA is used then
DEGH specifies that MML commands should be written to FM channels 4 and 5, and PSG channels 1 and 2.
Furthermore, two families of pseudo-channels are permitted:
-
!identifier (3-2)
-
Rnumber (1-2-1)
Except otherwise noted, all MML commands can be used in pseudo-channels as well. Pseudo-channel identifiers cannot be cascaded.
For sound chips other than OPNA, the following channel headers, and only these headers, are available:
- OPN:
ABC (FM),
DEF (default channel 3 expansions),
GHI (SSG),
KR (SSG rhythm)
- OPL:
ABCDEFGHI (FM)
- OPM:
ABCDEFGH (FM),
J (PCM)
- OPN2:
ABCDEF (FM),
JK (PCM)
Master List
Compiler Directives
#ADPCM
#Arranger
#Bendrange
#Composer
#Detune
#DT2Flag
#EnvelopeSpeed
#FFFile
#Filename
#FM3Extend
#Include
#Jump
#LFOSpeed
#LoopDefault
#Memo
#Octave
#Option
#PCMFile
#PPCFile
#PCMVolume
#PPSFile
#PPZExtend
#PPZFile
#Tempo
#Timer
#Title
#Transpose
#Volumedown
#Zenlen
Compile-Time Macros
!
"
&
'?
/
;
<
>
B
C
I
MP
S
W
X
_{}
`
l
l=
l+
l-
l^
o
o+
o-
v
v+
v-
v(
v)
|
|!
General Commands
&
&&
)
(
*
D
DD
DF
DS
DP
DR
DM
F
L
M
MD
MW
MX
Q
T
V
[:]
_
__
_M
m
q
t
y
FM Commands
#
##
#a
#f
#p
#w
#D
@
FB
H
MM
O
P
p
px
s
sd
sdd
sk
w
SSG Commands
@
DX
E
EX
P
w
PCM Commands
@
A
E
EX
p
px
Rhythm Commands
*
@
R
\
\l
\m
\r
\V
\v
Miscellaneous Commands
N
Z
n
~
In the command list itself, all commands are followed by parenthesized section numbers from the PMDMML.MAN manual file.
Compiler Directives
All directives must start from the beginning of a line. Most of these directives and unquoted string parameters are case-insensitive, and will work even if partially spelt out, as long as one unique directive can be identified (e.g.
#ad #ar #b will suffice for the first three listed below). Directive parameters extend to the end of line, usually ignoring any comment markers.
#ADPCM off
#ADPCM on - Default PCM sample mode
((2-23))
1. Default; does nothing. MC.EXE has a bug which renders this identical to
#ADPCM on.
2. Expands to
A (15-10) at the beginning of the PCM channel.
#Arranger string - Arranger metadata
((2-8))
string = Arranger field
#Bendrange x - Default pitch wheel range
((2-15))
Expands to
B x (7-4) at the beginning of FM channel 1.
#Composer string - Composer metadata
((2-7))
string = Composer field
#Detune Normal
#Detune Extend - Default SSG pitch mode
((2-16))
1. Default; does nothing.
2. Expands to
DX1 (7-3) at the beginning of all SSG channels.
#DT2Flag off
#DT2Flag on - Enable DT2 FM parameter
((2-14))
1. Requires all FM patch definitions to omit the DT2 parameters. Where the DT2 parameter is required by the sound chip, the compiler replaces these values with 0.
2. Requires all FM patch definitions to contain values for the DT2 parameter.
#EnvelopeSpeed Normal
#EnvelopeSpeed Extend - Default SSG / PCM envelope speed mode
((2-18))
1. Default; does nothing.
2. Expands to
EX1 (8-2) at the beginning of all SSG channels and the PCM channel.
#FFFile name - Load FM patch bank
((2-4))
Loads all FM patches from a given file during compilation.
name = Name of the patch bank file
#Filename name
#Filename .ext - Output filename
((2-1))
name = Name of the output file
ext = File extension of the output file
#FM3Extend string - FM Channel 3 expansion
((2-20))
Splits the four operators in FM channel 3 into individual channels.
string: Up to three uppercase or lowercase letters, must not be reserved for existing channels
Note: Supported only on OPN or OPNA. The expansion channels default to
DEF on OPN.
#Include name - Include MML file
((2-21))
name = Name of the input MML file
#Jump x - Initial measure setting
((2-24))
x = Number of measures to skip before playing compiled song
Valid range for
x = 0 - 65535
Note: For use on a PC-x801 only; applies to MCH.EXE or MC.EXE with either option /P or /S specified.
#LFOSpeed Normal
#LFOSpeed Extend - Default software LFO speed mode
((2-17))
1. Default; does nothing.
2. Expands to
MXA1 MXB1 (9-5) at the beginning of all channels except the rhythm channel.
#LoopDefault x - Default loop count
((2-13))
If
x = 0 (default): Infinite loop for parameterless
] command (10-1)
If
x = 1-255: Number of loops for parameterless
] command (10-1)
#Memo string - Append memo metadata
((2-9))
string = Single line of memo
#Octave Normal
#Octave Reversed - Default octave shift direction
((2-12))
1. Default; does nothing.
2. Expands to
X (4-6) at the beginning of FM channel 1.
#Option opts... - Compiler option setting
((2-5))
Appends all specified options to MC.EXE / MCH.EXE when the file is compiled.
opts... = Extra compiler options
#PCMFile name
#PPCFile name - Load PCM bank
((2-3))
Specifies a PPC / PVI / PZI / P86 file used by the PCM channel (
J).
name = Name of the sample bank file
#PCMVolume Normal
#PCMVolume Extend - PCM coarse volume mode
((2-19))
1. Default; does nothing.
2. Changes the conversion formula for the
v command (5-1) on the PCM channel.
#PPSFile name - Load SSG percussion PCM bank
((2-2))
Specifies a file created from the MAKEPPS.EXE utility which may be used by PMD players to play 4-bit PCM percussion samples on SSG channel 3.
name = Name of the sample bank file
#PPZExtend string - PPZ8 expansion
((2-25))
Splits the PCM channel into individual channels allowing use of the PPZ software sample mixer.
string = 1 to 8 uppercase or lowercase letters, must not be reserved for existing channels
#PPZFile name {, upper} - Load PPZ bank(s)
((2-26))
Specifies a PVI / PZI file used by the PPZ sound driver.
name = Name of the sample bank file for instrument 0 - 127
upper = Name of the sample bank file for instrument 128 - 255
#Tempo x - Initial tempo
((2-10))
Expands to
t x (11-1) at the beginning of SSG channel 1.
#Timer x - Initial timer rate
((2-10))
Expands to
T x (11-2) at the beginning of SSG channel 1.
#Title string - Title metadata
((2-6))
string = Title field
#Transpose x - Default global transpose
((2-27))
Expands to
_M x (4-16) at the beginning of all channels except the rhythm channel.
#Volumedown {F}{S}{P}{R} {±} x {, ...} - Default sound chip attenuation
((2-22))
Expands to the corresponding
DF /
DS /
DP /
DR commands (15-4) with the given parameter
x at the beginning of SSG channel 1. Multiple options can be combined, e.g.
FPR 16 becomes
DF 16 DP 16 DR 16.
#Zenlen x - Default whole note tick count
((2-11))
Expands to
C x (4-11) at the beginning of SSG channel 1.
Compile-Time Macros
! identifier - Substitution macro
((16-1))
Substitutes the command with the contents of the pseudo-channel whose header is
!identifier (3-2).
Note:
This is not a run-time macro expansion. The rhythm channel may use the
R command (6-7) instead for run-time patterns.
" - Fast-forward
((16-2))
Skips all note events until the next occurrence of
" or
' (16-3). All other stateful commands remain intact.
& duration - Tie note value
((4-10))
Expands to
l+ duration (4-9).
Note: The
& command is compiled rather than expanded if it is followed by a note rather than a duration specifier.
' - Unmute after fast-forwarding
((16-3))
Expands to
" (16-2) followed by
m0 (15-7).
/ - End of channel
((16-5))
Ignores all remaining MML commands in the channel.
; - Comment
((16-6))
Ignores all following text until the next newline character.
< - Lower octave
> - Raise octave
((4-5))
By default,
< lowers the channel's octave by 1 whereas
> increases by 1. The exact directions may be affected by
X (4-6) and
#Octave (2-12).
Note: This macro applies to notes the first time they are read by the compiler; in particular, no extra commands are required to balance the number of octave changes within loops. Where a single note needs to reach multiple octaves, use
__+12 and
__-12 (4-14) instead.
B x - Pitch wheel range
((7-4))
x = Number of semitones of the detune when the command
I 8192 (7-5) is applied
C x - Whole note tick count
((4-11))
Sets the number of ticks in one whole note to
x (default 96).
Valid range for
x = 1 - 255
Note: This command does not alter the absolute duration of one tick. Doing so requires one of the tempo commands.
I x - Fine pitch
((7-5))
Expands to individual
D commands (7-1) for all notes respecting the pitch wheel range. See
B (7-4).
x: Detune amount
Valid range for
x: -32768 - 32767
Note: Like < and > (4-5), this macro applies to notes the first time they are read by the compiler.
MP-lfo depth {, delay {, speed}} - Software LFO parameters (one-way)
((9-6))
Expands to
M-lfo delay, rate, depth, 255 (9-1), followed by
* 1 (9-3).
delay = 0 if not given
rate = 1 if not given
S x {, y {, z}} - Grace note
((12-1))
Expands to note events at the beginning of following notes that move by semitone to the target note.
If
x = 0: Disable grace notes
If
x = 1-255: Number of ticks for each grace note
If
x =
l duration: Note value for each grace note
If
y > 0: Start from
y semitones above the target note
If
y < 0: Start from -
y semitones below the target note
Valid range for
y = -128 - 127 (-1 if not given)
If
z = 0: Play grace notes individually
If
z = 1 or not given: Tie grace notes
Valid range for
z = 0 - 255
Note: Ineffective if the total duration of all grace notes is longer than the note itself.
W x {, {%} y {, z}} - Retrigger
((12-2))
Expands following notes to shorter notes with increasing or decreasing volume.
If
x = 0: Disable retrigger
If
x = 1-255: Number of ticks for each note
If
x =
l duration: Note value for each retriggered note
%: If given, uses
(% and
)% instead of
( and
) (5-5)
y = Volume increment for each successive note
Valid range for
y = -128 - 127 (-1 if not given)
If
z = 0 or not given: Retrigger notes individually
If
z = 1: Tie to notes with changing volume
If
z = 2: As 0, but retrigger only once
If
z = 3: As 1, but tie only once
Note: Ineffective is the note duration is not longer than
x. Although the original manual document calls this effect "echo", the PMD compiler does not have any kind of echo buffer, so this macro is not the same as the "echo" macro found in other MML dialects such as PPMCK.
X - Exchange octave commands
((4-6))
Exchanges all following occurrences of
< and
> (4-5). This command acts independently of channel headers.
_{ sign note... } - Key signature
((4-15))
Automatically applies accidentals to all following notes.
sign: The accidental to apply,
= to cancel existing accidentals
note...: List of notes that use this accidental
E.g.:
_{+fc} _{=fc} _{-bea} specifies D Major, then C Major, and finally E Flat Major.
Note: Any accidental appearing after a note is relative to the key signature unless the
= symbol appears in the note, which cancels the key signature for that particular note.
` - Multiline comment
((16-7))
If used as a MML command, ignores all following MML commands until the next occurrence of this command.
If used at the beginning of a line, behaves as if a
` command is applied to all channels, and also
skips all MML definitions until the next occurrence of this command at the beginning of a line.
l duration - Default note duration
((4-8))
Sets the default length of all note events and duration modifiers to
duration.
note-event l= {
duration}
note-event l+ duration
note-event l- duration
note-event l^ number - Duration modifiers
((4-9))
1. Sets the previous note event's length to
duration, or the default length given by the
l command (4-8) if omitted.
2. Adds
duration to the previous note event's length.
3. Subtracts
duration from the previous note event's length.
4. Multiples the previous note event's length by
number.
Valid range for
number = 1 - 255
Note: The
l may be omitted in all these commands. The
l= can be omitted altogether; this is how notes followed immediately by a duration specifier are parsed.
o x - Octave setting
((4-4))
x: New octave (default 4)
Valid range for
x: 1 - 8
o ±x - Channel octave offset
((4-7))
Also applies to the existing octave value immediately. Each new command replaces the previous parameter.
±x: Number of octaves to add to all
o commands (4-4)
Valid range for
±x: -7 - +7
v x - Coarse volume setting
((5-1))
For SSG channels: Same as
V (5-2).
For FM channels: Expands to a
V command (5-2) by looking up the following constant table for
x:
v
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
V
85
87
90
93
95
98
101
103
106
109
111
114
117
119
122
125
127
For PCM channel: Expands to a
V command (5-2) whose parameter is (16 ×
x), or (
x ×
x) if
#PCMVolume Extend (2-19) has been issued, limited to 255.
Valid range for
x: 0 - 15 on SSG channels, 0 - 16 otherwise
v ±x - Channel volume offset
((5-3))
Also applies to the existing channel volume immediately. Each new command replaces the previous parameter.
±x: Value to add to all
V commands (5-2)
v( x
v) x - Coarse volume command offset
((5-4))
v( subtracts the parameter from all future
v commands (5-1), whereas
v) adds to them. Each new command replaces the previous parameter.
x: Value to add or subtract
Valid range for
x: 0 - 16
|
| channel...
|! channel... - Channel selector
((16-4))
1. Disables the channel selector.
2. Restricts the following MML commands to only the channels whose identifiers appear in
channel..., until the next
| command or the end of line.
3. As 2, but for channels that
do not appear in the parameter list.
General Commands
& - Tie note
((4-10))
Suppresses the current note's release due to the
Q (4-12) or
q (4-13) gate time commands, and the next note's attack.
Note: This command must be followed by a note before a duration specifier appears; otherwise the command will expand to
l+ (4-9).
&& {duration} - Slur
((4-10))
Suppresses the current note's release due to the gate time commands.
duration: If given, expands to
x duration (i.e. uses current note's pitch)
( {
^} {{
%}
x} - Volume decrement
) {^} {{%} x} - Volume increment
((5-5))
^: If given, command applies to next note only and restores current volume afterwards
x = Decrement / increment amount (1 if not given)
Omitting
% effectively multiplies
x by 4 on FM channels, or 16 on the PCM channel.
Note: In general,
v x ) is not equal to
v x+1 (5-1), and similarly for
(.
*-lfo x - Software LFO setting
((9-3))
Enables the channel's software low-frequency oscillator A or B.
If
x = 0: Disable LFO (default)
x + 1: Apply LFO to channel pitch
x + 2: Apply LFO to channel volume
x + 4: New notes do not restart the LFO
Note: It is possible for one of the LFOs to control the pitch and another one to control the volume. The following two-parameter shorthands are available:
-
* x , y ->
*A x *B y
-
*A x , y ->
*A x *B y
-
*B x , y ->
*B x *A y
D x
DD x - Channel detune
((7-1))
D x = Detune amount, replaces previous value
DD x = Relative detune amount, adds to current value
Valid range for
x = -32768 - 32767
DF {
±}
x
DS {
±}
x
DP {
±}
x
DR {±} x - Sound chip attenuation
((15-4))
DF = FM channels
DS = SSG channels
DP = PCM channel
DR = Rhythm channel
x = attenuation amount, replaces previous value
±x = relative attenuation amount, adds to current value
DM x - Channel detune offset
((7-6))
Also applies to the existing detune value immediately. Each new command replaces the previous parameter.
x: Detune amount to add to all
D commands (7-1)
Valid range for
x: -32768 - 32767
F x - Global fade-out
((15-3))
x = Decay rate, higher values are faster
Valid range for
x = 0 - 127
L - Channel loop point
((10-2))
Creates a loop point for the channel. If not given, the channel stops playing after the last MML command.
Note: Compile-time macros may not recall their states when the channel returns to the loop point.
M-lfo delay {, rate , depth , K} - Software LFO parameters
((9-1))
If
delay = 0-255: Number of ticks until LFO triggers
If
delay =
l duration: Note value to wait until LFO triggers
Valid range for
depth = -128 - 127
Note: The exact meaning of the parameters depends on the
MW command (9-2).
MD-lfo speed {, amount {, time}} - Software LFO depth modulation
((9-7))
If
speed = 0: Disable depth modulation
If
speed = 1 - 255: Number of LFO cycles between adjusting the
depth value of
M command (9-1)
Valid range for
amount = -128 - 127
Positive values of
amount increase the magnitude of
depth and negative values decrease it.
If
time = 0 or not given: Repeat depth modulation indefinitely
If
time = 1 - 127: Number of times the
depth value is adjusted
MW-lfo x - Software LFO shape
((9-2))
For the absolute pitch envelopes below, repeat each item
rate times, then prepend the envelope with 0 repeated
delay times, and finally multiply each item by
depth (except for
x = 3), using the parameters provided by the
M command (9-1).
x = 0: Bidirectional triangle wave
{ | 0 1 2 ... K-1 K K-1 K-2 ... -K+1 -K -K+1 -K+2 ... -2 -1 }
If K = 255: { | 0 1 2 ... }
x = 1: Sawtooth wave
{ | 0 1 2 ... K-1 -K -K+1 -K+2 ... -2 -1 }
If K = 255: { | 0 1 2 ... }
x = 2: Square wave
{ | K -K }
If rate = 255: { K }
x = 3: Noise wave
{ | x }, x is any random value with magnitude not greater than depth × K
If rate = 255: { x } (i.e. x changes only once)
x = 4: Half triangle wave
{ | 0 1 2 ... K-1 K K-1 K-2 ... 2 1 }
If K = 255: { | 0 1 2 ... }
x = 5: Amplified triangle wave
As
x = 0, but with all items further multiplied by the magnitude of
depth
x = 6: Single
{ 0 1 2 ... K-1 | K }
If K = 255: { | 0 1 2 ... }
Note: The graphics in the PMDMML.MAN manual require a monospaced Japanese font to view properly.
MX-lfo x - Software LFO speed mode
((9-5))
If
x = 0: Software LFO steps at same rate as ticks
If
x = 1: Software LFO steps at approximately 54.25 Hz
Note: Although the manual says 56 Hz, the actual value is closer to 54.25 Hz which results from the highest possible TimerA value of the YM2608.
Q x
Q % x - Gate time setting
((4-12))
1. Shortens the sustain duration of following notes by
x/8-th's of the actual note length.
Valid range for
x = 0 - 8
2. As 1, but by
x/256-th's of the note length instead.
T x
T ±x - Timer rate setting
((11-2))
x = TimerB rate constant, replaces previous value
±x = Relative TimerB rate, adds to current value
V x - Channel volume setting
((5-2))
Valid range for
x = 0 - 127 for FM channels, 0 - 15 for SSG channels, 0 - 255 for PCM channel
[ main {: sub} ] {x} - Loop with break
((10-1))
Plays the contents of
main followed by
sub for
x times, but skips over
sub on the last loop.
If
x is not given, uses the value provided by the
#LoopDefault directive (2-13).
Note: This article uses the fullwidth forms for the square bracket characters where it is impossible to include [ or ] within Firki parameters.
_ x
__ x - Channel transpose
((4-14))
_ x = Transpose amount in semitones, replaces previous value
__ x = Relative transposition in semitones, adds to current value
Valid range for
x = -128 - 127
_M x - Channel transpose offset
((4-16))
Also applies to the existing transpose amount immediately. Each new command replaces the previous parameter.
x: Value to add to all
_ commands (4-14)
Valid range for
x = -128 - 127
m x - Channel mute
((15-7))
If
x = 0: Unmute channel
If
x = 1: Mute channel
q {x {- y}} {, z} - Ticks gate time setting
((4-13))
Further shortens the sustain duration of following notes but also ensures they have a minimum sustain length.
x = Number of ticks to shorten (0 if not given)
If
y is given: Shorten notes by random number of ticks between
x and
y inclusive; difference between them must be 127 or less
z = Shortest sustain duration (0 if not given)
Note: Any of
x,
y, or
z may be substituted with
l duration.
t x
t ±x - Tempo setting
((11-1))
x = Tempo measured in 48-tick beats per minute, replaces previous value
±x = Relative tempo amount, adds to current value
Valid range for
x = 18 - 255
Valid range for
±x = -128 - 127
Note: The default value for the
C command (4-11) renders the tempo as the number of half notes per minute.
y reg , val - Direct register write
((15-1))
Writes
val to address
reg of the YM2608's internal memory.
Uses the high page (ADPCM / FM Ch 4-6) if this command is issued in FM channels 4 - 6, otherwise uses the low page (SSG / Rhythm / FM Ch 1-3).
FM Commands
# 0
# 1, x - YM2608 hardware LFO rate
((9-9))
1. Disables YM2608's hardware LFO on all channels.
2. Enables YM2608's hardware LFO on all channels.
x = LFO rate
Valid range for
x = 0 - 7
## freq , wave , pmd , amd
#a amd
#f freq
#p pmd
#w wave - OPM hardware LFO settings
((9-10))
1. Expands to
#f freq,
#w wave,
#p pmd,
#a amd.
2.
freq = Modulation frequency
3.
wave = Modulation wave shape
If
wave = 0: Sawtooth
If
wave = 1: Square
If
wave = 2: Triangle
If
wave = 3: Noise
4.
pmd = Pitch modulation depth
Valid range for
pmd = -64 - 63
5.
amd = Amplitude modulation depth
Valid range for
amd = 0 - 127
#D x - FM hardware LFO delay setting
((9-11))
If
x = 0-255: Number of ticks before hardware LFO begins
If
x =
l duration: Note value for for hardware LFO delay
@ x fm-patch - FM instrument definition
((3-1))
x = Instrument index
Default, or if
#DT2Flag off (2-14) has been issued:
fm-patch =
alg fb (
ar dr sr rr sl tl ks ml dt ams) × 4
If OPM is used, or if
#DT2Flag on (2-14) has been issued:
fm-patch =
alg fb (
ar dr sr rr sl tl ks ml dt dt2 ams) × 4
If OPL is used:
fm-patch =
alg fb (
ar dr rr sl tl ksl ml ksr egt vib am) × 2
Note: Instrument parameters may be separated by whitespace, commas, or newlines.
@ x - FM instrument setting
((6-1-1))
x = Instrument index
Note: Not all instrument parameters might be written; see the notes for the
s command (6-2).
FB {±} x - FM feedback setting
((6-4))
x = New feedback amount, replaces previous value
±x = Relative feedback amount, adds to current value
Valid range for
x = 0 - 7
H pms {, ams {, delay}} - FM hardware LFO settings
((9-8))
If
delay is given, expands to
H pms, ams followed by
#D delay (9-11).
pms = Pitch modulation depth for this channel
ams = Amplitude modulation depth for this channel
Valid range for
pms = 0 - 7
Valid range for
ams = 0 - 3
MM-lfo op-flag - FM software LFO operator mask
((9-4))
Pitch LFO:
On FM channel 3 or one of the
#FM3Extend (2-20) channels: Apply pitch LFO to only operators enabled in
op-flag
Otherwise: Always apply pitch LFO to all operators
Volume LFO:
If
op-flag = 0: Apply volume LFO to only carrier operators (default)
If
op-flag = 1-15: Apply volume LFO to only operators enabled in
op-flag
Note: Resets to the default settings on
@ commands (6-1-1).
O op-flag , x
O op-flag , ±x - FM operator level setting
((6-3))
op-flag = Operators whose TL values are nodified
x = New TL value, replaces previous value
±x = Relative TL value, adds to current value
Valid range for
x = 0 - 127
P x - OPM output setting
((6-5))
If
x = 1: Output tone from OPM channel 8 operator 4
If
x = 2: Output noise from OPM channel 8 operator 4
p x - FM panning
((13-1))
If
x = 0: Output nothing
x + 1: Output to right channel
x + 2: Output to left channel
px x - FM panning (general)
((13-2))
If
x > 0: Pan to left
If
x = 0: Pan to middle
If
x < 0: Pan to right
Valid range for
x = -128 - 127
s op-flag - FM operator mask
((6-2))
Enables processing of the FM operators used in
op-flag, and disables the rest.
Note: Often used with the
#FM3Extend command (2-20). For all following
@ (6-1-1) commands:
- Only parameters for the enabled operators are overwritten
- The algorithm type is overwritten
- The feedback value is overwritten if operator 1 is enabled, which may also come from the
FB command (6-4)
sd op-flag , x
sdd op-flag , x - FM operator detune
((7-2))
Adds an extra layer of detuning for each individual operator on top of the
D and
DD commands (7-1).
sd op-flag, x = Detune amount, replaces previous value
sdd op-flag, x = Relative detune amount, adds to current value
Valid range for
x = -32768 - 32767
sk op-flag , x - Operator delay
((12-3))
If
op-flag = 0: Disable delay
If
op-flag = 1-15: Delay note triggers on given operators by the given duration
If
x = 0-255: Number of ticks to wait
If
x =
l duration: Note value for delay
w {±} x - OPM noise pitch
((6-6))
Sets the pitch of OPM channel 8 operator 4 when it produces a noise wave.
x = New noise pitch, 0 is highest, replaces previous value
±x = Relative noise pitch, adds to current value
Valid range for
x = 0 - 31
SSG Commands
@ - SSG instrument preset
((6-1-2))
On SSG channels only, expands to one of the predefined
E command (8-1-1) envelopes:
@ 0:
E 0,0,0,0
@ 1:
E 2,-1,0,1
@ 2:
E 2,-2,0,1
@ 3:
E 2,-2,0,8
@ 4:
E 2,-1,24,1
@ 5:
E 2,-2,24,1
@ 6:
E 2,-2,4,1
@ 7:
E 2,1,0,1
@ 8:
E 1,2,0,1
@ 9:
E 1,2,24,1
DX x - SSG pitch mode setting
((7-3))
If
x = 0: Linear period offsets for the
D command (7-1)
If
x = 1: Linear pitch mode where
D244 corresponds to one semitone
Note: The number 244 comes from 4096 × (2 ^ (1 ÷ 12) - 1). FM channels must use the
B (7-4) and
I (7-5) commands instead.
E al , dd , sr , rr
((8-1-1))
E ar , dr , sr , rr , sl {, at} - SSG volume envelope setting
((8-1-2))
1. Uses a PMD-style volume envelope.
al = Attack length
dd = Decay depth
sr = Sustain rate
rr = Release rate
valid range for
dd = -15 - 15
Equivalent MML volume sequence: (V is the channel volume, R is the channel volume on note release)
V'al V-dd'sr V-dd-1'sr V-dd-2'sr ... / R'rr R-1'rr R-2'rr ...
2. Uses a FM-style volume envelope.
ar = Attack rate
dr = Decay rate
sr = Sustain rate
rr = Release rate
sl = Sustain level
al = Attack level (0 if omitted)
Valid range for
ar,
dr, and
sr = 0 - 31
Valid range for
rr,
sl, and
al = 0 - 15
EX x - SSG envelope speed mode setting
((8-2))
If
x = 0: Volume envelope steps at same rate as ticks
If
x = 1: Volume envelope steps at approximately 54.25 Hz
Note: Although the manual says 56 Hz, the actual value is closer to 54.25 Hz which results from the highest possible TimerA value of the YM2608.
P x - SSG output setting
((6-5))
If
x = 0: Output nothing
x + 1: Output square tone
x + 2: Output noise on this channel
Note: PMD has no means of enabling the SSG's envelope generator on any channel. It is possible to use very limited forms of envelope modulation by using the
y command (15-1), e.g.:
I y$A,$10 ; CH3 enable envelope
I y$5,$01 y$4,$40 y$7,$3B ; CH3 square tone output
I y$C,$00 y$B,$20 ; envelope period
I y$D,$0A r2 y$D,$8 r2 ; triangle then sawtooth
Any of PMD's own commands will possibly override the SSG envelope settings.
w {±} x - SSG noise pitch
((6-6))
x = New noise pitch, 0 is highest, replaces previous value
±x = Relative noise pitch, adds to current value
Valid range for
x = 0 - 31
PCM Commands
@ x {, begin {, end {, release}}} - PCM sample setting
((6-1-5))
begin = Sample loop point (no looping if omitted)
end = End of sample loop (0 if omitted)
If
end = 0: Use last sample as end of loop
release = Sample release point (-32768 if omitted)
If
release = -32768: Disable release part
Valid range for
begin,
end, and
release = -32768 - 32767
Note: Sample positions correspond to bytes for PCM samples, and units of 16 bytes for ADPCM samples. If any of the looped sample parameters is negative, the corresponding position is calculated from the end of the sample.
A x - PCM sample mode
((15-10))
If
x = 0: Use samples as PCM
If
x = 1: Use samples as ADPCM
Note: This command can be used on any channel.
E al , dd , sr , rr
((8-1-1))
E ar , dr , sr , rr , sl {, at} - PCM volume envelope setting
((8-1-2))
Same as the SSG version.
EX x - PCM envelope speed mode setting
((8-2))
Same as the SSG version.
p x - PCM panning
((13-1))
If
x = 0: Output to both channels, enable surround sound
If
x = 1: Output to right channel
If
x = 2: Output to left channel
If
x = 3: Output to both channels
Note: Surround sound (invert phase on one of the stereo channels) is only supported on OPNA.
px x {, y} - PCM panning (general)
((13-2))
On PPZ channels:
If
x < 0: Pan to left
If
x = 0: Pan to middle
If
x > 0: Pan to right
Valid range for
x = -4 - 4
On OPNA channels:
If
x > 0: Pan to left
If
x = 0: Pan to middle
If
x < 0: Pan to right
Valid range for
x = -128 - 127
If
y = 0: Normal output
If
y = 1: Enable surround sound
Rhythm Commands
Except for the
@ (6-1-3) and
R (6-7) commands, all these commands may be used in either the rhythm channel or rhythm pseudo-channels.
* x - PDR driver flags
((15-2))
Toggles one of the flags of the SSG 4-bit PCM driver.
If
x = 0: Allow two PCM voices
If
x = 1: Allow one PCM voice (default)
If
x = 2: Play samples at 16 KHz
If
x = 3: Resample output to 8 KHz
If
x = 4: Enable interrupts from other background processes (default)
If
x = 5: Disable interrupts from other background processes
Note: Not all PMD players,
including native players, support all of the options above.
Such background processes are only relevant on native players.
@ x - Rhythm instrument setting
((6-1-3))
If
x = 0: Select none
x + 1: Bass kick
x + 2: Snare 1
x + 4: Low tom
x + 8: Mid tom
x + 16: High tom
x + 32: Rimshot
x + 64: Snare 2
x + 128: Closed hi-hat
x + 256: Open hi-hat
x + 512: Crash cymbal
x + 1024: Ride cymbal
Note: The following user-defined samples are available if PPSDRV is enabled: (6-1-4)
-
x + 2048
-
x + 4096
-
x + 8192
R x - Rhythm pattern expansion
((6-7))
Plays the contents of the rhythm pseudo-channel whose header is
Rx (1-2-1).
Note: Unlike the
! command (16-1), this command is compiled into the output file, and is in fact the only way to produce rhythmic sound on the SSG channel (since note commands cannot be placed in the rhythm channel itself).
\-perc
\-perc p - Play YM2608 rhythm sample
((14-1))
If
p is given: Halts given sample on the YM2608 rhythm channel
If
p is omitted: Triggers given sample on the YM2608 rhythm channel
Note: There must not be any whitespace between
-perc and
p. This command has no note values whatsoever; use rests if necessary.
\l-perc
\m-perc
\r-perc - YM2608 rhythm sample panning
((14-4))
\l: Pan to left
\m: Pan to middle
\r: Pan to right
\V x - YM2608 rhythm master volume
((14-2))
Valid range for
x = 0 - 63 (default 48)
\v-perc {±} x - YM2608 rhythm sample volume
((14-3))
x = absolute volume, replaces previous value
±x = relative volume amount, adds to current value
Valid range for
x = 0 - 31 (default 15)
Apart from the commands listed above, these commands may be used in all rhythm (pseudo-)channels:
-
l (4-8)
-
C (4-11)
-
v (5-1)
-
V (5-2)
-
v+ v- (5-3)
-
( ) (5-5)
-
[ : ] (10-1)
-
L (10-2)
-
t (11-1)
-
T (11-2)
- All the miscellaneous commands as listed in the manual (15-*)
- All the control commands (16-*)
Notes may be used in rhythm pseudo-channels only, not in the rhythm channel itself. The compiled versions of tie and slur are unavailable.
Volume commands work only if PPSDRV has been enabled. The raw SSG percussion instruments have no volume control.
Several players allow mapping SSG percussion notes to the YM2608 rhythm channel automatically (such as FMPMD2000's "SSG+RHY" option). Their implementations might not utilize all of the PMD rhythm channel commands.
Miscellaneous Commands
N x - Play FM sound effect
((15-5))
If
x = 0: Silence currently playing sound effect
If
x = 1-255: Play sound effect at index
x
Note: Defining FM sound effects requires EFC.EXE, which is unavailable in the freeware version of PMD. This command is only useful when PMD is used as an actual game music engine.
Z x - Measure duration
((15-8))
x = Number of ticks in a measure
Note: This command does not affect the tempo of the compiled song, and is only useful for native PMD players supporting said feature.
n x - Play SSG sound effect
((15-6))
If
x = 0: Silence currently playing sound effect
If
x = 1-127: Play sound effect at index
x
If
x = 128-255: Play SSG 4-bit PCM sound effect at index (
x - 128)
Note: The first few indices correspond to PMD's own instruments for SSG channel 3 percussion. PMD only defines sound effects up to
n 153; any higher index might crash PMD players. This command is only useful when PMD is used as an actual game music engine.
~ x
~ ±x - Write to Status1
((15-9))
x = New Status1 value, replaces previous value
±x = Relative Status1 value, adds to current value
Note: Status1 is the name of a general-purpose byte variable in PMD. It has nothing to do with the read-only status flag with the same name on YM2608.
MC.EXE Command Line Arguments
Usage:
mc [option...] mml-file ff-file
mml-file: Name of input MML file, file extension may be omitted if ".MML"
ff-file: Name of extra FM patch bank, file extension may be omitted if ".FF"
The following options are available:
-
/V: If ff-file is not provided, adds the FM instruments defined in mml-file to the output file. This is usually required.
-
/VW: Overwrites the FM patches in ff-file with the definitions in mml-file (plus any changes to the PMD driver's FM patch memory if the sound driver is used directly).
-
/L: Uses YM3526 / OPL, for IBM machines.
-
/M: Uses YM2151 / OPM, for X68000 machines.
-
/N: Uses YM2203 / OPN or YM2608 / OPNA, for NEC PC-x801 machines. This is the only default setting.
-
/T: Uses YM2612 / OPN2, for FM Towns.
FM Towns does not have an equivalent SSG chip like the Sega Genesis.
-
/C: Displays the song length and loop length of all used channels in number of ticks, unless the channel contains an infinite
[:] loop (10-1).
-
/A: If /P or /S is supplied, skips loading PCM samples before playing.
-
/O: If /P or /S is supplied, skips loading the file's metadata into the player.
-
/P: Plays the output file after compilation. Requires PMD.EXE.
-
/S: Plays the compiled file without saving any files. Requires PMD.EXE.
All files, input or output, are expected to have a file size within 64 KB.
See Also
Professional Music Driver (PMD)
List of Effects Commands