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

Hello World

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

This example shows a simple score for one instrument: a Ranat Ek (ระนาดเอก) playing the first line of a song.

<?xml version="1.0" encoding="UTF-8"?>
<thai-score version="0.1">
<header>
<title>Lao Duang Duen</title>
</header>
<structure>
<section id="s1" number="1" name="ท่อน 1" />
</structure>
<ensemble>
<part id="P1">
<instrument-name>Ranat Ek</instrument-name>
</part>
</ensemble>
<part-data id="P1">
<section-ref id="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>
</part-data>
</thai-score>

The following sections explain each element.

<?xml version="1.0" encoding="UTF-8"?>

This XML declaration identifies the document as XML and specifies UTF-8 encoding.

<thai-score version="0.1">

The <thai-score> element is the root of a ThaiMusicXML document. Its version attribute identifies the ThaiMusicXML version.

<header>
<title>Lao Duang Duen</title>
</header>

The <header> element contains score metadata. It must include a <title>, which is the title of a Thai song in this example.

<structure>
<section id="s1" number="1" name="ท่อน 1" />
</structure>

The <structure> element defines the score layout. Each <section> has an id that <section-ref> uses later to attach music data. The number attribute gives the section order, and name is a label for readers.

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

The <ensemble> element lists the instruments. Each <part> has a unique id and an <instrument-name>. This example has one Ranat Ek (ระนาดเอก, a Thai xylophone).

<part-data id="P1">
<section-ref id="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>
...
</line>
</section-ref>
</part-data>

The <part-data> element holds the music for a part. Its id matches a part in <ensemble>. Inside it, <section-ref> links to a section in <structure>. The music is organized into <line> elements, each containing <measure> elements with a number attribute.

Notes use Thai scale names in the pitch attribute:

Number Thai Romanized Sound (C Major)
1 Do C
2 Re D
3 Mi E
4 Fa F
5 Sol G
6 La A
7 Ti B

Adding ํ (Nikhahit) after a note name raises it by an octave. Adding ฺ (Pinthu) lowers it by an octave. For example, ดํ is ด one octave higher, and ทฺ is ท one octave lower.

<rest/>

A rest is a self-closing element with no attributes. Its duration comes from the context, one beat in this score.

This is a complete ThaiMusicXML file. Next, see File Structure to learn how to add multiple instruments, sections, and performance directions.