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 and rests.

Sequence content has three attributes:

  1. The content itself, which is encoded via the sequence object.
  2. A starting position, which is the metrical position of the content's first element within the containing measure.
  3. A time modification ratio, which is a rational number scale factor that implicitly applies to all positions and durations within the content.

Sequencing the content

Within sequence content, each event is assigned a metrical position according to the following procedure, called sequencing the content:

  1. Let sequence cursor be the starting position of the sequence content.
  2. Let content be the list of MNX objects comprising the sequence content.
  3. For each object obj within content:
    1. If obj has a "type" value of "event":
      1. If obj has a "measure" value of true,
        1. If sequence cursor is greater than zero, throw a processing error.
        2. Set sequence cursor to the end of the measure as defined by its time signature.
      2. Else,
        1. Set the metrical position of obj to sequence cursor.
        2. If obj has a "duration", assign it to event duration.
        3. Else, throw a processing error.
        4. Multiply event duration by the time modification ratio, and add the result to sequence cursor.
    2. Else, if obj has a "type" value of "space":
      1. Set the metrical position of obj to sequence cursor.
      2. Add the "duration" of obj, multiplied by the time modification ratio, to sequence cursor.
    3. Else, if obj has a "type" value of "tuplet":
      1. Sequence the content of obj, 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.
      2. Add the total duration of obj as given by outer, multiplied by the time modification ratio, to sequence cursor.
    4. Else, if obj has a "type" value of "grace":
      1. Process the contents of obj, assigning them a non-metrical ordering relative to preceding or following elements as appropriate.
    5. If sequence cursor exceeds the specified duration for the enclosing element (time signature for a measure, "inner" value for a tuplet), throw a processing error.