]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Add a way to implement compatibility modes, ignore beams for Sibelius
authorReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 21 Feb 2008 19:03:04 +0000 (20:03 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 21 Feb 2008 19:03:04 +0000 (20:03 +0100)
input/regression/musicxml/99a-Sibelius5-IgnoreBeaming.xml [new file with mode: 0644]
python/musicexp.py
python/musicxml.py
scripts/musicxml2ly.py

diff --git a/input/regression/musicxml/99a-Sibelius5-IgnoreBeaming.xml b/input/regression/musicxml/99a-Sibelius5-IgnoreBeaming.xml
new file mode 100644 (file)
index 0000000..e0a922d
Binary files /dev/null and b/input/regression/musicxml/99a-Sibelius5-IgnoreBeaming.xml differ
index b266830d0726bd32e43b884e5ae1e6e2f795836a..1596cd392b0eca295aa88b9f74a02b6ccde3a49d 100644 (file)
@@ -835,7 +835,6 @@ class BracketSpannerEvent (SpanEvent):
             1:'\\stopGroup'}.get (self.span_direction, '')
 
 
-# type==-1 means octave up, type==-2 means octave down
 class OctaveShiftEvent (SpanEvent):
     def wait_for_note (self):
         return False
index 9d6fa054dbddd136b8184021dc0fbfe97ccdb46a..f028cce8a3a50c8d531040f6b0683f97e26eb030 100644 (file)
@@ -179,6 +179,16 @@ class Identification (Xml_node):
         return self.get_encoding_information ('encoder')
     def get_encoding_description (self):
         return self.get_encoding_information ('encoding-description')
+    
+    def get_encoding_software_list (self):
+        enc = self.get_named_children ('encoding')
+        software = []
+        for e in enc:
+            softwares = e.get_named_children ('software')
+            for s in softwares:
+                software.append (s.get_text ())
+        return software
+
 
 
 class Duration (Music_xml_node):
index 2e22f8e76cab500203df528807d619599e349126..5e791abf441c508a3220842e326ae8dc582fbeb2 100644 (file)
@@ -24,6 +24,12 @@ from rational import Rational
 # Store command-line options in a global variable, so we can access them everythwere
 options = None
 
+class Conversion_Settings:
+    def __init__(self):
+       self.ignore_beaming = False
+
+conversion_settings = Conversion_Settings ()
+
 def progress (str):
     ly.stderr_write (str + '\n')
     sys.stderr.flush ()
@@ -177,6 +183,19 @@ def extract_score_information (tree):
         set_if_exists ('encoder', ids.get_encoding_person ())
         set_if_exists ('encodingdescription', ids.get_encoding_description ())
 
+        # Finally, apply the required compatibility modes
+        # Some applications created wrong MusicXML files, so we need to 
+        # apply some compatibility mode, e.g. ignoring some features/tags
+        # in those files
+        software = ids.get_encoding_software_list ()
+        global conversion_settings
+
+        # Case 1: "Sibelius 5.1" with the "Dolet 3.4 for Sibelius" plugin
+        #         is missing all beam ends => ignore all beaming information
+        if "Dolet 3.4 for Sibelius" in software:
+            conversion_settings.ignore_beaming = True
+        # TODO: Check for other unsupported features
+
     return header
 
 class PartGroupInfo:
@@ -1675,7 +1694,7 @@ def musicxml_voice_to_lily_voice (voice):
         mxl_beams = [b for b in n.get_named_children ('beam')
                      if (b.get_type () in ('begin', 'end')
                          and b.is_primary ())] 
-        if mxl_beams:
+        if mxl_beams and not conversion_settings.ignore_beaming:
             beam_ev = musicxml_spanner_to_lily_event (mxl_beams[0])
             if beam_ev:
                 ev_chord.append (beam_ev)