]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Implement dashed slurs, glissando styles, directed and non-arpeggios
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 11 Feb 2008 16:40:18 +0000 (17:40 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 11 Feb 2008 16:40:18 +0000 (17:40 +0100)
Since I added functions print_before_note and print_after_note to
the Event class, it's now possible to apply individual settings
to things like glissando or slurs just once (using \once\override
before the note).
Also a

input/regression/musicxml/02b-Articulations-Texts-PJB.xml [new file with mode: 0644]
input/regression/musicxml/02c-MultipleNotationChildren-RFK.xml [new file with mode: 0644]
input/regression/musicxml/02d-Arpeggio.xml [new file with mode: 0644]
input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml [deleted file]
input/regression/musicxml/02i-Articulations-Texts-PJB.xml [deleted file]
input/regression/musicxml/04b-Glissando.xml [new file with mode: 0644]
python/musicexp.py
python/musicxml.py
scripts/musicxml2ly.py

diff --git a/input/regression/musicxml/02b-Articulations-Texts-PJB.xml b/input/regression/musicxml/02b-Articulations-Texts-PJB.xml
new file mode 100644 (file)
index 0000000..8e52b8d
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 0.6b Partwise//EN"
+ "http://www.musicxml.org/dtds/partwise.dtd">
+<score-partwise>
+       <identification>
+               <encoding>
+                       <software>/usr/bin/vi</software>
+                       <encoding-date>2007-02-01</encoding-date>
+               </encoding>
+       </identification>
+       <part-list>
+               <score-part id="P1"><part-name></part-name></score-part>
+       </part-list>
+       <part id="P1">
+               <measure number="1">
+                       <attributes>
+                               <divisions>96</divisions>
+                               <key><fifths>0</fifths></key>
+                               <time><beats>4</beats><beat-type>4</beat-type></time>
+                               <staves>1</staves>
+                               <clef number="1"><sign>G</sign><line>2</line></clef>
+                       </attributes>
+                       <direction placement="above">
+                               <direction-type>
+                                       <words default-x="-1" default-y="15" font-size="medium" font-weight="normal"> 
+                                               Normal, Medium
+                                       </words>
+                               </direction-type>
+                               <staff>1</staff>
+                       </direction>
+                       <note>
+                               <pitch><step>F</step><octave>4</octave></pitch>
+                               <duration>384</duration>
+                               <voice>1</voice>
+                               <type>eighth</type>
+                               <staff>1</staff>
+                       </note>
+                       <direction placement="below">
+                               <direction-type>
+                                       <words default-x="1" default-y="15" justify="left" font-size="medium" font-weight="bold"> 
+                                               Bold, Medium
+                                       </words>
+                               </direction-type>
+                               <staff>1</staff>
+                       </direction>
+               </measure>
+               <measure number="2">
+                       <direction placement="above">
+                               <direction-type>
+                                       <words default-x="1" default-y="15" font-size="large" font-weight="normal"> 
+                                               Normal, Large
+                                       </words>
+                               </direction-type>
+                               <staff>1</staff>
+                       </direction>
+                       <note>
+                               <pitch><step>G</step><octave>4</octave></pitch>
+                               <duration>384</duration>
+                               <voice>1</voice>
+                               <type>whole</type>
+                               <staff>1</staff>
+                       </note>
+                       <direction placement="below">
+                               <direction-type>
+                                       <words default-x="1" default-y="15" font-size="large" font-weight="bold"> 
+                                               Bold, Large
+                                       </words>
+                               </direction-type>
+                               <staff>1</staff>
+                       </direction>
+               </measure>
+               <measure number="3">
+                       <direction placement="above">
+                               <direction-type>
+                                       <words default-x="1" default-y="15" font-size="small" font-weight="normal"> 
+                                               Normal, Small
+                                       </words>
+                               </direction-type>
+                               <staff>1</staff>
+                       </direction>
+                       <note>
+                               <pitch><step>F</step><octave>4</octave></pitch>
+                               <duration>384</duration>
+                               <voice>1</voice>
+                               <type>whole</type>
+                               <staff>1</staff>
+                       </note>
+                        <direction placement="below">
+                            <direction-type>
+                                <words default-x="1" default-y="15" font-size="small" font-weight="bold"> 
+                                    Bold, Small
+                                </words>
+                            </direction-type>
+                            <staff>1</staff>
+                        </direction>
+                        <direction placement="below">
+                            <direction-type>
+                                <words default-x="1" default-y="-15" font-size="small" color="#FF8000"> 
+                                    Normal, Small, Colored, Below
+                                </words>
+                            </direction-type>
+                            <staff>1</staff>
+                        </direction>
+               </measure>
+       </part>
+</score-partwise>
diff --git a/input/regression/musicxml/02c-MultipleNotationChildren-RFK.xml b/input/regression/musicxml/02c-MultipleNotationChildren-RFK.xml
new file mode 100644 (file)
index 0000000..ae2a60c
--- /dev/null
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
+                                "http://www.musicxml.org/dtds/partwise.dtd">
+<score-partwise>
+  <movement-title>Multiple notation and articulation children</movement-title>
+  <identification>
+    <rights>Public Domain</rights>
+    <encoding>
+      <software>Hand-crafted MusicXML</software>
+    </encoding>
+    <miscellaneous>
+      <miscellaneous-field name="comment">
+          It should not make any difference whether two articulations are given
+          inside to different notation elements, inside two different articulations 
+          children of the same notation element or inside the same articulations
+          element. Thus, all three notes should have a staccato and an accent.
+      </miscellaneous-field>
+    </miscellaneous>
+  </identification>
+  <part-list>
+    <score-part id="P1">
+      <part-name>MusicXML Part</part-name>
+    </score-part>
+  </part-list>
+  <!--=========================================================-->
+  <part id="P1">
+    <measure number="1">
+      <attributes>
+        <divisions>4</divisions>
+        <clef>
+          <sign>G</sign>
+          <line>2</line>
+        </clef>
+        <key>
+          <fifths>0</fifths>
+        </key>
+        <time>
+          <beats>3</beats>
+          <beat-type>4</beat-type>
+        </time>
+      </attributes>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+          </articulations>
+        </notations>
+        <notations>
+          <articulations>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+          </articulations>
+          <articulations>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+    </measure>
+  </part>
+</score-partwise>
diff --git a/input/regression/musicxml/02d-Arpeggio.xml b/input/regression/musicxml/02d-Arpeggio.xml
new file mode 100644 (file)
index 0000000..97e33b1
--- /dev/null
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN"
+                                "http://www.musicxml.org/dtds/partwise.dtd">
+<score-partwise version="2.0">
+  <movement-title>Arpeggios in MusicXML</movement-title>
+  <identification/>
+  <defaults/>
+  <part-list>
+    <score-part id="P1">
+      <part-name></part-name>
+    </score-part>
+  </part-list>
+  <!--=========================================================-->
+  <part id="P1">
+    <!-- Different Arpeggiate styles: neutral, up, down and non-arpeggiate (bracket) -->
+    <measure number="1">
+      <attributes>
+        <divisions>1</divisions>
+        <key>
+          <fifths>0</fifths>
+          <mode>major</mode>
+        </key>
+        <clef>
+          <sign>G</sign>
+          <line>2</line>
+        </clef>
+      </attributes>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="up"/></notations>
+        <lyric number="1"><text>up</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="up"/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="up"/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="down"/></notations>
+        <lyric number="1"><text>down</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="down"/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate direction="down"/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><non-arpeggiate type="bottom"/></notations>
+        <lyric number="1"><text>non-arp.</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><non-arpeggiate type="top"/></notations>
+      </note>
+      <note>
+        <pitch>
+          <step>C</step><octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>E</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <note>
+        <chord/>
+        <pitch>
+          <step>G</step><octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <notations><arpeggiate/></notations>
+      </note>
+      <barline location="right">
+        <bar-style>light-heavy</bar-style>
+      </barline>
+    </measure>
+  </part>
+</score-partwise>
diff --git a/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml b/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml
deleted file mode 100644 (file)
index ae2a60c..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
-                                "http://www.musicxml.org/dtds/partwise.dtd">
-<score-partwise>
-  <movement-title>Multiple notation and articulation children</movement-title>
-  <identification>
-    <rights>Public Domain</rights>
-    <encoding>
-      <software>Hand-crafted MusicXML</software>
-    </encoding>
-    <miscellaneous>
-      <miscellaneous-field name="comment">
-          It should not make any difference whether two articulations are given
-          inside to different notation elements, inside two different articulations 
-          children of the same notation element or inside the same articulations
-          element. Thus, all three notes should have a staccato and an accent.
-      </miscellaneous-field>
-    </miscellaneous>
-  </identification>
-  <part-list>
-    <score-part id="P1">
-      <part-name>MusicXML Part</part-name>
-    </score-part>
-  </part-list>
-  <!--=========================================================-->
-  <part id="P1">
-    <measure number="1">
-      <attributes>
-        <divisions>4</divisions>
-        <clef>
-          <sign>G</sign>
-          <line>2</line>
-        </clef>
-        <key>
-          <fifths>0</fifths>
-        </key>
-        <time>
-          <beats>3</beats>
-          <beat-type>4</beat-type>
-        </time>
-      </attributes>
-      <note>
-        <pitch>
-          <step>A</step>
-          <octave>4</octave>
-        </pitch>
-        <duration>4</duration>
-        <voice>1</voice>
-        <type>quarter</type>
-        <accidental>sharp</accidental>
-        <stem>down</stem>
-        <notations>
-          <articulations>
-            <staccato placement="above"/>
-          </articulations>
-        </notations>
-        <notations>
-          <articulations>
-            <accent placement="above"/>
-          </articulations>
-        </notations>
-      </note>
-      <note>
-        <pitch>
-          <step>A</step>
-          <octave>4</octave>
-        </pitch>
-        <duration>4</duration>
-        <voice>1</voice>
-        <type>quarter</type>
-        <accidental>sharp</accidental>
-        <stem>down</stem>
-        <notations>
-          <articulations>
-            <staccato placement="above"/>
-          </articulations>
-          <articulations>
-            <accent placement="above"/>
-          </articulations>
-        </notations>
-      </note>
-      <note>
-        <pitch>
-          <step>A</step>
-          <octave>4</octave>
-        </pitch>
-        <duration>4</duration>
-        <voice>1</voice>
-        <type>quarter</type>
-        <accidental>sharp</accidental>
-        <stem>down</stem>
-        <notations>
-          <articulations>
-            <staccato placement="above"/>
-            <accent placement="above"/>
-          </articulations>
-        </notations>
-      </note>
-    </measure>
-  </part>
-</score-partwise>
diff --git a/input/regression/musicxml/02i-Articulations-Texts-PJB.xml b/input/regression/musicxml/02i-Articulations-Texts-PJB.xml
deleted file mode 100644 (file)
index 8e52b8d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 0.6b Partwise//EN"
- "http://www.musicxml.org/dtds/partwise.dtd">
-<score-partwise>
-       <identification>
-               <encoding>
-                       <software>/usr/bin/vi</software>
-                       <encoding-date>2007-02-01</encoding-date>
-               </encoding>
-       </identification>
-       <part-list>
-               <score-part id="P1"><part-name></part-name></score-part>
-       </part-list>
-       <part id="P1">
-               <measure number="1">
-                       <attributes>
-                               <divisions>96</divisions>
-                               <key><fifths>0</fifths></key>
-                               <time><beats>4</beats><beat-type>4</beat-type></time>
-                               <staves>1</staves>
-                               <clef number="1"><sign>G</sign><line>2</line></clef>
-                       </attributes>
-                       <direction placement="above">
-                               <direction-type>
-                                       <words default-x="-1" default-y="15" font-size="medium" font-weight="normal"> 
-                                               Normal, Medium
-                                       </words>
-                               </direction-type>
-                               <staff>1</staff>
-                       </direction>
-                       <note>
-                               <pitch><step>F</step><octave>4</octave></pitch>
-                               <duration>384</duration>
-                               <voice>1</voice>
-                               <type>eighth</type>
-                               <staff>1</staff>
-                       </note>
-                       <direction placement="below">
-                               <direction-type>
-                                       <words default-x="1" default-y="15" justify="left" font-size="medium" font-weight="bold"> 
-                                               Bold, Medium
-                                       </words>
-                               </direction-type>
-                               <staff>1</staff>
-                       </direction>
-               </measure>
-               <measure number="2">
-                       <direction placement="above">
-                               <direction-type>
-                                       <words default-x="1" default-y="15" font-size="large" font-weight="normal"> 
-                                               Normal, Large
-                                       </words>
-                               </direction-type>
-                               <staff>1</staff>
-                       </direction>
-                       <note>
-                               <pitch><step>G</step><octave>4</octave></pitch>
-                               <duration>384</duration>
-                               <voice>1</voice>
-                               <type>whole</type>
-                               <staff>1</staff>
-                       </note>
-                       <direction placement="below">
-                               <direction-type>
-                                       <words default-x="1" default-y="15" font-size="large" font-weight="bold"> 
-                                               Bold, Large
-                                       </words>
-                               </direction-type>
-                               <staff>1</staff>
-                       </direction>
-               </measure>
-               <measure number="3">
-                       <direction placement="above">
-                               <direction-type>
-                                       <words default-x="1" default-y="15" font-size="small" font-weight="normal"> 
-                                               Normal, Small
-                                       </words>
-                               </direction-type>
-                               <staff>1</staff>
-                       </direction>
-                       <note>
-                               <pitch><step>F</step><octave>4</octave></pitch>
-                               <duration>384</duration>
-                               <voice>1</voice>
-                               <type>whole</type>
-                               <staff>1</staff>
-                       </note>
-                        <direction placement="below">
-                            <direction-type>
-                                <words default-x="1" default-y="15" font-size="small" font-weight="bold"> 
-                                    Bold, Small
-                                </words>
-                            </direction-type>
-                            <staff>1</staff>
-                        </direction>
-                        <direction placement="below">
-                            <direction-type>
-                                <words default-x="1" default-y="-15" font-size="small" color="#FF8000"> 
-                                    Normal, Small, Colored, Below
-                                </words>
-                            </direction-type>
-                            <staff>1</staff>
-                        </direction>
-               </measure>
-       </part>
-</score-partwise>
diff --git a/input/regression/musicxml/04b-Glissando.xml b/input/regression/musicxml/04b-Glissando.xml
new file mode 100644 (file)
index 0000000..a9e0e0a
--- /dev/null
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN"
+                                "http://www.musicxml.org/dtds/partwise.dtd">
+<score-partwise version="2.0">
+  <movement-title>Glissando and Slide in MusicXML</movement-title>
+  <identification/>
+  <defaults/>
+  <part-list>
+    <score-part id="P1">
+      <part-name></part-name>
+    </score-part>
+  </part-list>
+  <!--=========================================================-->
+  <part id="P1">
+    <!-- Glissando styles: glissando/slide, solid/dashed/dotted/wavy -->
+    <measure number="1">
+      <attributes>
+        <divisions>1</divisions>
+        <key>
+          <fifths>0</fifths>
+          <mode>major</mode>
+        </key>
+        <clef>
+          <sign>G</sign>
+          <line>2</line>
+        </clef>
+      </attributes>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando number="1" type="stop"/>
+        </notations>
+        <lyric number="1"><text>glissando</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="solid" number="1" type="start">text</glissando>
+        </notations>
+        <lyric number="1"><text>solid</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="solid" number="1" type="stop"/>
+        </notations>
+        <lyric number="1"><text>(+text)</text></lyric>
+      </note>
+    </measure>
+    <measure number="2">
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="dashed" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>dashed</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="dashed" number="1" type="stop"/>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="dotted" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>dotted</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="dotted" number="1" type="stop"/>
+        </notations>
+      </note>
+    </measure>
+    <measure number="3">
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="wavy" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>wavy</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <glissando line-type="wavy" number="1" type="stop"/>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>normal</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide number="1" type="stop"/>
+        </notations>
+        <lyric number="1"><text>slide</text></lyric>
+      </note>
+    </measure>
+    <measure number="4">
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="solid" number="1" type="start">text</slide>
+        </notations>
+        <lyric number="1"><text>solid</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="solid" number="1" type="stop"/>
+        </notations>
+        <lyric number="1"><text>(+text)</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="dashed" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>dashed</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="solid" number="1" type="stop"/>
+        </notations>
+      </note>
+    </measure>
+    <measure number="5">
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="dotted" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>dotted</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="dotted" number="1" type="stop"/>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>G</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="wavy" number="1" type="start"/>
+        </notations>
+        <lyric number="1"><text>wavy</text></lyric>
+      </note>
+      <note>
+        <pitch>
+          <step>F</step>
+          <octave>5</octave>
+        </pitch>
+        <duration>1</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <stem>down</stem>
+        <notations>
+          <slide line-type="wavy" number="1" type="stop"/>
+        </notations>
+      </note>
+      
+      <barline location="right">
+        <bar-style>light-heavy</bar-style>
+      </barline>
+    </measure>
+  </part>
+</score-partwise>
index f68c17ce193a91964fb2749cba8e8c4dc9fa4579..07af416ab779ef2d024423e98b13baa821fde1d6 100644 (file)
@@ -697,6 +697,10 @@ class ChordEvent (NestedMusic):
                 printer ('\\grace')
             # don't print newlines after the { and } braces
             self.grace_elements.print_ly (printer, False)
+        # Print all overrides and other settings needed by the 
+        # articulations/ornaments before the note
+        for e in other_events:
+            e.print_before_note (printer)
 
         if rest_events:
             rest_events[0].print_ly (printer)
@@ -719,6 +723,9 @@ class ChordEvent (NestedMusic):
         for e in other_events:
             e.print_ly (printer)
 
+        for e in other_events:
+            e.print_after_note (printer)
+
         self.print_comment (printer)
             
 class Partial (Music):
@@ -755,6 +762,19 @@ class BarLine (Music):
         return " | "
 
 class Event(Music):
+    def __init__ (self):
+        # strings to print before the note to which an event is attached.
+        # Ignored for notes etc.
+        self.before_note = None
+        self.after_note = None
+   # print something before the note to which an event is attached, e.g. overrides
+    def print_before_note (self, printer):
+        if self.before_note:
+            printer.dump (self.before_note)
+   # print something after the note to which an event is attached, e.g. resetting
+    def print_after_note (self, printer):
+        if self.after_note:
+            printer.dump (self.after_note)
     pass
 
 class SpanEvent (Event):
@@ -772,24 +792,23 @@ class SpanEvent (Event):
         self.span_type = type
 
 class SlurEvent (SpanEvent):
+    def print_before_note (self, printer):
+        command = {'dotted': '\\slurDotted', 
+                  'dashed' : '\\slurDashed'}.get (self.line_type, '')
+        if command and self.span_direction == -1:
+            printer.dump (command)
+    def print_after_note (self, printer):
+        # reset non-solid slur types!
+        command = {'dotted': '\\slurSolid', 
+                  'dashed' : '\\slurSolid'}.get (self.line_type, '')
+        if command and self.span_direction == -1:
+            printer.dump (command)
     def ly_expression (self):
-        before = ''
-        after = ''
-        # TODO: setting dashed/dotted line style does not work, because that
-        #       command needs to be written before the note, not when the
-        #       event is observed after the note!
-        #before = {'dotted': '\\slurDotted', 
-        #          'dashed' : '\\slurDashed'}.get (self.line_type, '')
-        #if before:
-            #after = '\\slurSolid'
-
-        return {-1: before + '(' + after,
-            1:')'}.get (self.span_direction, '')
+        return {-1: '(', 1:')'}.get (self.span_direction, '')
 
 class BeamEvent (SpanEvent):
     def ly_expression (self):
-        return {-1: '[',
-            1:']'}.get (self.span_direction, '')
+        return {-1: '[', 1:']'}.get (self.span_direction, '')
 
 class PedalEvent (SpanEvent):
     def ly_expression (self):
@@ -836,24 +855,37 @@ class TrillSpanEvent (SpanEvent):
             1:'\\stopTrillSpan'}.get (self.span_direction, '')
 
 class GlissandoEvent (SpanEvent):
+    def print_before_note (self, printer):
+        if self.span_direction == -1:
+            style= {
+                "dashed" : "dashed-line",
+                "dotted" : "dotted-line",
+                "wavy"   : "zigzag" 
+            }. get (self.line_type, None)
+            if style:
+                printer.dump ("\once \override Glissando #'style = #'%s" % style)
     def ly_expression (self):
-        style = ''
-        # TODO: wavy-line glissandos don't work, becasue the style has to be
-        #       set before the note, at the \glissando it's already too late!
-        #if self.line_type == 'wavy':
-            #style = "\once\override Glissando #'style = #'zigzag"
-        # In lilypond, glissando is NOT a spanner, unlike MusicXML.
-        return {-1: style + '\\glissando',
+        return {-1: '\\glissando',
             1:''}.get (self.span_direction, '')
 
 class ArpeggioEvent(Event):
     def __init__ (self):
         Event.__init__ (self)
         self.direction = 0
+        self.non_arpeggiate = False
     def wait_for_note (self):
         return True
+    def print_before_note (self, printer):
+        if self.non_arpeggiate:
+            printer.dump ("\\arpeggioBracket")
+        else:
+          dir = { -1: "\\arpeggioDown", 1: "\\arpeggioUp" }.get (self.direction, '')
+          if dir:
+              printer.dump (dir)
+    def print_after_note (self, printer):
+        if self.non_arpeggiate or self.direction:
+            printer.dump ("\\arpeggioNeutral")
     def ly_expression (self):
-        # TODO: Use self.direction for up/down arpeggios
         return ('\\arpeggio')
 
 
@@ -883,6 +915,7 @@ class HairpinEvent (SpanEvent):
 
 class DynamicsEvent (Event):
     def __init__ (self):
+        Event.__init__ (self)
         self.type = None
     def wait_for_note (self):
         return True
@@ -898,6 +931,7 @@ class DynamicsEvent (Event):
 
 class MarkEvent (Event):
     def __init__ (self, text="\\default"):
+        Event.__init__ (self)
         self.mark = text
     def wait_for_note (self):
         return False
@@ -919,6 +953,7 @@ class MusicGlyphMarkEvent (MarkEvent):
 
 class TextEvent (Event):
     def __init__ (self):
+        Event.__init__ (self)
         self.Text = None
         self.force_direction = None
         self.markup = ''
@@ -936,6 +971,7 @@ class TextEvent (Event):
 
 class ArticulationEvent (Event):
     def __init__ (self):
+        Event.__init__ (self)
         self.type = None
         self.force_direction = None
     def wait_for_note (self):
index a08afb081435c6146cff3cd1b173cc98ae4d6ee8..f96895f638e036445eb6ea7c4f18565d0de7ebb1 100644 (file)
@@ -776,6 +776,9 @@ class Pedal (Music_xml_spanner):
 class Glissando (Music_xml_spanner):
     pass
 
+class Slide (Music_xml_spanner):
+    pass
+
 class Octave_shift (Music_xml_spanner):
     # default is 8 for the octave-shift!
     def get_size (self):
@@ -898,6 +901,7 @@ class_dict = {
        'pitch': Pitch,
        'rest': Rest,
     'score-part': Score_part,
+        'slide': Slide,
        'slur': Slur,
        'staff': Staff,
         'syllabic': Syllabic,
index a163522750a95afefc08ffdbabc594f565435b58..b982633348b341a7e247aed874666647e9ed5ba2 100644 (file)
@@ -190,9 +190,9 @@ class PartGroupInfo:
     def add_end (self, g):
         self.end[getattr (g, 'number', "1")] = g
     def print_ly (self, printer):
-        error_message ("Unprocessed PartGroupInfo %s encountered" % self)
+        error_message (_ ("Unprocessed PartGroupInfo %s encountered") % self)
     def ly_expression (self):
-        error_message ("Unprocessed PartGroupInfo %s encountered" % self)
+        error_message (_ ("Unprocessed PartGroupInfo %s encountered") % self)
         return ''
 
 def staff_attributes_to_string_tunings (mxl_attr):
@@ -606,7 +606,7 @@ def musicxml_key_to_lily (attributes):
         start_pitch.step = n
         start_pitch.alteration = a
     except  KeyError:
-        error_message ('unknown mode %s' % mode)
+        error_message (_ ("unknown mode %s, expecting 'major' or 'minor'") % mode)
 
     fifth = musicexp.Pitch()
     fifth.step = 4
@@ -711,6 +711,7 @@ spanner_event_dict = {
     'glissando' : musicexp.GlissandoEvent,
     'octave-shift' : musicexp.OctaveShiftEvent,
     'pedal' : musicexp.PedalEvent,
+    'slide' : musicexp.GlissandoEvent,
     'slur' : musicexp.SlurEvent,
     'wavy-line' : musicexp.TrillSpanEvent,
     'wedge' : musicexp.HairpinEvent
@@ -758,7 +759,7 @@ def musicxml_spanner_to_lily_event (mxl_event):
     return ev
 
 def musicxml_direction_to_indicator (direction):
-    return { "above": 1, "upright": 1, "up":1, "below": -1, "downright": -1, "down": -1, "inverted": -1 }.get (direction, 0)
+    return { "above": 1, "upright": 1, "up": 1, "below": -1, "downright": -1, "down": -1, "inverted": -1 }.get (direction, 0)
 
 def musicxml_fermata_to_lily_event (mxl_event):
     ev = musicexp.ArticulationEvent ()
@@ -776,6 +777,12 @@ def musicxml_arpeggiate_to_lily_event (mxl_event):
     ev.direction = musicxml_direction_to_indicator (getattr (mxl_event, 'direction', None))
     return ev
 
+def musicxml_nonarpeggiate_to_lily_event (mxl_event):
+    ev = musicexp.ArpeggioEvent ()
+    ev.non_arpeggiate = True
+    ev.direction = musicxml_direction_to_indicator (getattr (mxl_event, 'direction', None))
+    return ev
+
 def musicxml_tremolo_to_lily_event (mxl_event):
     ev = musicexp.TremoloEvent ()
     txt = mxl_event.get_text ()
@@ -1334,7 +1341,7 @@ class LilyPondVoiceBuilder:
         diff = moment - current_end
         
         if diff < Rational (0):
-            error_message ('Negative skip %s' % diff)
+            error_message (_ ('Negative skip %s') % diff)
             diff = Rational (0)
 
         if diff > Rational (0) and not (self.ignore_skips and moment == 0):
@@ -1601,7 +1608,14 @@ def musicxml_voice_to_lily_voice (voice):
                 if ev:
                     ev_chord.append (ev)
 
+            arpeggiate = notations.get_named_children ('non-arpeggiate')
+            for a in arpeggiate:
+                ev = musicxml_nonarpeggiate_to_lily_event (a)
+                if ev:
+                    ev_chord.append (ev)
+
             glissandos = notations.get_named_children ('glissando')
+            glissandos += notations.get_named_children ('slide')
             for a in glissandos:
                 ev = musicxml_spanner_to_lily_event (a)
                 if ev:
@@ -1893,7 +1907,7 @@ def update_score_setup (score_structure, part_list, voices):
         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)
+            error_message (_ ('unknown part in part-list: %s') % part_id)
             continue
 
         staves = reduce (lambda x,y: x+ y,