MML: Time Module

  1. Note
  2. Rhythm
    1. Tempo
    2. Time
    3. Bar
    4. Beat
    5. Tick
  3. Length
    1. Note length values
      1. Relative lengths
      2. Absolute lengths
      3. Dotted notes
    2. Rest length values
  4. Synchronization

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 perhaps 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.

The following aspects are contained in the Time Module:

Time module


1 Note

a specific pitch of frequency of a given length (duration) within a certain framework of frequencies


In MML a note will always be a function of frequency and time, and both the Frequency and Time Modules will always be used. The note attribute is thus contained in both modules.

2 Rhythm

the cyclical repetition of a recognizable stress pattern through time

beat | tempo

Rhythm has two components: beat and tempo which are described below. Rhythm is thus not marked explicitly in MML, but by its two components.


1 Tempo


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

When rendered by a synthetic device (eg synthesizer or sequencer) 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 Abbreviation
beat per minute BPM
beat per second BPS
beat per millisecond (ms) BPMS

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 in this context for the word per.

Tempo 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.

<song tempo="90:m"> ... </song>
<song tempo="1.5:s"> ... </song>
<song tempo="0.0025:ms"> ...

In this example the default tempo is 130 beats per minute

<song tempo="130"> ... </song>

Tempo can be declared in different locations:

Gradual increase or decrease of tempo

gradual | target

Music may gradually slow down or increase in pace. It must therefore be possible to mark the starting point of the gradual change in tempo and the end point. Electronic devices should be able to calculate the rate of 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. The user agent should calculate the difference between the current tempo and the target tempo and increase or decrease the tempo gradually over the span of the relevant bar or bars.

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 barid="26" tempo="105" gradual="120" target="30">
<bar barid="50">

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

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



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


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, which in this example is very extreme. This is declared with the random attribute, used for random variation.

<div tempo="120" random="10%">


2 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. In MML there is no time element. Time is indicated with a value of the note attribute.

Time needs to be stated only where the time signature changes.

Example of change in time
<song note="6:8">
  <bar barid="15" note="4:4">...</bar>

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

<bar barid="15" 4:4>...</bar>

3 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 nervertheless 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 as it is a structural concept. However, it may be possible to assign an artifical structure to unpatterned music and map it onto a series of bars. In such a situation the bars function as structural containers, and not necessarily to describe structures inherent in the non-structured song.

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 fixed reference points in the flow of music events. The content of a bar typically contains note values.

Bar number: bar identifier

id | barid

The bar number is indicated with the barid (read "bar-i-d") 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. This attribute serves to avoid possible confusion between general identifiers (such as id).
<bar barid="1">... </bar>
<bar barid="2"> ... </bar>
<bar barid="n"> ... </bar>

Bar number plus note length value

<bar barid="1" note="4:4">... </bar>
<bar barid="2" note="6:4"> ... </bar>
<bar barid="55" note="4:4"> ... </bar>


4 Beat

periodic emphasized repetition of music events


The beat is a relative abstract time value. A beat may contain several notes, either a set of simultaneous notes or a set of sequential notes. 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 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 bar, each with a relative length of an eighth. The actual values of relative lengths are fixed by reference to the absolute time specified in tempo.

The beat attribute does not need to be stated explicitly for every bar as beat is a child of bar. A sequence of notes in a bar automatically indicate beats, thus by default a 6/8 bar will take 6 beats, each note name falling on a specific beat. However, notes with non-beat values need to be declared explicitly.


In this example each note represents a beat.

<bar barid="3">F G A C </bar>

beat 1 = F
beat 2 = G
beat 3 = A
beat 4 = C

A beat can be subdivided sequentially as follows.


This 3rd beat of bar 6 consists of 3 consecutive notes. In this case they are a triplet as all three sixteenth notes A, F and C follow sequentially starting from beat 3, but ending before beat 4. They are declared in the order of appearance.

<bar barid="6">G B
  <span beat="3:16">A F C</span> G

In this example the three notes (A, F and C) are equally spaced in time on the third beat. If one note is syncopated or if they all are, it is advisable to use the tick element. For a sixteenth note 96 ticks are available on which to space the three notes. See the next section on Tick.

For special purposes the beat needs to be indicated. For example, the beginning of a slur on a specific beat needs to be indicated.

To mark note F in beat 3 in the above example with special features, such as the beginning of a slur, use the following markup:

<bar barid="6">F G (A F C):16 G
  <bindbegin id="b1" beat="3" note="E" />
  <bindend end="b1" beat="3.5" />


5 Tick

the smallest relative unit of time


Ticks are relative units of time measured in terms of fractions of relative note lengths.

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

Note value Western notation Tick value
whole Whole note 1536
half Half note 786
quarter 4th note 384
eighth 8th note 192
sixteenth 16th note 96

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

Note value Tick value
eighth triplet 128
sixteenth triplet 64


3 Length

A stretch of music consists of alternating sound and silence of varying lengths. In MML both sound and the absence thereof can be described with either relative or absolute methods.

1 Note length values

1 Relative lengths

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

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

2 Absolute lengths

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

<bar barid="2" beat="3">3C:210ms

This is translated as:
a C note in the third octave, 210 ms long.

3 Dotted notes

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

2 Rest length

In non-notational music such as a sequenced stretch of music, the absence of music would be a rest and is thus not necessary to be declared. The explicit rest glyph is thus more relevant to music notation and handled by the Notation Module in MML.

4 Synchronization


Synchronizing different musical phrases that are to be rendered as units is important in music. For audio they need to be played together, for notation they are to be displayed in parallel.

An MML-sensitive program will need to apply this functionality as an XML parser will merely render the content in text format. The sync contains the markup for triggering such a program, and must indicate exactly which parts need to be synchronized.


In this example elements with ID values "treb" and "bass" are synchronized.

<?xml version="1.0"?>
  <?xml-stylesheet href="../../style/music.css" type="text/css"?>
  <mml xmlns="">

    <sync match="treb" with="bass" />


1999, 2000 Author: Jacques Steyn