]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: convert Tab and drum staves to Lilypond
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 2 Nov 2007 00:49:11 +0000 (01:49 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 2 Nov 2007 00:49:11 +0000 (01:49 +0100)
-) Depending on the staff attributes, create TabStaff/TabVoice,
   DrumStaff/DrumVoice, RhythmicStaff/Voice or ordinary Staff/Voice
   staves.
-) From the staff attributes, create the list of string tunings
   for tab staves.
These two points were all that was missing for proper tablature support.

As an implementation detail, I changed all the keys in the dicts from
the full part objects to the part ID (which is also used in the part-list
element in Lilypond, so we can do proper assignments now).

input/regression/musicxml/18a-TabStaves-Finale.xml [new file with mode: 0644]
python/musicexp.py
python/musicxml.py
scripts/musicxml2ly.py

diff --git a/input/regression/musicxml/18a-TabStaves-Finale.xml b/input/regression/musicxml/18a-TabStaves-Finale.xml
new file mode 100644 (file)
index 0000000..0b87811
--- /dev/null
@@ -0,0 +1,1644 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"\r
+                                "http://www.musicxml.org/dtds/partwise.dtd">\r
+<score-partwise>\r
+  <movement-title>Tablatures</movement-title>\r
+  <identification>\r
+    <encoding>\r
+      <software>Finale 2007 for Windows</software>\r
+      <software>Dolet Light for Finale 2007</software>\r
+      <encoding-date>2007-10-30</encoding-date>\r
+    </encoding>\r
+  </identification>\r
+  <part-list>\r
+    <part-group number="1" type="start">\r
+      <group-symbol>bracket</group-symbol>\r
+      <group-barline>yes</group-barline>\r
+    </part-group>\r
+    <score-part id="P1">\r
+      <part-name>Guitar</part-name>\r
+      <part-abbreviation>Gtr.</part-abbreviation>\r
+      <score-instrument id="P1-I1">\r
+        <instrument-name>Guitar</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P1-I1">\r
+        <midi-channel>1</midi-channel>\r
+        <midi-program>26</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P2">\r
+      <part-name>Guitar</part-name>\r
+      <part-abbreviation>Gtr.</part-abbreviation>\r
+      <score-instrument id="P2-I2">\r
+        <instrument-name>Guitar</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P2-I2">\r
+        <midi-channel>2</midi-channel>\r
+        <midi-program>26</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P3">\r
+      <part-name>Guitar</part-name>\r
+      <part-abbreviation>Gtr.</part-abbreviation>\r
+      <score-instrument id="P3-I3">\r
+        <instrument-name>Guitar</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P3-I3">\r
+        <midi-channel>3</midi-channel>\r
+        <midi-program>26</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P4">\r
+      <part-name>Guitar</part-name>\r
+      <part-abbreviation>Gtr.</part-abbreviation>\r
+      <score-instrument id="P4-I4">\r
+        <instrument-name>Guitar</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P4-I4">\r
+        <midi-channel>4</midi-channel>\r
+        <midi-program>26</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P5">\r
+      <part-name>Bass Guitar</part-name>\r
+      <part-abbreviation>Bass</part-abbreviation>\r
+      <score-instrument id="P5-I5">\r
+        <instrument-name>Bass Guitar</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P5-I5">\r
+        <midi-channel>5</midi-channel>\r
+        <midi-program>35</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P6">\r
+      <part-name>Banjo</part-name>\r
+      <part-abbreviation>Bjo.</part-abbreviation>\r
+      <score-instrument id="P6-I6">\r
+        <instrument-name>Banjo</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P6-I6">\r
+        <midi-channel>6</midi-channel>\r
+        <midi-program>106</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P7">\r
+      <part-name>Lute</part-name>\r
+      <part-abbreviation>L.</part-abbreviation>\r
+      <score-instrument id="P7-I7">\r
+        <instrument-name>Lute</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P7-I7">\r
+        <midi-channel>7</midi-channel>\r
+        <midi-program>25</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <score-part id="P8">\r
+      <part-name>Ukulele</part-name>\r
+      <part-abbreviation>Uk.</part-abbreviation>\r
+      <score-instrument id="P8-I8">\r
+        <instrument-name>Ukulele</instrument-name>\r
+      </score-instrument>\r
+      <midi-instrument id="P8-I8">\r
+        <midi-channel>8</midi-channel>\r
+        <midi-program>25</midi-program>\r
+      </midi-instrument>\r
+    </score-part>\r
+    <part-group number="1" type="stop"/>\r
+  </part-list>\r
+  <!--=========================================================-->\r
+  <part id="P1">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>6</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>B</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="6">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>5</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>5</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>17</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>1</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>2</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <alter>1</alter>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>F</step>\r
+          <alter>1</alter>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>5</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <alter>1</alter>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>1</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P2">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>6</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>B</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="6">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <alter>1</alter>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <alter>1</alter>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>1</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>3</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <rest/>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>F</step>\r
+          <alter>1</alter>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>2</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>5</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>F</step>\r
+          <alter>1</alter>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>2</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note>\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P3">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>2</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>6</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>F</tuning-step>\r
+            <tuning-alter>1</tuning-alter>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="6">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <alter>1</alter>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>1</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>B</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>2</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>3</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+        <type>half</type>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <alter>1</alter>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>5</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <alter>1</alter>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>6</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>8</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P4">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>2</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>6</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>B</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="6">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>B</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>-7</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>5</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <chord/>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>eighth</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+      </note>\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+        <type>half</type>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>2</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>8</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P5">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>4</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>1</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>1</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>1</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <alter>1</alter>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>8</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>1</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>1</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>1</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>1</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>none</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note print-object="no">\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P6">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>5</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>C</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <alter>1</alter>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>3</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <rest/>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note>\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P7">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details show-frets="letters">\r
+          <staff-lines>6</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>2</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>C</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>F</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>3</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="5">\r
+            <tuning-step>D</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="6">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <alter>1</alter>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <alter>1</alter>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>1</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>A</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>2</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>7</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>D</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>F</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>4</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>G</step>\r
+          <octave>2</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>6</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>3</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>5</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note>\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+  <part id="P8">\r
+    <measure number="1">\r
+      <attributes>\r
+        <divisions>1</divisions>\r
+        <key>\r
+          <fifths>0</fifths>\r
+          <mode>major</mode>\r
+        </key>\r
+        <clef>\r
+          <sign>TAB</sign>\r
+          <line>5</line>\r
+        </clef>\r
+        <staff-details>\r
+          <staff-lines>4</staff-lines>\r
+          <staff-tuning line="1">\r
+            <tuning-step>A</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="2">\r
+            <tuning-step>E</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="3">\r
+            <tuning-step>C</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+          <staff-tuning line="4">\r
+            <tuning-step>G</tuning-step>\r
+            <tuning-octave>4</tuning-octave>\r
+          </staff-tuning>\r
+        </staff-details>\r
+      </attributes>\r
+      <sound tempo="120"/>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>6</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>24</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>B</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>1</string>\r
+            <fret>4</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>E</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>3</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="2">\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+      <note>\r
+        <pitch>\r
+          <step>C</step>\r
+          <octave>4</octave>\r
+        </pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <stem>up</stem>\r
+        <notations>\r
+          <technical>\r
+            <string>2</string>\r
+            <fret>0</fret>\r
+          </technical>\r
+        </notations>\r
+      </note>\r
+    </measure>\r
+    <!--=======================================================-->\r
+    <measure number="3">\r
+      <note>\r
+        <rest/>\r
+        <duration>4</duration>\r
+        <voice>1</voice>\r
+      </note>\r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+  </part>\r
+  <!--=========================================================-->\r
+</score-partwise>\r
index edae323f7945a2e95b630acd206437c875a99848..22891292890a442ebd72044d08ef2861106910eb 100644 (file)
@@ -1111,10 +1111,12 @@ class StaffGroup:
 
 
 class Staff (StaffGroup):
-    def __init__ (self):
-        StaffGroup.__init__ (self, "Staff")
+    def __init__ (self, command = "Staff"):
+        StaffGroup.__init__ (self, command)
         self.is_group = False
         self.part = None
+        self.voice_command = "Voice"
+        self.substafftype = None
 
     def print_ly_overrides (self, printer):
         pass
@@ -1122,12 +1124,15 @@ class Staff (StaffGroup):
     def print_ly_contents (self, printer):
         if not self.id or not self.part_information:
             return
+        sub_staff_type = self.substafftype
+        if not sub_staff_type:
+            sub_staff_type = self.stafftype
 
         for [staff_id, voices] in self.part_information:
             if staff_id:
-                printer ('\\context %s = "%s" << ' % (self.stafftype, staff_id))
+                printer ('\\context %s = "%s" << ' % (sub_staff_type, staff_id))
             else:
-                printer ('\\context %s << ' % self.stafftype)
+                printer ('\\context %s << ' % sub_staff_type)
             printer.newline ()
             n = 0
             nr_voices = len (voices)
@@ -1137,7 +1142,7 @@ class Staff (StaffGroup):
                 if nr_voices > 1:
                     voice_count_text = {1: ' \\voiceOne', 2: ' \\voiceTwo',
                                         3: ' \\voiceThree'}.get (n, ' \\voiceFour')
-                printer ('\\context Voice = "%s" {%s \\%s }' % (v,voice_count_text,v))
+                printer ('\\context %s = "%s" {%s \\%s }' % (self.voice_command, v, voice_count_text, v))
                 printer.newline ()
 
                 for l in lyrics:
@@ -1148,8 +1153,43 @@ class Staff (StaffGroup):
     def print_ly (self, printer):
         if self.part_information and len (self.part_information) > 1:
             self.stafftype = "PianoStaff"
+            self.substafftype = "Staff"
         StaffGroup.print_ly (self, printer)
 
+class TabStaff (Staff):
+    def __init__ (self, command = "TabStaff"):
+        Staff.__init__ (self, command)
+        self.string_tunings = []
+        self.tablature_format = None
+        self.voice_command = "TabVoice"
+    def print_ly_overrides (self, printer):
+        if self.string_tunings or self.tablature_format:
+            printer.dump ("\\with {")
+            if self.string_tunings:
+                printer.dump ("stringTunings = #'(")
+                for i in self.string_tunings:
+                    printer.dump ("%s" % i.semitones ())
+                printer.dump (")")
+            if self.tablature_format:
+                printer.dump ("tablatureFormat = #%s" % self.tablature_format)
+            printer.dump ("}")
+
+
+class DrumStaff (Staff):
+    def __init__ (self, command = "DrumStaff"):
+        Staff.__init__ (self, command)
+        self.drum_style_table = None
+        self.voice_command = "DrumVoice"
+    def print_ly_overrides (self, printer):
+        if self.drum_style_table:
+            printer.dump ("\with {")
+            printer.dump ("drumStyleTable = #%s" % self.drum_style_table)
+            printer.dump ("}")
+
+class RhythmicStaff (Staff):
+    def __init__ (self, command = "RhythmicStaff"):
+        Staff.__init__ (self, command)
+
 
 def test_pitch ():
     bflat = Pitch()
index cb8e1957cb2f500ff7b5219529e4295d189d6e4c..6949fe28d53b89c5fc658d49d8236a8d95a8ca82 100644 (file)
@@ -442,7 +442,7 @@ class Musicxml_voice:
 class Part (Music_xml_node):
     def __init__ (self):
         Music_xml_node.__init__ (self)
-       self._voices = []
+       self._voices = {}
         self._staff_attributes_dict = {}
 
     def get_part_list (self):
@@ -688,6 +688,8 @@ class Part (Music_xml_node):
 
     def get_voices (self):
        return self._voices
+    def get_staff_attributes (self):
+        return self._staff_attributes_dict
 
 class Notations (Music_xml_node):
     def get_tie (self):
index 9b99d3abd0897182f3a608ba6261fe8e10041465..2c130b42fce4d6237e70df31e1fae752bd74fc6c 100644 (file)
@@ -79,7 +79,83 @@ class PartGroupInfo:
         return ''
 
 
-def extract_score_layout (part_list):
+def staff_attributes_to_string_tunings (mxl_attr):
+    details = mxl_attr.get_maybe_exist_named_child ('staff-details')
+    if not details:
+        return []
+    lines = 6
+    staff_lines = details.get_maybe_exist_named_child ('staff-lines')
+    if staff_lines:
+        lines = string.atoi (staff_lines.get_text ())
+
+    tunings = [0]*lines
+    staff_tunings = details.get_named_children ('staff-tuning')
+    for i in staff_tunings:
+        p = musicexp.Pitch()
+        line = 0
+        try:
+            line = string.atoi (i.line) - 1
+        except ValueError:
+            pass
+        tunings[line] = p
+
+        step = i.get_named_child (u'tuning-step')
+        step = step.get_text ().strip ()
+        p.step = (ord (step) - ord ('A') + 7 - 2) % 7
+
+        octave = i.get_named_child (u'tuning-octave')
+        octave = octave.get_text ().strip ()
+        p.octave = int (octave) - 4
+
+        alter = i.get_named_child (u'tuning-alter')
+        if alter:
+            p.alteration = int (alter.get_text ().strip ())
+    # lilypond seems to use the opposite ordering than MusicXML...
+    tunings.reverse ()
+
+    return tunings
+
+
+def staff_attributes_to_lily_staff (mxl_attr):
+    if not mxl_attr:
+        return musicexp.Staff ()
+
+    (staff_id, attributes) = mxl_attr.items ()[0]
+
+    # distinguish by clef:
+    # percussion (percussion and rhythmic), tab, and everything else
+    clef_sign = None
+    clef = attributes.get_maybe_exist_named_child ('clef')
+    if clef:
+        sign = clef.get_maybe_exist_named_child ('sign')
+        if sign:
+            clef_sign = {"percussion": "percussion", "TAB": "tab"}.get (sign.get_text (), None)
+
+    lines = 5
+    details = attributes.get_maybe_exist_named_child ('staff-details')
+    if details:
+        staff_lines = details.get_maybe_exist_named_child ('staff-lines')
+        if staff_lines:
+            lines = string.atoi (staff_lines.get_text ())
+
+    staff = None
+    if clef_sign == "percussion" and lines == 1:
+        staff = musicexp.RhythmicStaff ()
+    elif clef_sign == "percussion":
+        staff = musicexp.DrumStaff ()
+        # staff.drum_style_table = ???
+    elif clef_sign == "tab":
+        staff = musicexp.TabStaff ()
+        staff.string_tunings = staff_attributes_to_string_tunings (attributes)
+        # staff.tablature_format = ???
+    else:
+        # TODO: Handle case with lines <> 5!
+        staff = musicexp.Staff ()
+
+    return staff
+
+
+def extract_score_layout (part_list, staffinfo):
     layout = musicexp.StaffGroup (None)
     if not part_list:
         return layout
@@ -87,7 +163,11 @@ def extract_score_layout (part_list):
     def read_score_part (el):
         if not isinstance (el, musicxml.Score_part):
             return
-        staff = musicexp.Staff ()
+        # Depending on the attributes of the first measure, we create different
+        # types of staves (Staff, RhythmicStaff, DrumStaff, TabStaff, etc.)
+        staff = staff_attributes_to_lily_staff (staffinfo.get (el.id, None))
+        if not staff:
+            return None
         staff.id = el.id
         partname = el.get_maybe_exist_named_child ('part-name')
         # Finale gives unnamed parts the name "MusicXML Part" automatically!
@@ -132,7 +212,9 @@ def extract_score_layout (part_list):
             if not group_info.is_empty ():
                 staves.append (group_info)
                 group_info = PartGroupInfo ()
-            staves.append (read_score_part (el))
+            staff = read_score_part (el)
+            if staff:
+                staves.append (staff)
         elif isinstance (el, musicxml.Part_group):
             if el.type == "start":
                 group_info.add_start (el)
@@ -1039,9 +1121,9 @@ def musicxml_voice_to_lily_voice (voice):
 
     current_staff = None
 
-    # TODO: Make sure that the keys in the dict don't get reordered, since
-    #       we need the correct ordering of the lyrics stanzas! By default,
-    #       a dict will reorder its keys
+    # Make sure that the keys in the dict don't get reordered, since
+    # we need the correct ordering of the lyrics stanzas! By default,
+    # a dict will reorder its keys
     return_value.lyrics_order = voice.get_lyrics_numbers ()
     for k in return_value.lyrics_order:
         lyrics[k] = []
@@ -1364,20 +1446,22 @@ def voices_in_part (part):
     """Return a Name -> Voice dictionary for PART"""
     part.interpret ()
     part.extract_voices ()
-    voice_dict = part.get_voices ()
+    voices = part.get_voices ()
+    part_info = part.get_staff_attributes ()
 
-    return voice_dict
+    return (voices, part_info)
 
 def voices_in_part_in_parts (parts):
     """return a Part -> Name -> Voice dictionary"""
-    return dict([(p, voices_in_part (p)) for p in parts])
+    return dict([(p.id, voices_in_part (p)) for p in parts])
 
 
 def get_all_voices (parts):
     all_voices = voices_in_part_in_parts (parts)
 
     all_ly_voices = {}
-    for p, name_voice in all_voices.items ():
+    all_ly_staffinfo = {}
+    for p, (name_voice, staff_info) in all_voices.items ():
 
         part_ly_voices = {}
         for n, v in name_voice.items ():
@@ -1386,8 +1470,9 @@ def get_all_voices (parts):
             part_ly_voices[n] = musicxml_voice_to_lily_voice (v)
 
         all_ly_voices[p] = part_ly_voices
-        
-    return all_ly_voices
+        all_ly_staffinfo[p] = staff_info
+
+    return (all_ly_voices, all_ly_staffinfo)
 
 
 def option_parser ():
@@ -1428,35 +1513,30 @@ Copyright (c) 2005--2007 by
                                      '''?group=gmane.comp.gnu.lilypond.bugs\n'''))
     return p
 
-def music_xml_voice_name_to_lily_name (part, name):
-    str = "Part%sVoice%s" % (part.id, name)
+def music_xml_voice_name_to_lily_name (part_id, name):
+    str = "Part%sVoice%s" % (part_id, name)
     return musicxml_id_to_lily (str) 
 
-def music_xml_lyrics_name_to_lily_name (part, name, lyricsnr):
-    str = "Part%sVoice%sLyrics%s" % (part.id, name, lyricsnr)
+def music_xml_lyrics_name_to_lily_name (part_id, name, lyricsnr):
+    str = "Part%sVoice%sLyrics%s" % (part_id, name, lyricsnr)
     return musicxml_id_to_lily (str) 
 
 def print_voice_definitions (printer, part_list, voices):
-    part_dict={}
-    for (part, nv_dict) in voices.items():
-        part_dict[part.id] = (part, nv_dict)
-
     for part in part_list:
-        (p, nv_dict) = part_dict.get (part.id, (None, {}))
-        #for (name, ((voice, lyrics), mxlvoice)) in nv_dict.items ():
+        part_id = part.id
+        nv_dict = voices.get (part_id, {})
         for (name, voice) in nv_dict.items ():
-            k = music_xml_voice_name_to_lily_name (p, name)
+            k = music_xml_voice_name_to_lily_name (part_id, name)
             printer.dump ('%s = ' % k)
             voice.ly_voice.print_ly (printer)
             printer.newline()
-
             for l in voice.lyrics_order:
-                lname = music_xml_lyrics_name_to_lily_name (p, name, l)
+                lname = music_xml_lyrics_name_to_lily_name (part_id, name, l)
                 printer.dump ('%s = ' %lname )
                 voice.lyrics_dict[l].print_ly (printer)
                 printer.newline()
 
-            
+
 def uniq_list (l):
     return dict ([(elt,1) for elt in l]).keys ()
 
@@ -1469,27 +1549,24 @@ def uniq_list (l):
 #         ]
 #     ]
 # raw_voices is of the form [(voicename, lyricsids)*]
-def format_staff_info (part, staff_id, raw_voices):
+def format_staff_info (part_id, staff_id, raw_voices):
     voices = []
     for (v, lyricsids) in raw_voices:
-        voice_name = music_xml_voice_name_to_lily_name (part, v)
-        voice_lyrics = [music_xml_lyrics_name_to_lily_name (part, v, l)
+        voice_name = music_xml_voice_name_to_lily_name (part_id, v)
+        voice_lyrics = [music_xml_lyrics_name_to_lily_name (part_id, v, l)
                    for l in lyricsids]
         voices.append ([voice_name, voice_lyrics])
     return [staff_id, voices]
 
 def update_score_setup (score_structure, part_list, voices):
-    part_dict = dict ([(p.id, p) for p in voices.keys ()])
-    final_part_dict = {}
 
     for part_definition in part_list:
-        part_name = part_definition.id
-        part = part_dict.get (part_name)
-        if not part:
-            error_message ('unknown part in part-list: %s' % part_name)
+        part_id = part_definition.id
+        nv_dict = voices.get (part_id)
+        if not nv_dict:
+            error_message ('unknown part in part-list: %s' % part_id)
             continue
 
-        nv_dict = voices.get (part)
         staves = reduce (lambda x,y: x+ y,
                 [voice.voicedata._staves.keys ()
                  for voice in nv_dict.values ()],
@@ -1503,12 +1580,12 @@ def update_score_setup (score_structure, part_list, voices):
                 thisstaff_raw_voices = [(voice_name, voice.lyrics_order) 
                     for (voice_name, voice) in nv_dict.items ()
                     if voice.voicedata._start_staff == s]
-                staves_info.append (format_staff_info (part, s, thisstaff_raw_voices))
+                staves_info.append (format_staff_info (part_id, s, thisstaff_raw_voices))
         else:
             thisstaff_raw_voices = [(voice_name, voice.lyrics_order) 
                 for (voice_name, voice) in nv_dict.items ()]
-            staves_info.append (format_staff_info (part, None, thisstaff_raw_voices))
-        score_structure.set_part_information (part_name, staves_info)
+            staves_info.append (format_staff_info (part_id, None, thisstaff_raw_voices))
+        score_structure.set_part_information (part_id, staves_info)
 
 def print_ly_preamble (printer, filename):
     printer.dump_version ()
@@ -1535,17 +1612,17 @@ def convert (filename, options):
     progress ("Reading MusicXML from %s ..." % filename)
     
     tree = read_musicxml (filename, options.use_lxml)
+    parts = tree.get_typed_children (musicxml.Part)
+    (voices, staff_info) = get_all_voices (parts)
 
     score_structure = None
     mxl_pl = tree.get_maybe_exist_typed_child (musicxml.Part_list)
     if mxl_pl:
-        score_structure = extract_score_layout (mxl_pl)
+        score_structure = extract_score_layout (mxl_pl, staff_info)
         part_list = mxl_pl.get_named_children ("score-part")
 
     # score information is contained in the <work>, <identification> or <movement-title> tags
     score_information = extract_score_information (tree)
-    parts = tree.get_typed_children (musicxml.Part)
-    voices = get_all_voices (parts)
     update_score_setup (score_structure, part_list, voices)
 
     if not options.output_name: