]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/musicxml2ly.py
Fix a bug that produced incorrect syntax for the staccatissimo articulation.
[lilypond.git] / scripts / musicxml2ly.py
index 7c5dc69c1a749a67531a4df0dfe82d1ca7202429..307650e2f77c620ac5a358362b9264a4304f6318 100644 (file)
@@ -24,6 +24,8 @@ import musicexp
 
 from rational import Rational
 
+lilypond_version = "@TOPLEVEL_VERSION@"
+
 # Store command-line options in a global variable, so we can access them everywhere
 options = None
 
@@ -227,7 +229,10 @@ def extract_score_information(tree):
         set_if_exists('encoder', ids.get_encoding_person())
         set_if_exists('encodingdescription', ids.get_encoding_description())
         set_if_exists('source', ids.get_source())
-        set_if_exists('miscellaneous', ids.get_file_description());
+
+        # <miscellaneous><miscellaneous-field name="description"> ... becomes
+        # \header { texidoc = ...
+        set_if_exists('texidoc', ids.get_file_description());
 
         # Finally, apply the required compatibility modes
         # Some applications created wrong MusicXML files, so we need to
@@ -757,6 +762,14 @@ def group_tuplets(music_list, events):
         new_list.extend(music_list[last:i1])
         seq = musicexp.SequentialMusic()
         last = i2 + 1
+
+        # At this point music_list[i1:last] encompasses all the notes of the
+        # tuplet. There might be dynamics following this range, however, which
+        # apply to the last note of the tuplet. Advance last to include them
+        # in the range.
+        while last < len(music_list) and isinstance(music_list[last], musicexp.DynamicsEvent):
+            last += 1
+
         seq.elements = music_list[i1:last]
 
         tsm.element = seq
@@ -1180,7 +1193,7 @@ articulations_dict = {
     #"shake": "?",
     "snap-pizzicato": "snappizzicato",
     #"spiccato": "?",
-    "staccatissimo": (musicexp.ShortArticulationEvent, "|"), # or "staccatissimo"
+    "staccatissimo": (musicexp.ShortArticulationEvent, "!"), # or "staccatissimo"
     "staccato": (musicexp.ShortArticulationEvent, "."), # or "staccato"
     "stopped": (musicexp.ShortArticulationEvent, "+"), # or "stopped"
     #"stress": "?",
@@ -3057,7 +3070,7 @@ def update_layout_information():
 
 def print_ly_preamble(printer, filename):
     printer.dump_version(lilypond_version)
-    printer.print_verbatim('% automatically converted by philomelos musicxml2ly v0.2.41\n')
+    printer.print_verbatim('% automatically converted by musicxml2ly from ' + filename)
     printer.newline()
     printer.dump(r'\pointAndClickOff')
     printer.newline()
@@ -3217,8 +3230,6 @@ def get_existing_filename_with_extension(filename, ext):
 
 
 def main():
-    global lilypond_version
-    lilypond_version = "@TOPLEVEL_VERSION@"
     opt_parser = option_parser()
 
     global options