Skip to content

<line>

The <line> element contains a musical line or phrase within a section.

<section-ref>

Attribute Required Type Description
number Yes integer 1-based line number within the containing <section-ref>.
id No token Optional identifier, unique among all <line> elements in the document. Exists for a foreign-namespace extension to reference; ThaiMusicXML itself does not use it.

In order:

Eight measures is a hard limit. Many lines have fewer, depending on the song.

An annotation here belongs to this line of this part, which is what separates it from one on the <section-ref> around it. A section-ref annotation says something about the whole section - what an instrument’s sound codes mean, say - and prints once above it. A line annotation says something about this line, กรอ over the passage it applies to, and prints above that line wherever it falls.

Line numbers are local to the containing <section-ref>. They start at 1 for each section reference and increase by one for each line.

  • A <line> must contain between one and eight <measure> elements. Validators must reject a line with nine or more.
  • Any <annotation> children come before the measures, not between them.
  • number must match the line’s position in its <section-ref>, counting from 1. Lines must appear in ascending order.
  • id, when present, must be unique among all <line> elements in the document.

Measure cells are a fixed width across the whole score, so a line with fewer than eight measures renders left-aligned and stops short rather than stretching to fill the row. See The measure grid.

<line number="1">
<measure number="1"><note pitch=""/><note pitch=""/><note pitch=""/><note pitch=""/></measure>
<measure number="2"><note pitch=""/><note pitch=""/><note pitch=""/><note pitch=""/></measure>
</line>
<!-- With a note to the player, printed above this line only -->
<line number="2">
<annotation>กรอ</annotation>
<measure number="1"><note pitch=""/><note pitch=""/><note pitch=""/><note pitch=""/></measure>
</line>