Music Macro Language
Music Macro Language (MML) is a music description language used in sequencing music on computer and video game systems.
MML is sometimes known as Music Markup Language, by conflation with the XML musical notation markup language of that name. For instance, what the video game Mabinogi refers to as "Music Markup Language" is actually a typical implementation of Music Macro Language.
History
The history of MML is related to the history of computing hardware.
Background
Early automatic music generation functions were used in arcade games, which used many computer sounds. An example of an early popular Arcade game with music is The Circus from Exidy Corporation in 1977.
The boom in Japanese video games was heralded in 1978 by the appearance in Japanese game centers (Amusement arcades) of Space Invaders by TAITO Corporation.[1] The Yellow Magic Orchestra used more sampling music motif in their games. Their sound has been reproduced on Moog synthesizers. Others were mostly played by acoustic instruments. The Circus and Space Invaders's music is both hard circuit music and sounds.
Many similar Space Invaders-style games were created. Melodic spinoffs are relevant to the development of MML, especially Melody part III, Space War PART III or the Music Invaders made by Sanritsu Electoric Corpolation in 1978.
The music was all proprietary (closed source). The 1978 release of the Programmable interval timer by Intel was significant. The Intel 8253 Mode 3 Square Wave generator was used for music, in the Kit computer MZ-40K(My computer Doctor (Maikon Hakase マイコン博士/まいこんはかせ)) by SHARP Corporation, made in Japan at May 1978. Another Micro computer BASIC MASTER MB-6880(ja)BASIC Master (BASIC Master ベーシックマスター) used a 5Bit D/A converter music automated reference signal. Also important was the development of a method to generate using BASIC software.[2] The machine was assembled by Hitachi, Ltd. and made in Japan in September 1978.
The MZ-40K featured an open architecture and program sources.[3]
Versions
Classical MML
The first commands for classical MML appeared in the internal architecture of the SP-1002 MONITOR IOCS[4] and SP-5001 BASIC Operating Systems on the MZ-80K 8-bit[5] computer. Made by SHARP Corporation at 1978 in Japan.[6] It incorporated Intel 8253 hardware and memory mapped I/O. The sound-related BASIC Statements were MUSIC, TEMPO, and BEEP. [7]
Syntax
Classical MML as used in BASIC is described here. "MML Commands" are supplied to the MUSIC statement. Notes are specified in a three-octave range. A song is a sequence of mono single tones.
"+" (or in some old code, " ̄") indicates upper octave, "- " (or in some old code, "_") indicates the lower octave. The characters "CDEFGAB" correspond to a scale ("Doremi Faso Lassi"). A semitone is indicated by following the note with a '#' character. The note names are followed by a tone length, indicated by a number from 0-9. Similarly, R indicates a rest, and is also followed by a number from 0-9 indicating length. Sound length Internal value × TEMPO values.Tone length Demisemiquaver is 0(SP-1002 Internal value is 1)- Whole note is 9(SP-1002 Internal value is 32). Music played on Call to $0030 SP-1002 IOCS program routine.[8]
Value | Length |
---|---|
0 | 1/32 |
1 | 1/16 |
2 | dotted 1/16 |
3 | 1/8 |
4 | dotted 1/8 |
5 | 1/4 |
6 | dotted 1/4 |
7 | 1/2 |
8 | dotted 1/2 |
9 | 1 |
Statements TEMPO n is 1-9, the slowest 1.TEMPO 4 is similar T=120.
Example
Below is the popular Japanese song "tōryanse" written using MML in MZ-731 SHARP S-BASIC 1Z-007B (SP-5001 Upper compatible).[9]
1 PRINT "TOORYANSE"
2 PRINT "ARRANGED BY"
3 PRINT " (C)2012 MOTOI KENKICHI"
4 PRINT " THANKS ALL WIKIPEDIANS."
10 TEMPO 4
20 A$="E5R1E3R0D3R0E3R0E1R0D1R0-G4R1"
30 B$="F3R0F1R0F1R0A3R0F1R0E1R0D1R0D1R0E5R0"
40 C$="C3R0C1R0C1R0E3R0C1R0-B1R0C1R0-B1R0-A1R0-A1-B5R0"
50 D$="E1R0E1R0E1R0E1R0E1R0E1R0D1R0E1R0E1R0E1R0D1R0-A1R0-A1R0B3R1"
60 E$="-A1R0-B1R0C1R0D1R0E1R0F1R0E1R0F3R1A3R1B1R0A1R0F3R0E3R0E1R0E4R0"
100 MUSIC A$+B$+B$
110 MUSIC C$+C$+B$
120 MUSIC C$+D$+E$
Modern MML
Modern MML originally appeared in Microsoft BASIC and was common in the early 1970s and 1980s on 8-bit and 16-bit era Japanese personal computers. The NEC PC-6001 included Microsoft BASIC and the Programmable Sound Generator in 1981. The MML was especially popular on NEC's personal computers, such as the NEC PC-8801.[10] With the 2001 release of the mck (Music Creation Kit) software for compiling MML to play music on the Nintendo Entertainment System,[11] awareness and use of MML increased.[12] MML is presently popular among Japanese electronic musicians[10] and musicians who create chiptunes[13] as a way to write music for the Nintendo Entertainment System.
Syntax
Modern MML originated as a sub-language of BASIC, then generally included in ROM on micro-computers. A PLAY
statement uses an argument to define a string of tones that the sound-chip played. MML code has a simple text format whereby letters and numbers are used to describe the musical notes to be played.[10] In addition, various implementations of MML add system extensions allowing parameters of audio synthesis to be altered with specialized commands or to simplify the entry of common musical figures such as arpeggios.
Though many platforms feature custom extensions and letter case requirements and other minor syntactical features vary slightly in some implementations, the fundamental syntax rules, commands and features that define MML and are present in whole or in part in all implementations are as follows:[10][14]
cdefgab
— The lettersa
tog
correspond to the musical pitches and cause the corresponding note to be played. Sharp notes are produced by appending a+
or#
, and flat notes by appending a-
. The length of a note is specified by appending a number representing its length as a fraction of a whole note — for example,c8
represents a C eighth note, andf+2
an F♯ half note.p
— A pause or rest. Sometimes alsor
, although the original IBM and Microsoft BASIC usedp
,[15] as do all clones (e.g. the Linux and BSD speaker devices).[16] The length of the rest is specified in the same manner as the length of a note — for example,r1
produces a whole rest.o
— Followed by a number,o
selects the octave the instrument will play in.>
,<
— Used to step up or down one octave.l
— Followed by a number, specifies the default length used by notes or rests which do not explicitly define one. For example,l8 g a b g l16 g a b g
produces a series of four eighth notes followed by a series of four sixteenth notes.v
— Followed by a number, sets the volume of the instrument. The range of values allowed is dependent upon the specific sound hardware being used. Some implementations also allow an ADSR envelope to be applied to the amplitude of each note.t
— Followed by a number, sets the tempo in beats per minute. On hardware with more than one sound channel, it is often possible to set each channel to a different tempo.
In addition to these, most implementations add their own keywords and symbols for system-specific enhancements or extensions.
Example 1
This example can be played using mml2mp3, a Web-based MML to MIDI / MP3 conversion system.[17]
#timebase 480 #title "The M.GAKKOU KOUKA" #copyright "Music Composed by Kenkichi Motoi 2009 Wikimedia version 2012" A t160 A o3l4 V12 A @1 ed8ce8 gg8er8 aa8>c<a8 g2r A aa8ga8 >cc8d<r8 ee8de8 c2r A dd8dd8 dd8dr8 ed8ef8 g2r A aa8ga8 >cc8<ar8 >dc8de8 d2<r A >ee8dc8< ab8>cc8< gg8ea8 g2r A >cc8<ge8 cd8ea8 gg8de8 c2r
Example 2
This was originally compiled on a Sharp PC-E500S Pocket computer using Ryu. T. Kobayashi's PLAY3.[18] After the NEC PC-9801 freeware games BGM Arranged,Appear the MML2MID MIDI version to Vecotor.co.jp(ja).[19]
#title "bottakuri-shouten(ORIGINAL)PLAY3->PMD->MIDI" #copyright "Music Composed by Kenkichi Motoi 1997 Wikimedia version 2012" #timebase 48 $g k100 $h k100 T C12 BT4,4 t150 T EX x41,x10,x42,x12,{x40,0,x7f,0},xf7 r48 ; GS-RESET T EX x41,x10,x42,x12,{x40,1,x39,6},xf7 ; GS-Chorus #6 G C1 H C2 I C3 GHI r8 H0,0@45 r8 o3 l8 ; Melody 1 G p64 v110 H p80 v60 I p32 v60 H < I > G [rrrr rrrr rrrr rrrr HI [cgcg cgcg cgcg cgcg G rrrr rrrr rrrr rrrr HI cgcg cgcg cgcg >c<ceg G >e<rrr rr>ef< rrrr >d<rrr HI >e<gcg cg>ef< dada >d<g+c+g+ G >e<rrr rrrr rrrr rrrr >e<rrr HI >e<gcg cgcg cgcg >c<gcg >e<gcg G rr>ef< rrrr >d<rrr >e<rrr HI cg>ef< dada >d<g+c+g+ >e<gcg G rrrr rrrr rrrr brrr HI cgcg cgcg >c<gcg b<b>d<b> G rrbg+ rarb r>crd erfr HI d<b>bg+ <d>a<d+>b <f+>>c<<g>>d e<e>f<f> G erd+ HI e<e>d+ GHI k32,2[d32]24 G $g HI $h G <ab>c c+<rrr HI <ab>c c+<c+c+c+ G rb>cc+ d<rrr r>def g HI c+b>cc+ d<ddd d>def g GHI H0,0 @44 H < I > GHI <<gb>c GHI gfed fedc edc<b GHI l16abababab abababab gagagaga gagagaga GHI g2 GHI r8 H > I < GHI @45 GHI l8>gab]2 GHI k110,-5,0 G rrrr rrrr rrrr rrrr HI cgcg cgcg cgcg cgcg G rrrr rrrr rrrr rrrr HI cgcg cgcg cgcg >c<ceg
Example 3
Now an example for “Modern MML”: “Alle meine Entchen”, a popular German beginner/children's tune.
o2l4t120 cdefg2g2 aaaag2 aaaag2 ffffe2e2 ddddc1
Example 4
This example (under The MirOS Licence) can be played, and converted to MusicXML, by MMLlib. Individual tracks can also be output to /dev/speaker
on BSD. The extended file format is, besides comment lines: one track per line; an empty line is like a line wrap in a score, any subsequent lines are appended to the previous tracks. Bars are used for synchronisation (not strictly necessary in MML but for Floppi-Music) and for MusicXML export.
# Title: Loreley
# Composer: Ph. Friedrich Silcher (1789–1860), 1837
# Lyrics: Heinrich Heine (1797–1856), 1824
# Arranger: Klavier: August Linder; MML: mirabilos
# Encoder: mirabilos, 2016
# Copyright: MML encoding & arrangement © 2016 mirabilos, published under The MirOS Licence; copyright for text, music, and piano arrangement has expired
# Source: Linder, August (Hrsg.): Deutsche Weisen : Die beliebtesten Volks- und geistlichen Lieder. Stuttgart: Albert Auer’s Musikverlag, n.d., c. 1900.
# Instruments: Piano, Voice
# MML Tracks: 4 (5)
# Verses: 3
# Language: German
# Tempo: Andante
# Time Signature: 6/8
# Key Signature: C Major
# Pickup Measure: 1/8
# Measures: 16
## Structure:
# Track 1: voice track
# Text embedded here, as comments (not exported) – roughly note-aligned
# Track 2: usually lowest voice double, except in bar 12
# Track 3: occasional helper
# Track 4: bass background
o2t76l8 g | mlg. mna16 g ml>c< mnb a | g4. f4 f |
# 1. Ich weiß nicht, was soll es be- deu- ten, daß
# 2. Die schön-______ ste Jung-___frau si- tzet dort
# 3. Den Schif-______ fer im klei-nen Schif- fe er-
o2t76l8 p | mle. mnf16 e mlf mnf f | e4. d4 d |
o1t76l8 p | p2. | p2. |
o1t76l8 p | mlc16g16>c<mng mlc16a16>d<mnb | mlc16g16>c<mng ml<f16>f16amnf |
e. e16 e mldmnc d | mle4. mnep g | mlg. mna16 g ml>c< mnb a |
# ich______ so trau-_rig bin?_____ Ein Mähr- chen aus al-____ ten
# o-_______ ben wun-_der- bar,_____ ihr gold’- nes Ge- schmei-_ de
# greift es mit wil-_dem Weh,_____ er schaut nicht die Fel-___ sen-
c. c16 c<mlbmna b> | mlc4. mncp p | mle. mnf16 e mlf mnf f |
p4. g4 g | mlg ppmnp4 p | p2. |
ml<g16>e16gmne <g4 g> | mlc<gemnc4>p | mlc16g16>c<mng mlc16a16>d<mnb |
g4. f4 f | e. e16 e g f d | mlc4. mncp e |
# Zei- ten, das kommt_____ mir nicht aus dem Sinn._____ Die
# bli- tzet, sie kämmt_____ ihr gol- de- nes Haar._____ Sie
# rif- fe, er schaut nur hin-auf in die Höh’._____ Ich
e4. d4 d | c. c16 c <b b b | p2. |
p2. | p p p d d f | mle ppmnp4 p |
mlc16g16>c<mng ml<f16>f16amnf |<g> g c <g g g> | mlc<egmnc4 p |
mld. mne16 d g d d | b4. a4 a | g4 g mlf#mng a |
# Luft_____ ist kühl und es dun- kelt und ru-hig fließt___ der
# kämmt es mit gol- de- nem Kam- me und singt ein Lied_____ da-
# glau- be, die Wel- len ver- schlin- gen am En- de Schif-fer und
mlb.> mnc16< b b b b | >d4. c4 c | <b4 p mlamn b> c<< |
p p p >d p p | g4. e4 e | d4 d<d4 d |
mlg> d mng<mlg> d mng< | mlg>dmng<mlc>emna | ml<d>dmnb p4 f# |
# The next measure missed an o1g as last eighth, to fit on four tracks
# (but it’s doubled by the o2g in the vocals, so it’s okay musically)
mlg4.mng4 g | g. a16 g>mlc<mn b a |
# Rhein;__ der Gi- pfel des Ber-____ ges
# bei;____ das hat ei-ne wun-_____ der-
# Kahn,___ und das hat mit ih-_____ rem
mlgb>cdc<mnb | >>e. f16 e mlfmn f f |
mld4.mnd4> f< | p2. |
mlb>defe mnd< | mlc16g16>c<mng mlc16a16>d<mnb | l16
mlg4mn> e d4 d | c. c16c ml<b mna b | ml>c4.mncp ||
# fun-______ kelt im A-_______ bend-son-_ nen-schein.__
# sa-_______ me, ge- wal- ti-ge Me-__ lo- dei._____
# Sin-______ gen die Lo-______ re-_ ley__ ge- than.____
mle4mn g f4 f | e. e16e ml f mnf f | ml e4.mnep ||
p2. | p p p g g g | ml gppmnpp ||
mlcg>mnc<pp8 ml<f>a>mnd<pp8 | ml<g>g>mncpl8p d c d | ml<cegmncp ||
Standard Musical Expression (SMX)
SMX is similar to modern MML. In SMX, note length is specified via an L command (e.g. L4) rather than by writing a number after the note.[20] This code was used by QBasic's PLAY command.[21]
Languages, platforms and software
- Epic Games's ZZT and Super ZZT, as well as the open-source clone named MegaZeux, use a very compact variant of MML for the PLAY command, with only one channel for the PC Speaker
- Microsoft's QBASIC, BASICA, and GW-BASIC all feature a
PLAY
statement which takes a string argument in the SMX format.[22][23][24] The name "Music Macro Language" may originate with GW-BASIC, which provided a facility "to play music by embedding a music macro language into the string data type."[25] The SBasic compiler from the German magazine DOS Extra, produced by DMV Widuch, offers the same PLAY command, and a few-line BASIC programme could be compiled into a small (few KiB) tool to play any MML files (often called *.PLY) given on the command line. - The NEC PC-8801's BASIC dialect, N88-BASIC, used MML in its
PLAY
statement, as did several other implementations of BASIC produced or sold by NEC.[10][26]- Chiptune composer Yuzo Koshiro created a heavily modified version. According to Koshiro, it "was more a BASIC-style language at first, but I modified it to be something more like Assembly. I called it ‘Music Love'. I used it for all the Bare Knuckle Games."[27]
- The mck, pmck, and ppmck utilities for creating Nintendo Entertainment System music, and a number of other tools for creating music for other hardware, such as the Bandai WonderSwan, the TurboGrafx-16, and the Sega Genesis.[12]
- The xpmck utility for creating music for various systems, including the Sega Master System, Sega Game Gear, Sega Genesis, Nintendo Game Boy and Commodore 64.[28]
- Some cellular phones utilize MML as a ringtone format.[29] The RTTTL ringtone language exhibits many of the characteristics of MML.
- An escape sequence was defined to allow terminal programs play music encoded in MML. Because of this music in MML is sometimes called ANSI Music.[30]
- On MSX computer system built in MSX BASIC also uses MML with PLAY-command. Comma separated strings represent separate voice channels. Music hardware expansions such as MSX-Music, MSX-Audio and MSX-MIDI expand PLAY-command so that also FM-chips and external MIDI devices can be controlled through MML.
- OpenBSD and MirOS BSD offer /dev/speaker[31] in a GW-BASIC-compatible format
- Sharp Pocket computer music routine PLAYX - MyArchive.Nihongo -> ja:ポケットコンピュータの製品一覧.
- Macrotune is a free MML editor available for Windows and OS X while also offering Shared libraries for software/game developers.
- Floppi-Music uses an extended format with a file header with metadata (such as Author, Title, etc.), a newline, and then one line for each staff, supporting multiple instruments, with bar lines. It’s designed to output to up to eight 3½″ floppy disc drives on Raspberry Pi GPIO ports. It also contains a standalone MML parser and MusicXML exporter library and utility, tested with MuseScore, allowing easy debugging of especially mass-parallel MML files, score sheet printing (ideally after some minimal postprocessing, but the defaults are usually legible), etc. – Floppi-Music and MMLlib is Free Software written in pure Python.
See also
References
- ↑ Compiled by "Tomohiro Nishikado" (西角友宏/にしかどともひろ) worked in the Pacific Industrial Co.,Ltd.All compiled alone.
- ↑ PDF file;Micro Computer BASIC MASTER MB-6880 Music method - Kunihiko (圀彦), Nagai (長井); Teruhiro (輝洋), Takezawa (竹澤); Kazuma (一馬), Yoshimura (吉村); KaTsutoshi (活利), Tajima (田島) (1979-04-26). "Hitachi Hyoron April 1979 Special Features:A micro-computer, the application method". digital.hitachihyoron. HITACHI. Retrieved 26 August 2013.
- ↑ Remains Apple Open technology by Steve Wozniak in 1977 like Apple Red book Apple Computers.
- ↑ "SHARP MZ.org MZ-80K monitor sub $0030". 2012-09-20.
- ↑ CPU is Z-80 Zilog Licensed Secondary source
- ↑ Nobuaki Ohishi (ŌishiNobuaki 大石信彰/おおいしのぶあき) (2012-09-20). "Nibbles lab.SHARP Museum,MZ-80K Photo and Catalog.".
- ↑ SHARP Corporation; nagusa_kei (1978). MZ-80 BASIC SP-5030 マニュアル. SHARP Corporation. p. 110.-Document(validation) Upper Version SP-5030 "twitter oec_Nibbleslab". 2012-09-22.-
"twitter PlayTrueName". 2012-09-22. Retrieved 2012-09-22."twitter(twilog) PlayTrueName". 2012-09-22. Retrieved 2012-12-28. SHARP Corporation; http://twitter.com/sharp_garapagos (1978). MZ-80 BASIC マニュアル. SHARP Corporation. p. 110. Cite uses deprecated parameter|coauthors=
(help) - ↑ "SHARP MZ.org MZ-80K monitor sub $0030". 2012-09-20./"SHARP MZ.org MZ-700 monitor sub $0030". 2012-09-20.
- ↑ Motoi, Kenkichi. "Viewpoint of the eye. She said "you playing" I'm crying/Awamomo Office". Retrieved 2012-09-20. Programmed and arranged by Motoi, Kenkichi. "Twitter @PlayTrueName Σ:D『So long time wake up to the◎Programming to sound of music". Retrieved 2012-09-22. Licensed #AAAP(Including Creative Commons CC-BY-SA and Text of GNU Free Documentation License.).
- 1 2 3 4 5 Selfridge-Field, Eleanor (1997). Beyond Midi: The Handbook of Musical Codes. Cambridge: MIT Press. ISBN 0-262-19394-9.
- ↑ "VORC Internet Chiptune Encyclopedia - mck". Archived from the original on 2008-01-03. Retrieved 2008-02-13.
- 1 2 "VORC Internet Chiptune Encyclopedia - MML". Archived from the original on 2007-11-23. Retrieved 2008-02-13.
- ↑ "VORC: VGM or Chiptune of The Year 2001". 2001-12-31.
- ↑ Johnson, Jeremiah. "MCK/MML Beginners Guide". Retrieved 2008-02-13.
- ↑ IBM BASIC manual, Second Edition (May 1982), Version 1.10
- ↑ MirBSD speaker device documentation
- ↑ Noike Kenji (野池賢二). "MML to MP3 with ぼーか郎(fileconv.cgi ver. 2.53.2)". Retrieved 2012-09-22. Composed and programmed by Kenkichi Motoi. "作曲してみる". Retrieved 2012-09-22. Licensed #AAAP(Including Creative Commons CC-BY-SA and Text of GNU Free Documentation License.)
- ↑ Kenkichi Motoi (基建吉). "E500 PLAY 3 music subroutine Programed By T.Kobayashi (Ryu) PLAY 3". Retrieved 2012-10-18. .PC-E500 PLAY 3 music subroutine (C) 1993 Programed By T.Kobayashi (Ryu)/93.11 separate journal pocket computer I/O Monthly engineering company (Ltd.)(ja) Graphic & Sound No. 71 of the quoted source.
- ↑ Kenkichi Motoi (基建吉). "Space panicco MIDI version of the BGM". Retrieved 2012-10-19. Licensed #AAAP(Including Creative Commons CC-BY-SA and [[:ja:Wikipedia:Text of GNU Free Documentation License. |Text of GNU Free Documentation License.]])
- ↑ Beyond MIDI: The Handbook of Musical Codes. ISBN 978-0-262-19394-8.
- ↑ see http://en.wikibooks.org/wiki/QBasic/Appendix#PLAY
- ↑ "QBasic manual". Microsoft Corporation. 1991.
- ↑ "IBM Personal Computer BASIC manual". IBM Corporation. 1982.
- ↑ "BASICA manual". Microsoft Corporation. 1982.
- ↑ "GW-BASIC manual". Microsoft Corporation. 1987.
- ↑ Koshiro, Yūzō. Interview with Kikizo Games http://games.kikizo.com/features/yuzo_koshiro_iv_oct05_p2.asp. Retrieved 2008-02-13. Missing or empty
|title=
(help) - ↑ Szczepaniak, John. "Retro Japanese Computers: Gaming's Final Frontier". Hardcore Gaming 101. Retrieved 2011-03-29. Reprinted from Retro Gamer (67), 2009
- ↑ Swimm, Peter (December 21, 2009). "XPMCK - Cross Platform Music Compiler Kit updated". True Chip Till Death. Retrieved December 29, 2011.
- ↑ "着信メロディは再び自分で作る時代に?──MIDIファイルやWAVファイルを着メロに変換". ITmedia, Inc. 2001-04-03. Retrieved 2008-02-13.
- ↑ "ANSI Music - The Technical Details". Retrieved 2009-01-16.
- ↑ speaker(4) manual page
External links
- mck compiler utility, which turns MML into Nintendo Entertainment System assembly language which can then be assembled into an NES program
- (Japanese) ppmck, an advanced patched version of mck with added features
- xpmck compiler utility, which turns MML into assembly language which can then be assembled into programs for various video game consoles. It can also convert MML directly to VGM files with support for the SN76489 and YM2612.
- (Japanese) mml2mid, a utility for converting MML to MIDI sequences
- Ultimate PPMCK MML Reference
|