Ensembles and stacked instruments
Previous pages showed one or two instruments. This page adds several parts, stacked instrument rows, and a part that omits a section.

The ensemble and part-data
Section titled “The ensemble and part-data”Every instrument listed in <ensemble> gets its own <part-data> element. The part attribute links back:
<ensemble> <part id="P1"> <instrument-name>ระนาดเอก</instrument-name> <instrument-short-name>รน.เอก</instrument-short-name> </part> <part id="P2" stack="khim" row="1"> <instrument-name>ขิม 1</instrument-name> </part></ensemble>Each <part-data> holds the music for its instrument. The parts can reference different sections, play different lines, and have different amounts of music, as long as corresponding measures agree on beat count.
Stacked instruments
Section titled “Stacked instruments”Some instruments are notated across several rows. The stack and row attributes join parts into one visual instrument:
<part id="P2" stack="khim" row="1"> <instrument-name>ขิม 1</instrument-name></part><part id="P3" stack="khim" row="2"> <instrument-name>ขิม 2</instrument-name></part>Parts sharing the same stack value are drawn as consecutive rows of one instrument, with a shared label. The row attribute orders them: row 1 on top, row 2 below.
For ขิม, the rows are registers (high, middle, low), not left and right hands. The musical relationship between rows is up to the arranger; the format only records which rows belong together.
Instrument short name
Section titled “Instrument short name”<instrument-short-name> gives a shorter label for tight layouts. When the full name would crowd the score, the renderer uses the short name instead:
<part id="P1"> <instrument-name>ระนาดเอก</instrument-name> <instrument-short-name>รน.เอก</instrument-short-name></part>The short name is optional. Without it, the renderer uses <instrument-name> everywhere.
Parts that sit out a section
Section titled “Parts that sit out a section”A part does not have to play in every section. If a <part-data> has no <section-ref> for a section, that part rests for the entire section:
<part-data part="P2"> <section-ref section="s1"> <!-- ขิม plays in ท่อน 1 --> </section-ref> <!-- No section-ref for s2: ขิม sits out ท่อน 2 --></part-data>The part still exists in the ensemble and still occupies its row in the rendered score. The row is blank for that section.
Beat count agreement
Section titled “Beat count agreement”Every part that references the same section must agree on beat count per measure. If ระนาดเอก’s line 1, measure 1 has four notes, ขิม 1’s line 1, measure 1 must also have four beats (whether notes, rests, or groups).
The one exemption is a lyric part. Its measures hold syllables, not beats, so the count is what decides how the words sit in the cell. See Lyrics.
Example file
Section titled “Example file”This tutorial file has three parts: ระนาดเอก, ขิม 1 (stack=“khim” row=“1”), and ขิม 2 (stack=“khim” row=“2”). ท่อน 1 has all three parts. ท่อน 2 has only ระนาดเอก; the two ขิม parts have no <section-ref> for it, so they sit out.
<?xml version="1.0" encoding="UTF-8"?><thai-score xmlns="https://thaimusicxml.anan.ovh/ns/1" version="1.0"> <header> <title>ลาวดวงเดือน</title> <composer><text align="right">ทำนอง: พระเจ้าบรมวงศ์เธอ กรมหมื่นพิไชยมหินทโรดม</text></composer> </header> <structure> <direction> <nathap value="ลาว" /> <chan value="2" /> <bpm>60</bpm> </direction> <section id="s1" name="ท่อน 1" /> <section id="s2" name="ท่อน 2" /> </structure> <ensemble> <part id="P1"> <instrument-name>ระนาดเอก</instrument-name> <instrument-short-name>รน.เอก</instrument-short-name> </part> <part id="P2" stack="khim" row="1"> <instrument-name>ขิม 1</instrument-name> <instrument-short-name>ขิม 1</instrument-short-name> </part> <part id="P3" stack="khim" row="2"> <instrument-name>ขิม 2</instrument-name> <instrument-short-name>ขิม 2</instrument-short-name> </part> </ensemble> <part-data part="P1"> <section-ref section="s1"> <line number="1"> <measure number="1"><rest/><rest/><rest/><rest/></measure> <measure number="2"><rest/><rest/><rest/><rest/></measure> <measure number="3"><rest/><note pitch="ด"/><note pitch="ร"/><note pitch="ม"/></measure> <measure number="4"><rest/><note pitch="ซ"/><rest/><note pitch="ด"/></measure> <measure number="5"><rest/><rest/><rest/><note pitch="ร"/></measure> <measure number="6"><note pitch="ด"/><note pitch="ด"/><note pitch="ด"/><note pitch="ด"/></measure> <measure number="7"><note pitch="ซ"/><note pitch="ล"/><note pitch="ด"/><note pitch="ล"/></measure> <measure number="8"><note pitch="ซ"/><note pitch="ม"/><rest/><note pitch="ซ"/></measure> </line> </section-ref> <section-ref section="s2"> <line number="1"> <measure number="1"><rest/><rest/><rest/><note pitch="ล"/></measure> <measure number="2"><note pitch="ซ"/><note pitch="ซ"/><note pitch="ซ"/><note pitch="ซ"/></measure> <measure number="3"><rest/><note pitch="ม"/><note pitch="ซ"/><note pitch="ม"/></measure> <measure number="4"><note pitch="ซ"/><note pitch="ล"/><note pitch="ด"/><note pitch="ล"/></measure> <measure number="5"><rest/><rest/><note pitch="ด"/><note pitch="ล"/></measure> <measure number="6"><rest/><note pitch="ซ"/><rest/><note pitch="ม"/></measure> <measure number="7"><note pitch="ร"/><note pitch="ม"/><note pitch="ซ"/><note pitch="ม"/></measure> <measure number="8"><note pitch="ร"/><note pitch="ด"/><rest/><note pitch="ร"/></measure> </line> </section-ref> </part-data> <part-data part="P2"> <section-ref section="s1"> <line number="1"> <measure number="1"><rest/><rest/><rest/><rest/></measure> <measure number="2"><rest/><rest/><rest/><rest/></measure> <measure number="3"><rest/><rest/><rest/><rest/></measure> <measure number="4"><rest/><note pitch="ด"/><rest/><note pitch="ด"/></measure> <measure number="5"><rest/><rest/><rest/><note pitch="ร"/></measure> <measure number="6"><note pitch="ด"/><rest/><note pitch="ด"/><rest/></measure> <measure number="7"><rest/><rest/><note pitch="ด"/><rest/></measure> <measure number="8"><rest/><rest/><rest/><note pitch="ด"/></measure> </line> </section-ref> </part-data> <part-data part="P3"> <section-ref section="s1"> <line number="1"> <measure number="1"><rest/><rest/><rest/><rest/></measure> <measure number="2"><rest/><rest/><rest/><rest/></measure> <measure number="3"><note pitch="ม"/><link type="start"/><group><note pitch="ร"/><note pitch="ด"/></group><link type="stop"/><note pitch="ร"/><note pitch="ม"/></measure> <measure number="4"><rest/><rest/><rest/><rest/></measure> <measure number="5"><rest/><rest/><rest/><note pitch="ร"/></measure> <measure number="6"><note pitch="ด"/><note pitch="ด"/><rest/><note pitch="ด"/></measure> <measure number="7"><rest/><rest/><rest/><rest/></measure> <measure number="8"><rest/><note pitch="ม"/><rest/><rest/></measure> </line> </section-ref> </part-data></thai-score>Next, see Lyrics for vocal parts, syllables, and the counting rule.