Music Macro Language (MML) is a music description language used in sequencing music on computer and video game systems.
The term Music Macro Language (MML) was already in use by the early 1980s in descriptions of music-string syntax for personal computer BASIC dialects. One early documented example appears in BYTE magazine in May 1982, in an article on Japanese personal computers describing the OKI if-800, which states that âÂÂanother sublanguage called MML (Music Macro Language) is used.âÂÂ
Microsoft documentation for GW-BASIC later described the syntax used by the PLAY statement as âÂÂa music macro languageâ embedded in a string expression. This suggests that the term was associated with the textual command syntax used for computer music in Microsoft BASIC-derived environments by the early 1980s.
Music-string notation itself predates GW-BASIC, as evidenced by contemporaneous BASIC documentation such as the OKI BASIC manual, which describes the PLAY statement for musical sequences but does not use the term âÂÂMusic Macro LanguageâÂÂ.
The term MML is explicitly attested in published sources by 1982.
Early automatic music generation functions were used in arcade video games, which used many computer sounds. Early examples of arcade video game music chiptunes include Gun Fight (1975) and Circus (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.
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 () by SHARP Corporation, made in Japan at May 1978. Another Micro computer used a 5Bit D/A converter music automated reference signal. Also important was the development of a method to generate using BASIC software. The machine was assembled by Hitachi and made in Japan in September 1978. The MZ-40K used an open architecture and program sources, was therefore a kind of open source software.
The first commands for classical MML appeared in the internal architecture of the SP-1002 MONITOR IOCS and SP-5001 BASIC Operating Systems on the MZ-80K 8-bit computer. Made by SHARP Corporation at 1978 in Japan. It incorporated Intel 8253 hardware and memory mapped I/O. The sound-related BASIC Statements were MUSIC, TEMPO, and BEEP.
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.
Statements TEMPO n is 1âÂÂ9, the slowest 1.TEMPO 4 is similar T=120.
Below is the popular Japanese song "tà Âryanse" written using MML in MZ-731 SHARP 1Z-007B (SP-5001 Upper compatible).
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. With the 2001 release of the mck (Music Creation Kit) software for compiling MML to play music on the Nintendo Entertainment System, awareness and use of MML increased. MML is presently popular among Japanese electronic musicians and musicians who create chiptunes as a way to write music for the Nintendo Entertainment System.
Modern MML originated as a sub-language of BASIC, then generally included in ROM on micro-computers. A <code>PLAY</code> 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. 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:
In addition to these, most implementations add their own keywords and symbols for system-specific enhancements or extensions.
Below is a Modern MML transcription of Dance of the Cuckoos (with white-space for clarity, though some MML interpreters will require this to be stripped before playing).
<pre> t104 l4 > c16f16 a>c8<a c16f16 a>c8<a c8 b-8>c8<b-8 g c8 a8>c8<a8 f c16f16 a>c8<a c16f16 a>c8<a c8 b-8>c8<b-8 g >c8 <f2 </pre>
Below is the popular Japanese song "tà Âryanse" written using MML in PC-6001( NEC PC-6000_series ) N60-BASIC.It is listed for comparison with Classical MML.
Standard Musical Expression (SMX) is a variant of Modern MML provided by Microsoft in QBASIC, BASICA, and GW-BASIC's statement. The version used by GW-BASIC is part of the modern BSDs, FreeBSD, NetBSD, OpenBSD, and MirOS; see speaker(4) for the language.
The following example shows the same melody (Twinkle, Twinkle, Little Star) written using BASIC syntax in two early Japanese microcomputer MML dialects: BASIC for the Sharp MZ and NEC PC-6001 N60-BASIC. The comparison illustrates differences in syntax structure, command integration, and playback methods between early implementations of Music Macro Language.
Characteristics:
Example
In this implementation the musical data is constructed step-by-step as a BASIC string variable. The melody is expanded using string concatenation (`A$=A$+"..."`) before being passed to the `MUSIC` command for playback.
Characteristics:
Example
These examples illustrate how early BASIC-based MML implementations often relied on surrounding program structure, whereas later systems increasingly integrated musical control parameters directly within the MML command syntax.
Early forms of MML were commonly implemented in BASIC interpreters on Japanese 8-bit microcomputers during the late 1970s and early 1980s. Systems such as the Sharp MZ series and NEC PC-6001 allowed users to compose simple melodies using textual notation embedded in BASIC programs. These early implementations established conventions such as note letters, octave control, and tempo parameters that later evolved into more sophisticated MML dialects used in music drivers and game development environments on platforms including the NEC PC-8801 and PC-9801.
Early BASIC-based MML systems on Japanese microcomputers later influenced more advanced music drivers and composition environments developed for programmable sound hardware, including software such as Professional Music Driver used on NEC PC-9801 systems.