NRTDRV MAN EN SYNTAX MMLCOMMAND NOTES

From MSX MUSIC WIKI
Jump to: navigation, search

Notes of MML commands

Note 1 Key signatures

"+", "-" and "=" before scale note are recognized as key signature.

These are commands for add sharp or flat. Multiple scale note are valid and "-eab" means equivalent for C minor scale.

If other than scale note are detected, soon ends key signature specification. Insert space or colon as separator if you want to write phrases soon after key signature.

[sample1]
A -eab cdefgab
Same as cde-fga-b-

If you want temporally disable key signature, use accidental sign natural "=".

[example2]
A -b ab=>cd<ab>cd
Same as ab>cd<ab->cd.

If key sign and accidental sign exist, accidental sign has priority. Never recognized as double sharp or double flat.

[example3]
A +cfg ab>cdefg-a
Same as ab>c+def+g-a

If you want use key sign command some times (transition e.g.), previous key sign remains valid. Use natural in such case.

[example4]
A +fgcd efgab>cde =gcd <gab>cdefg
Same as ef+g+ab>c+d+e <gab>cdef+g

Note 2 Slur and legato

"&" means slur. It is valid only when it exists soon after music scale commands. If it follows other than music scale, retains previous music scale's specification.

[example]
c&v12&d
Same as c&v12d (slur for c remains and connected to d).
[example]
cv12&d
Same as cv12d (c lacks slur and does not connected to d).

"(" is legato on and ")" is legato off. You can express softly with legato when multiple music note connected with slur.

[example]
(c4d16e8)f2
Same as c4&d16&e8&f2.
[example]
c4(d16e8)f2
Same as c4d16&e8&f2
[sample]
c4(d16)e8f2
Same as c4d16&e8f2

Note 3 Octave definition

The range in OPM track is from 0 to 8 . Values less than o0d+ are corrected to o0d+ and more than o8d+ are corrected to o8d+.

The range in PSG tracks are from 0 to 9.

Note 4 Gate time

q command (small character q) defines ratio to sound length. Q command (capital character Q) shorten as counts.

Both of them can be used at a time, for example "Q3 q8 c#24" is same as "q8 c#21r#3".

Q255 means mandatory legato on and legato off ")" cannot do legato off (if 2 or 3 is defined with #Q_MODE header it is not available).

To escape confusion, we recommend "(" as legato on.

Note v command and vr command

The range of settings can be change by #V_STEP in OPM tracks. The range of PSG tracks are fixed 0-15 and directly effected to PSG registors.

v command and V command are not used simultaneously.

TL parameter of carrier in OPM track is modified when executed. Then volume of long-released tone is modified as well with such like "v15vr9c4r4".

Note V command

This value affected directly to TL resister in OPM tracks. This value is devided by 8 and affected to volume resister of PSG in PSG tracks.

It is not valid with v command at a time.

TL parameter of carrier in OPM track is modified when executed. Then volume of long-released tone is modified as well with such like "v15vr9c4r4".

Note 7 P command

Specifies OPM track's sound output/sound localization of stereo speakers. 0:mute, 1:left 2:right and 3:center(left & right). Default value us "P3".

Specifies tone and noise switch in PSG tracks. 0:mute, 1:tone, 2:noise and 3:both. Default value os "P1".00

Note 8 Scale type portamento

Makes smoothly transpose between two sounds. Syntax is below.

<str1>_<str2><len>,<num>
<str1> is Starting scale
<str2> is Target scale(commands related to octaves are available)
<len> is Length of whole portamento
<num> is Speed up transpose (1-255)

Unit of <num> is 1/256 of half scale and that is same resolution as frequency resister in PSG tracks. This value is added to original amount of changes In every 16.384 msec.

If you omit <num>, comma should be omitted as well.

[example]
c_d4
A quarter note from c to d.
l8e_<<f
A 8th note from e to f of 2 octave lower.
o3g_o5a2.
A pointed half note from o3g to o5a.
c_b1,30
A whole note from d to b with fast transpose.

If you play too much notes in a narrow range you reach the target pitch faster than you expected. If you play notes that are too short in the wide range you may not reach the original pitch.

It cannot be used with G command at a time. Latter one is valid.

Note 9 N command

Controls noise generator of Ch.8/OP4 in OPM track. Track H (Ch.8 of OPM#1) when it is executed in track A -H or track P (Ch.8 of OPM#2) in track I - P are target to control.

Controls noise generator which is common for all channel in PSG tracks.

Enables noise output when specifies frequency in OPM track, because it is noise output and stop command. 255 means stopping noise output.

Enables noise with P command in PSG tracks.

0=white noise, 31=pink noise in OPM track in OPM track, it corresponds to PSG noise generator.

Values are not same as OPM resistors one and if you translate from other environment large and small might be reverted.

Note 10 D command

In the OPM track, it is 1/64 unit of semitones, the range is -128 to 127, but when using the #DETUNE_EXP header it will be -16384 to 16383.

For PSG tracks, this value is equivalent to the frequency register, and the higher the frequency, the stronger the effect will be.

In addition, although error does not occur even if it exceeds the sound range of PSG, the maximum sound and the lowest sound are connected, so please be careful. (When it exceeds the highest tone, it loops to the lowest tone, when it exceeds the lowest tone it goes to the highest tone).

Note that the range remains at -128 to 127 even when #DETUNE_EXP header is used.

Note 11 K command

Transposed sounds exceeds the range o0c - o8b, sound goes out of order in OPM tracks.

Transposed sounds exceeds the range o0c - o9b, sound goes out of order in PSG tracks.

Values should be within the range.

Note 12 Fade out

Fade out starts with one command. If it is omitted default is 5.

Note, small noise generated when OPM tone is set while fading out according to internal processing.

Note 13 z command

This is command that can write into multiple resisters. List target resister number and values alternately like z<reg>,,<reg>,<data>,……<reg>,<data>.

This makes loading lighter than listing with y command.

[sample]
z7,49,6,15
Write 49 into resister #7 and 15 to resister #6.

Note 14 Arpeggio

This command is to sound arpeggio (broken chord).

"<str>"<len1>,<len2>
<str> is Scale (octave related commands available as well).
<len1> is Length of whole arpeggio.
<len2> is Length per one note.

Express feeling like chords with one track. The scale specified by <str> is divided by the tone length of <len 2> for the duration specified by <len1>.

All notes in arpeggio means legato and whole length are affected by q and Q command.

If <len1> is omitted, default is value specified with l command.

If <len2> is omitted, omit comma as well.

If it is omitted, previous value remains (it affects all of texts further regardless of the tracks). Default is "#2" (2 counts).

[example]
"ceg"1
Broken chord with ceg as whole note with each note 2 counts long.
[example]
Broken chord with f, a and higher c as a half note with each note like as eighth note.
[example]
Broken chord with eg+b as a quarter note with each note as 3 counts long.

Note 15 Disable commands

These commands of @ command, P command and volume command are disabled after this command. Note first one is valid and commands after second one are disabled.

It is convenient that it is specified at the top of the track when uses OPM tone resister editor.

Note commands in driver macros never disabled.

Note 16 Stop and restart commands for tracks

Continues to play track specified with ‾<str>, after stopping the track with *.

If there are many rests in track, MMLs like [16r1] are not needed. Such command gives high visibility and reduces data sizes.

[sample]
A cdef ‾B gab>c
B * cdef
Plays "gab>c" on track A and "cdef" on track B simultaneously.

If you execute restart command in higher tracks than stopped track, extra 1 count is added.

[sample]
A * cdef
B cdef ‾A gab>c

"gab>c" in track A and "cdef" in track B is not synchronized by 1 count.

Note 17 HL command

This is OPM hardware LFO basic setting (common settings between8 channels) command. Syntax is as follows.

HL<Waveform>,<LFRQ>,<PMD>,<AMD>
Waveform(shape of wave):0-3 (0=saw wave, 1=square wave, 2=triangle wave and 3=random wave)
LFRQ(frequency):0〜255 (LFO frequency)
PMD(LFO depth of scale):0〜127
AMD(LFO depth of volume):0〜127
[sample]delay vibrato
HL2,200,10,0 HS1 V127 (c4HP7)c4HP0 (d4HP7)d4HP0 (e4HP7)e2.HP0

OPM#1(track A-H) and OPM#2(track I-P) are completely isolated and 2 systems of hardware LFO are available.

HL command on track A affects only tracks A-H and not I-P. HL command on track I affects only tracks I-P.

Hardware LFO effect is not enabled only with this command. Use both of HP and HA command to affect.

Note 18 Software LFO

Process of software LFO is not effected by tempo and constantly executed with 16.384 msec. clock.

For example if <delay> is defined 61, 16.384*61 = 999.424 msec. = 1 sec.

Syntax is as follows.

SP<delay>,<pitch>,<steps>,<type>
delay:0〜255 (Time to start LFO)
pitch:1〜255 (Additional value of pitch)
steps:1〜255 (1 amplitude length)
type :0〜5 (Types of LFO waves)
0=Triangle wave starts from falling
1=Triangle wave starts from rising
2=Triangle wave starts from falling (with 64 time narrower pitch).
3=Triangle wave starts from rising (with 64 time narrower pitch).
4=A rectangular wave applied downward
5=A rectangular wave applied upward

It is software LFO (vibrato) for scale.

For <pitch>, it is basically 1/64 of a semitone in OPM tracks but If <type> is 2 to 3, it is multiplied by 64, and it becomes a semitone unit.

PSG tracks are equivalent to frequency registers, and the higher the frequency, the stronger the effect will be. Please note that it tends to amplitude more than necessary, especially when setting a large value.

SA<delay>,<pitch>,<steps>,<OP>
delay:1 - 255 (Time to start LFO)
depth:1 - 8 (TL reduce value per 16.384 msec.)
steps:1 - 255 (TL reduce time per 1 amplitude)
OP:0 - 15 (Target operator) Same as operator mask

This software LFO (tremolo) for volume. It loops when exceeds range of TL.

SA/SRA commands cannot be used in PSG tracks.

Make tremolo shaped envelope with PSG tone definition (@P).

LFO starts when SA or SRA is set.

However, SP command's effect will not be applied while the pitch is changing in portamento.

Key on synchronized mode automatically applied when these commands are executed.

If you want to use unsynchronized mode, use SSP or SSA command.

If these values are omitted, previous one is used. You can do like switching on and off with this function for SR, SPR and SRA commands.

[sample] Left side is omitted pattern and right side is what recognized as result.

A {			; A{
 SP20,16,4,0 l2cd	;  SP20,16,4,0 l2cd
SR ef			;  SR ef
SP ga			;  SP20,16,4,0 ga
SP,,8 b>c		;  SP20,16,8,0 b>c
SP80 d1		;  SP80,16,8,0 d1
}			; }

Note 19 Line feeding valid area

Even though line feeding in the area between "{" and "}", this is recognized as a process unit of MML, driver macro or compiler macro definition.

These examples 1-3 below specifies same playing.

[example1]
ABC v13 o4 q6 l8 ccddeeff erdrc4.r
[example2]
ABC { v13 o4 q6 l8
        ccddeeff
        erdrc4.r
}
[example3]
       $macro1 {
               v13 o4 q6 l8
               ccddeeff erdrc4.r
       }
       ABC $macro1

FYI, current version allows MML after "}" without line feed and examples below are the same.

[example4]
       A {
         cdef
         gab>c
       }
[example5]
         A {cdef
         gab>c}
[example6]
         A {cdef
         }gab>c
[example7]
         A {cdef}gab>c

Description like sample 6 or sample 7 are not recommended. It can be compiled with current version but error might be caused with further versions.

Note 20 Defining comment area

The area between "/*" and "*/" is comment and ignored during compile. It is convenient when you are editing MML, commenting multiple line e.g.

Nesting level is unlimited and description like "/*a/*b/*c" and "c*/b*/a*/" is valid. Whole internal part is recognized as comment in this case.

It has same priority of ";", so which described first has priority to the other. If you commented out "/*" by ";", remained "*/" causes error.

If only "/*" is used, whole line until the end if the line is commented out.

[example]
       A {	o4 l4
               cdef edc.r8
       /*
               efga gfe.r8
               crcr crcr
       */
               l8ccddeeff erdrc4r4
       }
"efga gfe.r8" and "crcrcrcr" are ignored as comment and "cdef edc.r8 l8ccddeeff erdrc4r4" is played.

[example]

       A {	o4 l4
               cdef edc.r8
               efga /* gfe.r8
               crcr crcr */
               l8ccddeeff erdrc4r4
       }
"gfer8." and "crcr crcr" are recognized as comment and "cdef edc.r8 efga l8ccddeeff erdrc4r4" is played.

[example]

       A {	o4 l4

/* cdef edc.r8

               efga /* gfe.r8 */
               crcr crcr
       */	l8ccddeeff erdrc4.r
       }
This is 2 level nesting and only last part, "l8ccddeeff erdrc4.r" is played.

[example]

       ;A /* cdef
       A gab>c */

"/*" is commented out by ";" and unpaired "*/" occurs error.

Note 21 Special mode of q command with denominator

255 means special mode and can be set count value of gate time with q command.

[example]
       #Q_MODE 1
       A QM255 q10 c4d8e8.f2
Key off with 10 counts no matter length of note.

Note 22 The third parameter of y command

You can specify appropriate sound chip with 3rd parameter. 0=PSG, 1=OPM#1 and 2=OPM#2.

If 3rd parameter is omitted, it depends on tracks. Track 1-3 =PSG, track A-H =OPM#1 and track I-P =OPM#2.

Note 23 OPM tone parameter of direct setting

y??<op>,<data>(,<ch>,<port>)

??     … Parameter abbreviations (DM/TL/KA/AD/DR/DS/SR/SL)
<op>   … Operator number(1 - 4)
<data> … Data(0 - 255)
<ch>   … OPM channel number (0 - 7) it can be omitted
<port> … Sound chips (0=PSG, 1=OPM#1, 2=OPM#2) it can be omitted

Parameters are defined with syntax above. If <ch> and <port> are omitted, it depends on the tracks.

Abbreviation of parameters mean as such.

               DM    … DT1/MUL
               TL    … TL
               KA    … KS/AR
               AD,DR … AME/DR
               DS,SR … DT2/SR
               SL    … SL/RR

Note 24 SDP/SSA commands (non-synchronized software LFO)

Software LFO synchronizes with SP/SA command. once these commands are executed, non-synchronized mode with key on starts and after 1st time key on, remains software LFO effected.

When SP/SA commands are excuted again, returns synchronized mode with key on again.

[sample]
A SP16,6,2,0 cdef SSP gfed SP ceg>c
"cdef"is synchronized with key on, "gfed" is not synchronized and "ceg>c" is synchronized again.

If start point of the note and software LFO return point matches, center of software LFO might not match. It is issue according to design of this music driver.

Note 25 PP command (pattern specified pan pot)

List of parameters set that value every time key on. When last parameter is reached, loops to the first one and it can be used like auto panning.

It is disables if 0 is set for the first parameter or P command is executed.

If 0 is defined after parameter 0, pan pot is not set at that timing.

Values are determined when it is compiled and if you use repeatings, it might not played as you want.

It is not effected inside and out side of driver macros vice versa, specify for each ones.

[sample]
PP3,2,3,1 cdefgab>c
;Same as "P3 c P2 d P3 e P1 f P3 g P2 a P3 b P1 >c"
[sample]
PP1,0,2,3,0 cdefgab>c
;Same as "P1 cd P2 e P3 fg P1 ab P2 >c"
[sample]
PP1,2 [ceg] c
;It is not same as"P1 c P2 e P1 g P2 c P1 e P2 g P1 c",
;but as "[ P1 c P2 e P1 g ] P2 c"

Note 26 PV command (pattern specified volume)

List of parameters set that value every time key on. When last parameter 21is reached, loops to the first one and it can be used when you want make strong and weak hihat with some frequency.

The range is 0-127 and equivalent to V command. Note, the range of PSG tracks is 0-127 as well. (1/8 of the value is set to volume register).

It is disables if 0 is set for the first parameter or V/v command is executed.

If 0 is defined after parameter 0, pan pot is not set at that timing.

Values are determined when it is compiled and if you use repeatings, it might not played as you want.

It is not effected inside and out side of driver macros vice versa, specify for each ones.

[sample]
PV120,100,90,80 cccccccc
;Same as "V120 c V100 c v90 c v80 c v120 c v100 c v90 c v80 c"
[sample]
PV120,100,90,80 [cc] cc
;Not same as "V120 c V100 c v90 c v80 c v120 c v100 c",
;but as "[ v120 c v100 c ] v90 c v80 c"


Note27 Pitch specification for Tone Doubler

Notation of "Tone Doubler" is described by 2 notes with "," or numeric "0". (See chaptor of "Tone Doubler definition" for details.)


[sample]
c0g4
;Plays c and g simultaneously as a quorter note.
e,g8
;Plays e and g simultaneously as a eigth note.
o2a0>e
;Plays o2a and o3e simultaneously.
o2f0o3c
;Plays o2f and o3c simultaneously.

Tone numbers with algorythm 4 should be selected as a default setting and basic multiple is 4, sustain rate and detune1 are 0 for all operaters. If you want change these values, define again with Tone Doubler definition.

Feed back is effected only top note, so if you want it to bottom note, exchange OP1/OP2, OP3/OP4 with Tone Doubler definition.

Distance of note 1 and note 2 determines which parameter is set. For example, c0e or e0c have 4 half notes. This is executed internally as "Key=4 parameter is adopted and then plays c".

===Note 27 Pitch specification for Tone Doubler===