Sequence content
MNX uses the term sequence content to mean a series of musical events that are both presented and performed in a given order, each at a distinct time. For example, these musical events include notes, rests and directions.
Sequence content has three attributes:
- The content itself, which is encoded via the <sequence> element.
- A starting position, which is the metrical position of the content's first element within the containing measure.
- A time modification ratio, which is a rational number scale factor that implicitly applies to all positions and durations within the content.
Sequence content permits interspersed direction content whose directions are injected into the sequence either adjacent to events, or at explicitly given measure locations.
Sequencing the content
Within sequence content, each event is assigned a metrical position according to the following procedure, called sequencing the content:
- Let sequence cursor be the starting position of the sequence content.
- Let content be the list of XML elements comprising the sequence content.
- While content is not empty:
- Let next be the initial element of content, and remove it from the head of content.
- If next is an <event> element:
- If next has a measure value of yes,
- If sequence cursor is greater than zero, throw a processing error.
- Set sequence cursor to the end of the measure as defined by its time signature.
- Else,
- Set the metrical position of next to sequence cursor.
- If next has a duration attribute, assign it to event duration.
- Else, set event duration to next’s value attribute.
- Multiply event duration by the time modification ratio, and add the result to sequence cursor.
- If next has a measure value of yes,
- If next is an <forward> element:
- Set the metrical position of next to sequence cursor.
- Add the duration of next, multiplied by the time modification ratio, to sequence cursor.
- Else, if next is an <tuplet> element:
- Sequence the content of next, using sequence cursor as the starting position, and multiplying the time modification ratio by the tuplet's outer / inner ratio for the processing of the tuplet.
- Add the total duration of next as given by outer, multiplied by the time modification ratio, to sequence cursor.
- Else, if next is an <grace> element:
- Process the contents of next, assigning them a non-metrical ordering relative to preceding or following elements as appropriate.
- If sequence cursor exceeds the specified duration for the enclosing element (time signature for a <measure>, inner attribute for a <tuplet>), throw a processing error.