Explanation of MML commands

  • Topic Archived
  1. Boards
  2. Petit Computer
  3. Explanation of MML commands
3 years ago#1
After reading through the documentation and trying everything out, I wrote out this reference to demystify PC's MML.

MML Reference
-------------

Settings
--------

: value : Channel select
Selects a channel to assign note data to
value range: 0 to 7

T value : Set tempo
value range: 1 to 240


Instruments
-----------

@ value : Set instrument
values 0 to 127: General MIDI instrument set
values 128 to 129: Standard General MIDI drum sets
values 144 to 150: PSG pulses at different duty rates
value 151: Noise generator
value 224-255: User defined waveforms

@E valueA,valueD,valueS,valueR : Define ADSR (Attack, Decay, Sustain, Release) envelope
Shapes the volume/dynamics of each individual note as they are played
all value ranges: 0 to 127

@ER : Disable ADSR envelope


Note Pitch
----------

C D E F G A B (or c d e f g a b) : Set base pitch

# (or +) : Sharp
Raise half step

- : Flat
Lower half step

R : Rest

@D value : Detune
Raise/Lower pitch slightly
value range: -128 to 127
e.g.
@D-128 lowers one half step
@D127 raises one half step
@D0 disables detune

_ : Portamento
Slide between pitches

O value : Define octave
value range: 0 to 8
e.g., middle C = O4C

< : Jump one octave up

> : Jump one ocatve down

N value : Alternate way to define note pitch
value range: 0 to 127
e.g. N60 = C in octave 4 (equivalent to command O4C)


Note Length
-----------

1 : Whole note
2 : Half note
3 : Half triplet note
4 : Quarter note
6 : Quarter triplet note
8 : Eighth note
12 : Eighth triplet note
16 : Sixteenth note
.
.
.
192: 128th triplet note

. : Dotted note
Duration + 50%
e.g. C2. = dotted half note (3 beats)

L value : Set default note length
value range: 1 to 192

Q value : Gate Time
Change the duration of when the note is audible compared to its actual length (for staccato/tenuto)
value range: 0 to 8

& : Tie or Slur
Joins two notes together
e.g. C2&C4 = C note held for 3 beats (equivalent to C2.)


Performance
----------

@MON : Enables modulation effects (see below)

@MOFF : Disables modulation effects

@MA valueDepth,valueRange,valueSpeed,valueDelay : Tremolo
Rapidly retriggers note
all value ranges: 00 to FF (hex)

@MP valueDepth,valueRange,valueSpeed,valueDelay : Vibrato
Vibrates the pitch of note
all value ranges: 00 to FF (hex)
---
"Put it in H!"
3 years ago#2
Volume and Panning
------------------

V value : Set velocity
Dynamic level (volume) of individual notes
value range: 0 to 127

( value : Increase velocity
Can be used for crescendos
value range: 0 to 127

) value : Decrease velocity
Can be used for diminuendos
value range: 0 to 127

@V value : Set channel volume
Volume level for entire channel
value range: 0 to 127

P value : Set panning
Moves sound between left and right speakers
value range: 0 to 127
e.g. P0 = full left, P64 = centre, P127 = full right

Other Useful Stuff
------------------

[ : Start loop
Used to repeat sections of a song when used with End loop command below

] value : End loop
"value" determines number of repeats. If no value is given, then loop is endless
value range: 0 to 255
e.g.

' Typical dance beat
@SONGDATA
DATA ":0@129T120O2"
DATA "[C8A#8]16"
DATA 0


{Label=string} : Define macro
Assign chunks of note data (string) to a label (label)

{Label} : Use macro
e.g.

' Typical dance beat
@SONGDATA
DATA "{UNCE=C8A#8}"
DATA ":0@129T120O2"
DATA "[{UNCE}]"
DATA 0


$number = value : Using variables
e.g.

' 4 bars of UNCE
@SONGDATA
DATA "{UNCE=C8A#8}"
DATA ":0@129T120O2$0=16"
DATA "[{UNCE}]$0"
DATA 0


Note: can set and read variables using BGMSETV and BGMGETV()
---
"Put it in H!"
3 years ago#3
bump
---
"Put it in H!"
3 years ago#4
Great Job dude! I saved it to my files. This is going to help me a lot next month when I start messing with this.
3 years ago#5
Requesting sticky.
---
3DS FC: 1246 - 8713 - 6435
Heroes of Ruin, Kid Icarus Uprising, Mario Kart 7, Resident Evil Revelations, Super Street Fighter IV... it's all good to me.
  1. Boards
  2. Petit Computer
  3. Explanation of MML commands

Report Message

Terms of Use Violations:

Etiquette Issues:

Notes (optional; required for "Other"):
Add user to Ignore List after reporting

Topic Sticky

You are not allowed to request a sticky.

  • Topic Archived