ข้ามไปยังเนื้อหา

File Structure

ขออภัย เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย

The Hello World example used one instrument and one section. This example adds multiple instruments, structure annotations, performance directions, and section repeats.

<?xml version="1.0" encoding="UTF-8"?>
<thai-score version="0.1">
<header>
<title>Example Song</title>
<composer>Example Composer</composer>
<structure>
<annotation>Example Comments</annotation>
<direction>
<chan value="1" />
<bpm>65</bpm>
</direction>
<annotation>บรรทัดที่ 1 มี 7 ห้อง</annotation>
<section id="s1" number="1" name="ท่อน 1" repeat="2" />
<annotation>End of section 1 message</annotation>
</structure>
</header>
<ensemble>
<part id="P1">
<instrument-name>Ranat Ek</instrument-name>
</part>
<part id="P2">
<instrument-name>Ching</instrument-name>
</part>
</ensemble>
<part-data id="P1">
<section-ref id="s1">
<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>
<measure number="3"><note pitch="ทฺ"/><note pitch=""/><note pitch=""/><note pitch="ลฺ"/></measure>
<measure number="4"><note pitch="ทฺ"/><note pitch=""/><note pitch=""/><note pitch=""/></measure>
<measure number="5"><note pitch=""/><note pitch=""/><note pitch=""/><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>
</line>
</section-ref>
</part-data>
<part-data id="P2">
<section-ref id="s1">
<annotation target="instrument">0 = ฉิ่ง / 1 = ฉับ</annotation>
<line number="1">
<measure number="1"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="2"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="3"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="4"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="5"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="6"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
<measure number="7"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
</line>
</section-ref>
</part-data>
</thai-score>

The <header> can include a <composer> alongside <title>:

<header>
<title>Example Song</title>
<composer>Example Composer</composer>
</header>

The <structure> element can contain several child types that describe the score layout:

<structure>
<annotation>Example Comments</annotation>
<direction>
<chan value="1" />
<bpm>65</bpm>
</direction>
<annotation>บรรทัดที่ 1 มี 7 ห้อง</annotation>
<section id="s1" number="1" name="ท่อน 1" repeat="2" />
<annotation>End of section 1 message</annotation>
</structure>
  • <annotation>: Free-form comments that can appear anywhere. Playback ignores them. The optional target attribute specifies what the annotation refers to.
  • <direction>: Performance directions. This example sets the ชั้น (<chan>) and tempo (<bpm>). ชั้น (chan) is the Thai rhythmic layer system. value="1" means ชั้นเดียว.
  • <section>: A named section. The repeat attribute indicates how many times it is played.

The <ensemble> can list multiple parts:

<ensemble>
<part id="P1">
<instrument-name>Ranat Ek</instrument-name>
</part>
<part id="P2">
<instrument-name>Ching</instrument-name>
</part>
</ensemble>

Each instrument gets its own <part-data> element with a matching id. Here, P1 is a Ranat Ek (ระนาดเอก, a Thai xylophone) and P2 is a Ching (ฉิ่ง, small cymbals).

Each <part-data> links to a section through <section-ref>. The Ching part includes an annotation explaining its notation:

<part-data id="P2">
<section-ref id="s1">
<annotation target="instrument">0 = ฉิ่ง / 1 = ฉับ</annotation>
<line number="1">
<measure number="1"><rest/><note pitch="0"/><rest/><note pitch="1"/></measure>
...
</line>
</section-ref>
</part-data>

The target="instrument" attribute limits this comment to the instrument. It documents the Ching notation convention: 0 means ฉิ่ง (open) and 1 means ฉับ (closed).