Remove ads
Programming language for generating computerized music From Wikipedia, the free encyclopedia
Music Macro Language (MML) is a music description language used in sequencing music on computer and video game systems.
This article's use of external links may not follow Wikipedia's policies or guidelines. (November 2024) |
Early automatic music generation functions were used in arcade video 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.[1]
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 (Microcomputer 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 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[3] and SP-5001 BASIC Operating Systems on the MZ-80K 8-bit[4] computer. Made by SHARP Corporation at 1978 in Japan.[5] It incorporated Intel 8253 hardware and memory mapped I/O. The sound-related BASIC Statements were MUSIC, TEMPO, and BEEP. [6]
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.[7]
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.
Below is the popular Japanese song "tōryanse" written using MML in MZ-731 SHARP S-BASIC 1Z-007B (SP-5001 Upper compatible).[8]
10 TEMPO 4
20 A$="E5R1E3R0D3R0E3R0E1R0D1R0-B4R1"
30 B$="F3R0F1R0F1R0A3R0F1R0E1R0F1R0E1R0D1R0D1R0E4R1"
40 C$="C3R0C1R0C1R0E3R0C1R0-B1R0C1R0-B1R0-A1R0-A1R0-B4R1"
50 D$="E1R0E1R0E1R0E1R0E1R0E1R0D1R0E1R0E1R0E1R0D1R0-A1R0-A1R0-B4R1"
60 E$="-A1R0-B1R0C1R0D1R0E1R0F1R0E1R0F3R1A3R1B1R0A1R0F3R0E3R0E1R0D1R0E4R1"
100 MUSIC A$+B$+B$
110 MUSIC C$+C$+B$
120 MUSIC C$+D$+E$
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.[9] With the 2001 release of the mck (Music Creation Kit) software for compiling MML to play music on the Nintendo Entertainment System,[10] awareness and use of MML increased.[11] MML is presently popular among Japanese electronic musicians[9] and musicians who create chiptunes[12] 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 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.[9] 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:[9][13]
cdefgab
— The letters a
to g
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, and f+2
an F♯ half note.p
— A pause or rest. Sometimes also r
, although the original IBM and Microsoft BASIC used p
,[14] as do all clones (e.g. the Linux and BSD speaker devices).[15] 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.
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).
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
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. [16]
10 A$="o4e2r32e4r32d4r32e4r32e8r32d8r32o3b2r16"
20 B$="o4f4r32f8r32f8r32a4r32f8r32e8r32f8r32e8r32d8r32d8r32e2r16"
30 C$="o4c4r32c8r32c8r32e4r32c8r32o3b8r32o4c8r32o3b8r32a8r32a8r32b2r16"
40 D$="o4e8r32e8r32e8r32e8r32e8r32e8r32d8r32"
50 E$="o4e8r32e8r32e8r32d8r32o3a8r32a8r32b2r16"
60 F$="o3a8r32b8r32o4c8r32d8r32e8r32f8r32e8r32"
70 G$="o4f4r32a4r32b8r32a8r32f4r32"
80 H$="e4r32e8r32d8r32e2r16"
100 PLAY "t120"
110 PLAY A$
120 PLAY B$
130 PLAY B$
140 PLAY C$
150 PLAY C$
160 PLAY B$
170 PLAY C$
180 PLAY D$
190 PLAY E$
200 PLAY F$
210 PLAY G$
220 PLAY H$
Standard Musical eXpression (SMX) is a variant of Modern MML provided by Microsoft in QBASIC, BASICA, and GW-BASIC's PLAY
statement.[9] The version used by GW-BASIC is part of the modern BSDs, FreeBSD,[17] NetBSD, OpenBSD, and MirOS; see speaker(4) for the language.[18]
PLAY
statement which takes a string argument in the SMX format.[19][20][21] 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".[22] 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.
PLAY
statement, as did several other implementations of BASIC produced or sold by NEC.[9][24]
BGMPLAY
functions, which can either take a preset MML track or one provided as a string.Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.