[This local archive copy is from the official and canonical URL, http://is.up.ac.za/mml/specs.htm, 1999-06-10; please refer to the canonical source document if possible.]


scope | specifications | examples

Music Markup Language:
Specifications

For the purpose of the first phase of developing MML there are five main components (each with several subcomponents) important for marking a song:

The time and frequency elements are the basic structural elements of music.

The structural components of a song that are identified in MML are the following (in order from large to small):

Organization elements

Album / program

album
describes a series or list of songs or compositions

An album consists of a number of songs, listed sequentially. An agent should by default perform the songs in the order in which the songs appear in the list. This order can be overridden with a specific playlist.

In practice there are a number of words used for this concept, including the word "program". The word album is recommended as program is used in too many different contexts in the music environment. Meanings range from the order in which music pieces are performed at a concert, to computer programs and stored chunks of data on digital music devices (such as synthesizers). Using "program" as an element name may just contribute to further confusion.

An album can be declared as follows:

Markup example: song list

Here is an example of a list of songs on the 'album'.

<album>
<song src="oneday.mml" id="1">
<song src="rabbit.mml" id="2">
</album>

Markup example: mixed devices

Here is an example of mixed devices used for the album.

<album>
<song src="oneday.mml" id="1">
<device type="CD" program="5">
<device type="PC" url="http://www.music.org">
<song src="someday.mml" id="2">
<device type="CD" program="12">
</album>

Here are various aspects that should be kept in mind for album.

  1. An album is saved with the extension *.alb
  2. Default: A rendering machine must execute the list from top to bottom. This is the default. (Note the exception in 5 below).
  3. Devices or resources not found must be ignored
  4. Items in the list can be assigned identifiers with the id attribute
  5. Playlist (playlist): The actual instance of album rendering can take on an order that differs from the default playlist. This is usually user-defined.
User example

When a user chooses a particular album, the rendering device executes the songs in the album according to the default order. A user may set up his/her own playlist, in which case the rendering device will follow that order. It should also be possible for a user to specify the device used for rendering. For example, the user may have access to different devices (tape recorder, CD-player, MIDI-engine) and may possess versions of a song for each of these devices. In the playlist the user can then stipulate which device should be used.

Top

Playlist

playlist
a user defined list of the order in which songs should be played; selection of songs

The playlist is based on the list of songs in an album. The playlist can call on songs either by their full URN or URLs, or by their ids. The playlist can call upon songs from different albums.

A playlist can be declared as follows:

A playlist can be declared in the head of the *.mml file, or in a separate *.pla file that is called with the link element.

Example

In this example the order in the album is reversed in the playlist.

<album>
<song src="oneday.mml" id="1">
<song src="rabbit.mml" id="2">
</album>

<playlist>
<song id="2">
<song id="1">
</playlist>

Example of songs from different albums

<playlist>My favorites
<album href="wanda.alb">
<song src="oneday.mml">
</album>
<album href="bunnies.alb">
<song src="rabbit.mml">
</album>
</playlist>

Top

Head

head
contains any information that is not regarded as part of the music content

The head element functions like the head element of any SGML document. It contains all the metadata, links and the song title.

Markup example

<mml>
<head>
<title>My song</title>
<meta performer="Joe Blu">
<octave>3
<key>Cmaj
<tempo>120
</head>

<song>
...
</song>
</mml>

Top

Title

title
identifies the content of the music document

The title element is contained in the head of a song file.

Markup example

<mml>
<head>
<title>My song</title>
</head>

<song>
...
</song>
</mml>

Top

Meta

meta
specifies metadata -- ie information about the music document itself rather than music content

Metadata contains information about a song or album. The structure of the meta element is as follows:

element declaration keyword value

Reserved keywords are used as "fields" to identify the kind of metadata. Here is a tentative list of possible keywords:

See Global song naming scheme.

Example

<meta performer="Joe Blu"
date="Fri, 01 May 1998 22:30:00 GMT"
version="Unplugged"
concert="Smokin' Blues"
venue="Hillbilly Inn"
place="New Haven"
>

Top

Song

song
A song is a piece of music regarded as a single or autonomous stretch of music.

This definition is very loose and what is regarded as an autonomous song probably depends on the composer.

The SDML cantus (ie Latin for "song") is similar to the MML song. The words "song" and "composition" have similar meanings in this context.

However, a song in MML also refers to structural performance and sound manipulation elements, thus "composition" is too limited. From a melodic point of view, a song (usually) consists of several music phrases.

The song element takes the name attribute and various others.

Markup example

<mml>
<head>
<title>My song</title>
</head>

<song>
<bar 2>[A D] [3G D] ([3G E])2
<bar 3>[A D] [3E E] ([3E C])2
<bar 4>[3E:2 B:2] R [B E]

...
</song>
</mml>

Top

Phrase

phrase
a phrase is a piece of music that is a subsection of a song

The typical structure of popular music usually consists of three phrases, an A and B part and the chorus.

Verse 1 Phrase A
Verse 2 Phrase A
Chorus Phrase B
Verse 3 Phrase A
Chorus Phrase B
Chorus repeated Phrase B

A phrase can also be a smaller unit. Features that are applied to a phrase, such as a change in tempo, are valid for that phrase only.

Top

Bookmark

bookmark
for indicating a location in the song body

For a bookmark the id and idref attributes are used as in SGML or HyTime. A public or system identifier is indicated. Any object can be linked to an MML "document". External objects need to be delcared firts, then called from within the body of the song.

Creating a bookmark typically consists of three steps:

Declaring the link to an object

Here is an example of declaring the linked entity:

<!ENTITY soundone SYSTEM "http://www.songs.org/wow.wav">

Anchoring the object in the song

The linked location is anchore din the boy of the song with the HyTime "name location" (nameloc) element. At the objects intended location in the body of the song, add:

<nameloc id="1">

Creating the link

Links to the object can be made from many different other locations. The HyTime element clink (pronounced "c-link") element with the linkend attribute is used.

<clink linkend="1">Follow this link</clink>

Top

Link

link
defines a link between different music-related files

The link element links the *.mml file to other files (see the list of possible files). The link element is empty and is declared as content of the head element.

Example

...
<head>
<link rel="wow.tun">
<link rel="mine.ins">
</head>
...

Top

Accent

accent
the relative loudness of beats in a bar

Music can be described in terms of rhythmic patterns of accent -- not all notes in a bar have the same loudness. So apart from pitch and time, there is also the emphasis which notes receive. This relative emphasis is declared with the accent element. Accent values are expressed as percentages compared to the loudest beat in the song, or alternatively, th eloudest beat in a phrase (in which case accent needs to be a child of phrase).

Example

Here is an example of the long form of the accent, ie beat number are indicated.

<accent> 1:10 2:15 3:20 4:15 </accent>

It is not necessary to explicitly accentuate each beat. Only selected beats may be highlighted:

<accent> 2:15 4:15 </accent>

Non-explicit beats should then take the average accents of the whole song or phrase.

Example

Here is an example of a repeated note with different accents (in this case it is a snare intro).

<bar 5>...
<div> :8
<ins>snare
<octave>3
<bar 6 (:16)8>D
<accent> 65 70 75 80 85 90 95 100</accent>
<bar 7>...
<ins>crash
<bar 6>(R:4)3 Fs
</div>

This is translated into English as follows: The division's default note value is 1/8 notes. Bar 6 consists of 8 1/16th D-notes in octave 3. The notes become progressively louder from the first (65%) to the last (100%). On beat 8 there is a crash cymbal (note F-sharp) in the same octave. There are 3 1/4 rests in bar 6 before the crash.

This example would describe a snare intro that ends together with a crash cymbal.

Top

Classes

The classes element allows the creation of author defined shorthand descriptions. Instead of declaring a list of elements at each instant, a series of classes can be declared and instantiated by calling on the class name.

Example

Consider the score of Musorgsky's Boris Godunov. There are 8 C staffs totalling 40 bars on the first page. Instead of repeating the detail for all the similar bars, a class can be declared that is called.

<head>
<classes>
.basic {
key Fs Cs Gs Ds;
time 4:4 }

</classes>
</head>
<song>
<staff.basic>1</staff>
<bar 1:4> R </bar>
....
</song>

Division

The function of the div element is similar to the HTML element in that it marks a blocklevel structure. It differs in that an identifier name can be declared in the div start tag, to be called upon in another (or more than one) element instance.

The application of this is as follows. The features declared for the division apply to all the children -- except where declared otherwise.

Example

Say there is a section of music that is repeated exactly the same at different locations in the song. At the first occurrence, mark the section with the div element and assign a unique identifier name to it by using the declare attribute. At each other instance where the section should reappear, call on that unique identifier with the repeat attribute and the unique identifier name.

See the Identifier method for repeating parts of music.

Span

The function of the span element is similar to the HTML span as it also marks inline level structures. It differs in that an identifier name can be declared in the span start tag, to be called upon in another (or more than one) element instance.

Example

In this example an id is declared with the name one.

...
<bar 2>D:2 B:4
<span declare id="one"><bind><slur>5(B C D An B A Gs A C Gb) </slur></bind></span>
</bar>
...

At a later instance, in this case Bar 10, the exact sequence of notes can be called upon with the repeat attribute as follows:

...
<bar 10>D:2
<slur id="4" end>B:4</slur>
<beat 4 repeat id="one">
</bar>
...

This example comes from the MML of Chopin's Trois Nocturne. Also see the Identifier method for repeating parts of music.

Comment

A comment by the markup author in the code is marked just as in SGML:

<!-- this is a comment -->

Top

Repetition

Music often consists of repetition on various structural levels. It would be very uneconomical to expect explicit markup for elements that are repeated endlessly. For this reason MML deviates somewhat from most other markup languages by introducing a convention for marking repetitions.

Repetition can be declared with a notation method, or by declaring an identifier name for a section of music.

Top

Notation method

Syntax of MML repetition

Repetition is indicated with the round brackets usually used for parenthesis:

( and )

The number of times the element should be repeated must be written after the close parenthesis symbol.

Example

Here is the comprehensive markup for a division including five bars:

<div>
<bar>...
<bar>...
<bar>...
<bar>...
<bar>...
</div>

Here is the short form of the above example:

<div (bar)5>

This is read as: In this division, repeat the bar element and its content five times.

Nested repetition

A repeated element may contain another element that is repeated as its content.

Example

In this example the same note is repeated in in several bars, and the bars are contained in a division.

<div (bar (note 2D:4)4)5>

This is translated into English as: There are five bars in the division. Each bar consists of four notes with the value: a D quarter note in the second octave.

Range

The above examples do not specify the position where the repetition occurs. MML allows for specifying a range, with the range element. Two numbers are stated in the range: where the range begins and where it ends. What the range refers to depends on its context.

Example

In this example the range applies to bars. The first value of the range indicates the bar number where the range begins, the seconds number the bar number where it ends.

<div (bar(range 6:10)5>

This states that within the division there are five repeated bars beginning with bar 6, ending with bar 10 (see the Note on calculations).

Exception

Repeated music phrases may contain almost exactly the same content, perhaps with a deviation somewhere along its progression. The repeated phrase can be declared with the repeat attribute, whilke exceptions within the repeated sequence are declared with the exclude attribute. Exclusion can be declared in the same manner as a range, ie beginning with the excluded element number and ending where the exclusion ends.

Example

<div (bar(range 6:10 exclude 7)5>

In this range of 5 bars (in the division) beginning with bar 6, ending with bar 10 the 7th bar is excluded.

Example: excluding a range

<div (bar(range 16:30 exclude 20:22)15>

In this range of 15 bars (in the division) beginning with bar 16, ending with bar 30, 3 bars (from 20 to 22) are excluded.

Identifier method

With the identifier method the section of music that needs to be copied at other instances is marked with the span or div elements, or that of the parent element of the phrase. Using these elements' declare attribute, a unique identifier name is declared. This identifier name is later used with the repeat attribute. The exact music sequence will then be repeated.

The following example comes from the MML of Chopin's Trois Nocturne.

Declare attribute

In this example an id is declared with the name "one".

...
<bar 2>D:2 B:4
<span declare id="one"><bind><slur>5(B C D An B A Gs A C Gb) </slur></bind></span>
</bar>
...

Repeat attribute

At a later instance, in this case Bar 10, the exact sequence of notes can be called upon as follows:

...
<bar 10>D:2
<slur id="4" end>B:4</slur>
<beat 4 repeat id="one">
</bar>
...

Top

Note on calculations

When calculating a number of elements remember that when you add or subtract you apply the calculation to a spanned series. In other words, 10-5 does NOT equal 5, but 6, as the starting point (number) should be added as well.

In ordinary maths 10-5=5.

However, consider the following bars

bar 1 bar 2 bar 3 bar 4 bar 5 bar 6 bar 7 bar 8 bar 9 bar 10

Begin at bar 10 and count five bars to the left. You will end at bar 6. This is because you are counting spans. Remember to keep this in mind otherwise you will end up with included bars you actually wanted to exclude.

Top

Special characters and symbols

The characters and symbols in this section have a special meaning in MML.

Simultaneous (or vertical) and sequential (or horizontal) groups

Music often consists of groups of events on two different planes. A set of events can occur simultaneously, such as a group of notes that are played together, and vertically displayed in the visual staff notation. A set of events can also occur sequentially one after another, horizontally displayed in the visual staff notation. For each of these kinds of sets different notation is necessary.

Simultaneous (vertical)

In MML simultaneous events are grouped together inside the square brackets [ and ].

Example

Here is an example of notes that are played simultaneously:

3[A C E]

The notes A C and E form a chord group in octave 3.

Sequential (horizontal)

In MML sequential events are grouped together inside the round brackets ( and ).

Example

Here is an example of a sequence that is repeated 5 times:

(A B C)5

Example of octave

The octave can be declared either with the octave element, or with the octave number preceding the note name, as in this long form:

5B 5C 5B 5D

This can be written in a short form as:

5(B C B D)

If this sequence is to be repeated, it is written as:

5(B C B D)4

This sequence is repeated 4 times.

Note

The sequence 5( B C B D):4 has a different meaning -- each note is a quarter note. A colon preceding a number inicates note length value. If this sequence is to be repeated 4 times, the markup is: 5(B C B D):4)4 .

Simultaneous and sequential together

In this long form example the groups of notes to played simultaneously are all in the 5th octave:

[5B 5D] [5C 5E] [5B 5D] [5D 5Fs]

The short form for this is:

5([B D] [C E] [B D] [D Fs])

If this sequence is to be repeated 3 times, it is indicated as follows:

5([B D] [C E] [B D] [D Fs])3

Note that in the following example the octave number 3 applies only to the note Gs (in octave 3). A number immediately following square brackets (which indicate simultaneous notes) does NOT indicate multiplication.

<octave> 4
<bar 6:4> [A:8 D]3Gs:8

This is translated as:

All notes occur in octave 4, except when stated otherwise. Bar 6 consists of quarter notes. Notes A and D are played together. Note A is an eighth note, to be followed with an eighth G-sharp note on octave 3.

Dotted note

In staff notation a dot following a note indicates that its length value is doubled. The period is used in MML for the dot. Note that the application of this should be monitored so as not to confuse the period with the class attribute. Class attributes are contained within start tags (eg <bar.classone> ), while the period for the dotted note occurs only as content of an element between the start and end tags (eg <bar>A.</bar> ).

Example

In this example in bar 8 consisting of quarter notes there is a vertical (ie simultaneous) group of minims, each with a dotted value.

<bar 8:4> [E A]:2. </bar>

The dotted note is relevant in notation, not to the structure of music.

Top

Time

Reduced very crudely, music is a function of time and frequency. Music events follow on one another through the arrow of time. Of course there can be more than one music event taking place at the same time, which distinguishes music from, for example, speech. It is difficult for us to understand when more than one person speaks at the same time (except in a speech choir). Yet modern music is typically multitimbral with many music events happening at the same time. One characteristic of the time aspect of music is repetitions of various kinds, of which rhythm is one.

Top

Rhythm

Rhythm
the cyclical repetition of a recognizable stress pattern through time

Rhythm has two components: beat and tempo.

Top

Tempo

tempo
maps relative time units to absolute time (is the "speed" of the song)

In MML tempo maps relative units (bar, beat and tick) to absolute time (minute, second, millisecond). Tempo is most often measured in terms of beats per minute (BPM) -- this method will also be used in MML.

Relative unit   Absolute unit
beat per minute
second
millisecond (ms)
Syntax

The syntax of the tempo declaration is:

relative unit (ie beat) : absolute unit

This is read "Relative unit per absolute unit". The colon is used in MML for the word per.

The tempo element with different absolute values

This tempo will be valid for the entire song except when overridden by a new value for either a bar, beat or tick.

<tempo> 90:m
<tempo> 1.5:s
<tempo> 0.0025:ms

Example

In this example the default tempo is 130 beats per minute

<tempo>130

Tempo can be declared in different locations:

Gradual increase or decrease of tempo

Music may gradually slow down or increase in pace. One should be able to mark the starting point of the gradual change in tempo and the end point. Electronic devices should be able to calculate the gradual change.

The gradual increase and decrease in tempo are indicated with numerical values of the gradual attribute. The specified value should be the target value. The bar number at which the target should be reached is indicated with the target attribute.

Example of gradual increase in tempo

In this example the tempo of bar 26 is stated as 105BPM to gradually increase to 120BMP by bar 30.

<bar 26>
<tempo "105" gradual="120" target="30">
...
<bar 50>

If this music has to gradually decrease in tempo from bar 26 to 30, the markup is:

<bar 26>
<tempo "105" gradual="95" target="30">
...
<bar 50>

Humanization

Music performance very seldom conform to strict metronomic time. In the MIDI world the concept of humanization was introduced to change computerized music to be less machinelike. This is usually done by randomly changing different time aspects of the song.

Example

Humanization is indicated as a percentage variation in terms of the base tempo. If the base tempo is 120BMP a variation of 10% will increase the tempo to 132BPM or decrease it to 108BMP. This is declared with the random attribute.

<tempo 120 random="10%">

Top

Time

time
the abstract time aspect of the repetition (ie of the beat) of music events

Time is usually indicated in notation as: 4/4, 6/8, 7/4 etc. The second number indicates the dominant or base note length of the bar, the first number indicates the number of beats in the bar. The time element is used to mark time in a song.

The time element needs to be stated only where the time signature changes.

Example of 4/4 time

<time> 4:4

Time could also be stated in the short form in the start tag of the relevant element:

<bar 4:4>

Bar

bar (or measure)
signifies a group of notes within the abstract rhythmic pattern of a phrase of music

The bar concept relates to the bar (or measure) in written notation. The MML bar element, however, is more abstract than the bar notation and is a unit of abstract time. Usually, for most popular music, there is a one-to-one relation between bar and the notation "bar". Esoteric music that cannot be described with a notational bar could conceptually be described with the bar element, as long as there is a rhythmic pattern. Obviously the bar element would be irrelevant for non-patterned music.

A bar contains a relative time unit such as a minim, quarter, eighth, etc.

A bar typically consists of a number of beats, and beats in turn of ticks. A bar with a time signature of 4/4 typically consists of four beats in the bar.

Bars in the song are numbered sequentially. Bars are structural units and used as reference points. The content of a bar typically contains note values.

Bar number

The bar number is indicated with the barid (read bar-id) attribute. Each bar should get its unique identifier name. As there are so many repeated structural elements in music that need unique identifiers, additional id attributes are introduced, of which barid is one.

Example: long form

<bar barid="1">
<bar barid="2">
...
<bar barid="n">

Example: short form

<bar 1>
<bar 2>
...
<bar n>

Bar number plus note length value

Example: long form

<bar barid="1" notevalue="4">
<bar barid="2" notevalue="4">
...
<bar barid="n">

Example: short form

<bar 1:4>
<bar 2:4>
...
<bar n:4>

Top

Beat

beat
periodic emphasized repetition of music events

A beat in a bar can typically be emphasized with drums -- but keep in mind that there is a beat even in the absence of accentuated rhythms. The beat is a relative time value. A beat may contain several notes, either a set of simultaneous notes or sequential notes.

The relative time unit of the bar indicates how many beats are in the bar. A bar with a relative time unit such as 6/8 indicates that there are 6 beats in the ba, each with a relative length of an eighth.

The beat element does not need to be stated explicitly. A sequence of notes in a bar automatically indicate beats, thus by default a 6/8 bar will take 6 beats, each note name given falling on a beat. Notes with non-beat values need to be declared explicitly.

Beat declaration also take long and short forms in exactly the same way as do bars.

Example

In this example each note represents a beat.

<bar 3>F G A C

A beat can be subdivided sequentially as follows.

Example

This 3rd beat of bar 6 consists of 3 consecutive notes. They are numbered in the order of appearance.

<bar 6>G B
<beat 3>A F C</beat> G </bar>

To identify each note in this beat sequence the notes are marked in the order of appearance, in this case as follows:

A = beat 3:1
F = beat 3:2
C = beat 3:3

To mark note F in beat 3 in this example with special features, use the following markup:

<bar 6>F G (A F C):16 G
<beat 3:2><slur id="5" begin>

Top

Tick

tick
the smallest relative unit of time

Ticks are relative units of time measured in terms of fractions of a quarter note. In MML there are 384 ticks per quarter note.

Here is a table with tick values related to other note values.

Note value Tick value
whole 1536
half 786
quarter 384
eighth 192
sixteenth 96

Note value Tick value
dotted quarter 576
dotted eighth 288
dotted sixteenth 96

Note value Tick value
eighth triplet 128
sixteenth triplet 64

Top

Note length values

Relative lengths

Note lengths in Western notation are relative and not absolute. Conventional relative note lengths are:

Latin English Numerical MML notation
semibreve whole 1 none
minim half 2 2
crotchet quarter 4 4
quaver eighth 8 8
semiquaver sixteenth 16 16
demisemiquaver thirty-second 32 32
hemidemisemiquaver sixty-fourth 64 64

Absolute lengths

Absolute note lengths can be given in milliseconds, ie ms.

Example

<beat 3>3C: 210ms
</beat>

Read: a C note in the third octave, 210 ms long.

Dotted notes

These relative lengths can be modified by extending their relative values, indicated in Western Notation by dots.

Top

Frequency

Music theorists distinguish between the possible notes in an "octave" and the actual notes. Possible notes are called the gamut, actual notes are expressed in terms of the so-called naturals and their variations. The cent is the smallest useful unit of frequency difference. One octave consists of 1200cent in the equally tempered tuning system.

Cent

cent
the smallest relative unit for measuring frequency differences between notes (ie the interval)

Keep in mind that both octave and cent are relative units.

There are 1200cent in one octave. Average users can tolerate deviances of up to 50cent from a base note, while professional musicians pick up differences between 10 - 20 cent. A well-trained musician with good discriminating abilities can pick up differences of as little as 5cent.

From a machine perspective frequencies can be analyzed in terms of much smaller unites. Such absolute value frequencies are measured in Herz (Hz).

The cent is usually written as a "c" character with a vertical slanted line through it, ie ANSI 155 (¢, or &cent;).

See the table showing the difference between just intonation and equal temperament.

Top

Note

note
a specific pitch of frequency within a certain framework of frequencies

Notes can be expressed absolutely as frequencies, or relatively with conventional notation. A note is also expressed in terms of its duration (see the Note length values)

Relative note values

Note names:

A
B
C
D
E
F
G

These note names refer to the so-called naturals.

When these relative note names are used, the octave should also be declared, eg 3C refers to note C in octave 3.

Example

Here are a few C notes, each in a different octave:

3C
7C
4C
2C

Notes values:

Apart from the note name, referring to pitch, its length is also important. In Western staff notation relative length units are as follows:

1 = whole
2 = minim / half
4 = crotchet / quarter
8 = eighth
16 = sixteenth
32 = thirty-second
64 = sixty-fourth

In MML convention a length units number follows the note name., separated with a colon.

Examples

Here are examples of an A note with different relative note length values.

A:2
A:4
A:8
A:16
A:32
A:64

The default is the whole note. However, a songs as a whole, or any part of it, may have a different default note length. To have economical markup it is advised that a default value be declared for smaller structural units, for example on beat level.

Examples

Here is a bar (bar number 20) with eighth notes as default:

<bar 20:8>

Here is a beat with sixteenth notes as default:

<bar 20:8>
<beat 3:16>

Absolute note values

Absolute note values are expressed in terms of frequency noted in Herz (Hz). When all notes are expressed absolutely, there is no need to state octaves.

Top

Octave

octave
a distance of eight scale degrees or steps between the 'white notes' in a set of notes; contains a set of notes, each of which is in a 2:1 relationship with their counterparts in another set, ie in another octave

Also see scale.

The name octave is derived from Latin referring to the eight white notes on a keyboard that form a set. Octaves are repeated cyclical at higher or lower frequencies.

Together with the 5 black notes there are 12 notes in an octave. This is only in Western tempered music. Other music systems may have only 5 notes to the "octave", or even in excess of 20 notes.

A seven-octave piano keyboard ranges in frequency from about 20Hz to 5'000Hz. There are different conventions for numbering octaves, such as the Helmholz method, (starting about in the middle of the piano keyboard and numbering outwards, thus a dual method) and the method used by music physicists (starting at one end, the lower end, and numbering serially upward).

An octave can be indicated with two methods:

When the octave number is indicated together with the note name, the number in MML precedes the note name.

As 20Hz is about the lowest audible frequency (note that lower frequencies are not so much heard as felt), numbering octaves in MML will begin with octave 0 (ie zero) at A= 27.5Hz given a certain tuning system. Conventions usually indicate the octave number as a subscript after after the note name, eg C4. This is impossible in markup code. In MML the number will precede the note name, thus middle C is 4C because it is in the 4th octave.

The octave may be declared once in the head of the song, assuming that it will not change during the course of the song. A change in octave can nevertheless be declared as a child of the song element.

Values:

The human ear is capable of hearing sounds in the range of frequencies 20Hz to 20KHz (or most likely, 17-18KHZ). Music typically ranges between 2 to 5KHz, however, the 2' pitch pipe organ reaches 8'372Kz. Harmonics of cymbals reach up to 16'000Hz (octave 9 in the table below). Here is a table showing the frequencies of A notes in different octaves, given 4A = 440HZ.

Concert tuning: A=440Hz
Octave number Helmholz number Approximate frequencies for first A of each octave
0   27.5Hz
1 A, 55Hz
2 A 110Hz
3 a 220Hz
4 a' 440Hz
5 a" 880Hz
6 a"' 1'760Hz
7 a"" 3'950Hz
8   "7'900Hz"
9   "15'900Hz"
Octaves 8 and 9 above are theoretical octaves.
The approximate frequencies is for a given tuning (for A = 440Hz). When A has another value (eg 442Hz), the frequencies of the other notes will also be different.

In MML the information above is typically contained in a mapped file. For A=440 the filename is 440.mmm, and for A=442 the filename is 442.mmm. Also see tuning.

Example of octave element

<bar 3>
<octave> 4
</bar>

Markup example in head

...
<head>
<title>My song</title>
<octave> 4
</head>
...

Markup example in song

...
<song>
...
<octave> 4
...
</song>
...

Example of octave number with note

Here are a few C notes in different octaves.

5C
3C
2C
7C

Example of different octaves in a single bar

<octave>3
<bar 21>A 4A 2A A

Read: there are four A notes each on a different beat. A on beats 1 and 4 are on octave 3; the second beat on octave 4, the third on octave 2.

Top

Scale

scale
a scale determines the relationships between notes and is used for tuning these relationships

scale

The scale determines which base frequencies are allowed within a set of notes. There are many different scales used in different cultures. In Western music the dominant scale consists of 12 tones in an octave. Other music systems, such as the Javanese gamelan or Indian raga use other configurations.

Even in Western music there are a few different scales in use. Due to a certain tradition the so-called equal temperament currently dominates Western culture and global popular music. In the equal temperament system the octave is divided equally between the notes. From a physics point of view this results in an out of tune scale, but our ears are so accustomed to it that it sounds right.

Here are some of the other scales that have been used in the West:

Scale beginning note
Aeolian A
Locrian B
Ionian C
Dorian D
Phrygian E
Lydian F
Mixolydian G

Avante garde composers in twentieth century West have experimented with as many as 19 and 24 tones to an octave, but this music has not reached the masses. In order to be globally relevant, MML will have to consider these other schemes.

Top

Sharps and flats

Accidental
a natural note may be raised or lowered in relation to a "natural" note inside a bar

The notion of sharps and flats applies only to music notation or in terms of temperament. In terms of frequency it is irrelevant.

For a whole section of a song lowered or raised notes are usually indicated immediately after the clef. Accidentals are used for a small part of the song (eg inside a bar) that requires lowering or raising of a note with respect to "natural" notes.

This is indicated with the accidental sign, in the MML with the lowercase 's' or 'f' sign.

Sharp
a note raised by a semitone with respect to a natural note

The sharp is indicated by the lowercase 's' character.

Example

The C4 note raised by a a semitone is thus indicated as C4s (ie C-sharp in the 4th octave).

Flat
a note lowered by a semitone with respect to a natural note

The flat is indicated by the 'f' character.

Example

The D4 note lowered by a semitone is thus indicated as D4f (ie D-flat in the 4th octave).

Double sharp
a note raised by two semitones with respect to a natural note

The double sharp is indicated by the 'ss' sign.

Example

The C4 note raised by two semitones is thus indicated as C4ss

Double flat
a note lowered by two semitones with respect to a natural note

The double flat is indicated by the 'ff' sign.

Example

The D4 note lowered by two semitones is thus indicated as D4ff.

Canceling sharps or flats

A certain key "naturally" containing certain sharps or flats, such sharps or flats may be canceled or naturalized at specific instances.

Canceling a sharp or flat: h

Canceling a double sharp or flat: hh

Top

Tuning

tuning
the adjustment of note pitches in relation to other notes

Tuning is not so straightforward as it appears to be, especially on fixed pitch instruments such as keyboards. Tuning is based on the notion of scales, and there are many different scale systems in use all over the world, even within the tradition of Western music. Notes within the dominant Western scale stand in certain mathematical relationships to one another. The Pythagorean scale commonly used in Western music emphasis's thirds and sixths as consonances (ie notes that sound good together with the base note). When the frequencies of notes are calculated on the basis of the ratios between notes, the direction in which the calculations are made is important. Moving up the scale gives one answer, moving down gives another answer. For this reason the G-sharp and A-flat notes have different frequencies, yet there is only one note-key on a keyboard for both. Organs and harpsichords often provide separate keyboards for these different notes -- so that a performer could play a G sharp that differs in frequency from an A flat (which have the same frequency on standard keyboards).

To accommodate different tuning possibilities, MML will map a tuning file to the markup file.

There are two important notions here:

Base frequency

In Western music the note A is usually used to tune other notes by. In practice different frequencies are used for A (either 440Hz or 442Hz), which means that other notes then are also tuned to different frequencies.

Example

In MML the frequency of the referenced A (or other note) should be indicated.

<tuning> 4A:440

or

<tuning> 4A:442

Relationships between notes

The base frequency itself serves as a reference point. Other notes are in certain relationships to the base note, and their exact frequency values depend on the system of tuning.

Here are the major tuning schemes, based on the frequency relationships between notes.

As different tuning systems can be implemented, a markup file (*.mml) should map tuning data from a data file containing tables of frequencies. Such tuning files should be saved as *.tun or *.tuning files.

This table shows the difference between just intonation and equal temperament in frequency.

Major scale Chromatic scale Equal temperament Just intonation How far equal is off just
1 1 0 0 0
  2 100 111.73 11.73
2 3 200 203.91 3.91
  4 300 315.64 15.64
3 5 400 386.31 -13.69
4 6 500 498.04 -1.96
  7 600 590.22 -9.78
5 8 700 701.96 1.96
  9 800 813.69 13.69
6 10 900 884.36 -15.64
  11 1'000 996.09 -3.91
7 12 1'100 1'088.27 -11.73
8 13 1'200 1'200 0
Values are in cent (¢)

Top

Lyrics

lyric
the language words sung or spoken together with music melody

Different lyrics are often repeated for similar musical phrases as verses. It is thus necessary to indicate the applicable verse number in certain contexts with the verse attribute. Lyrics can be written as content of the song element, or in a separate file with the *.lyr extension.

Example

In this example the lyrics for verses 1 and 2 are mapped on the same bar sequence. The bar is the parent element -- as lyrics are usually matched to music. Where music should be matched to lyrics, the task is much more complex.

In MML it should not be necessary to delcare a lyric element for each bar. Lyrics should continue along the bars until stopped with the end tag. For bars without lyrics either the lyric element should be ended, or empty piped syllables should be indicated.

<bar 1>...
<lyric verse="1">blah blah blah </lyric>
<lyric verse "2">blah2 blah2 blah2 </lyric>

Top

Stretch and squash

There is not always a one-to-one relationship between the serial instances of notes in a bar and the syllables of the lyrics. Sometimes a single syllable is stretched out over more than one note -- indicated with the stretch element. Other times more than one syllable are squashed onto a single note -- indicated with the squash element.

Lyrics can be matched to note sequences as follows:

To determine which method is applied, the parser should first scan for double pipes. If found, the syllable method is applied and single pipes mean syllables. If not, single pipes mean bars and the bar method is applied.

In this example the syllable is stretched over 3 notes. Embrace the syllable with the stretch element.

<lyric>Once upon a
<stretch 3>time </stretch>
there...
</lyric>

In this example 2 syllables are squashed to one note. Embrace the syllables with the squash element.

<lyric>Three little birds
<squash 2>upon </squash>
a branch...
</lyric>

Top

Notation specific elements

The following elements are applicable to the Western staff notation system.

Key

key
a shorthand description for the set of notes (ie pitches) in an octave

A key can be declared as follows:

Markup example in head

...
<head>
<title>My song</title>
<key> Cmaj
</head>
...

Markup example in song

...
<song>
<key> Cmaj
...
</song>
...

Markup example in bar

...
<bar 34>
<key> Cmaj
...
</bar>
...

Top

Clef

clef
identifies the staff by limiting the range of possible notes

The clef is used for music notation.

Some clefs are:

treble G clef
bass F clef
alto C clef
tenor C clef

The clef is used for visual notation. For audio the key element is used. These elements thus have exactly the same function, except that they are rendered differently. Perhaps a rendering machine could automatically translate the key into clef.

Top

Staff

staff
the set of lines on which notes are written

The five parallel lines used for music notation is the most commonly known staff. Other configurations are possible, ranging from a single line to quite a lot (eg 20 lines). The staff is used for music notation.

staff is an empty element.

Markup example for a 5-line staff

...
<song>
<staff> 5
</song>
...

Top

Bind

The bind element is used specifically for notation to bind together notes with a bar. Its function is to make sight-reading easier by marking notes as a group.

The position of the start and end tags of the bind element indicate the range of the notes that are linked together with the small solid bar.

Example

<bar 5>3G <bind>(3G B A C):8</bind>

Top

Tie

tie
combining two notes of the same pitch to be played as if they were one note

The tie is used for notation purposes to indicate note length. From an audio perspective the tie is irrelevant.

Groups

Notes with irregular values can be grouped in sets of 3, 5 or 6. The length of such a set of notes is the same as that of a single note of the same kind.

triplet 3 notes
quintuplet 5 notes
sextuplet 6 notes

Three minim notes in a set of minim triplets together have the same length value as a single minim.

Top

Slur

slur
a notation symbol indicating the set of notes that belong to a phrase

The slur is a phrase mark -- a curved line stretching from the first note of the phrase to the last. Its function is to make sight-reading easier by marking phrases.

A slur often spans across bar borders, and its ends are linked to specific notes. The following procedures should be used for implementing the slur:

Top

Rest length values

Rest
indicates silence for an expected note length value in a specific bar

A rest is the absence of any frequency -- the music part takes a rest. In MML the rest is indicated with the uppercase letter R.

Rest length values are used for notational purposes only. For performance the absence of a note indicates silence -- ie, by default there is silence.

For notational purposes, rests are indicated as follows:

Latin English Numerical MML notation
semibrave whole 1 none
minim half 2 2
crotchet quarter 4 4
quaver eighth 8 8
semiquaver sixteenth 16 16
demisemiquaver thirty-second 32 32
hemidemisemiquaver sixty-fourth 64 64

Note that there is a relative rest value for each of the relative note lengths values.

Example

<bar 4:4>R R R G

OR

<bar 4:4> (R)4 G

Rests are indicated in exactly the same way as notes.

In terms of MIDI a rest is indicated by Note Off.

Top

Text

Text is used mainly for notation on a score. The text element is used for textual content, excluding the text of lyrics, for which the lyric element is used. Text objects include instrument names (eg hobo, flute, fagot) and expressions (eg forte, andante, adagio) that are written on a score.

The text element is used for the content - ie the actual words. Their position on a score is declared with a style sheet.

Example

Here is an example of the use of text in Musorgky's Boris Godunov. Note that the text element merely marks the structure of the element. The actual position, color, font and so on needs to be declared with a style sheet. Different languages are indicated with the ISO language abbreviation (the lang attribute), and where necessry the appropriate character set (the charset attribute) should also be declared.

<song>
<text style="ABC">Andante</text>
<ins.basic piccolo>
<text lang="it" style="XYZ">Flauto Piccolo (III)</text>

Top

Marking a song

When marking the structure of a song, a number of the elements need to be declared only once. Except when they are overridden, these default declarations will be implemented throughout the song.

Some of these default elements are:

These elements can be declared in the head element.

Top

Nesting

Nesting refers to declaring an element as the content of another. The element containing the other element is called the parent element. The contained element is called the child element. The end tag of a child element must occur before the end tag of its parent.

In this example the tempo and bar elements form a nested set.

Example: tempo as parent of bar

In bar 1 the tempo is 120BPM, in bar 2 it is 130BPM

...
<tempo>120
<bar 1>...
<tempo>130
<bar 2>...
...
<bar n>...
...

Top

Commentary

A commentary is a string of text (typed or spoken) that needs to be synchronized with the music. Commentary can take at least the following characteristics:

Commentary rendering

Top

Global song naming scheme

Songs may have unique names on a specific system, but names that are globally unique is a different matter, as the same song may have many different variations, performed differently by the same artist, as well as by many different artists, while different songs can have exactly the same names. A system similar to the ISBN system used for books will work better in the context of unique global names. The unique global name should include the following:

At this phase of the development of MML the global naming scheme will not be considered. It needs to be addressed in a future phase.

Top

List of elements

Here is an alphabetical list of elements:

a accent adsr album bar beat bind bookmark cent clef commentary div head key link lyric meta nameloc note octave phrase playlist range rest scale slur song span squash staff stretch tempo text tick time title tuning

List of attributes

Here is an alphabetical list of attributes:

barid begin charset declare (to declare an identifier for content that could be called upon in other instances) end exclude gradual href http id lang linkend name notevalue random rel repeat (to repeat an id'd stretch of music) span (how many bars a features spans) src staffid target type verse

Top

List of file extensions

Different files are used for different components of music. Here is a list of the recommended file extensions:

Data contained in these files may also be embedded in the *.mml file as content of the head element.

scope | specifications | examples

Top

1999 © Author: Jacques Steyn, University of Pretoria, South Africa