# Case 1: "Sibelius 5.1" with the "Dolet 3.4 for Sibelius" plugin
# is missing all beam ends => ignore all beaming information
ignore_beaming_software = {
+ "Dolet 4 for Sibelius, Beta 2": "Dolet 4 for Sibelius, Beta 2",
"Dolet 3.5 for Sibelius": "Dolet 3.5 for Sibelius",
"Dolet 3.4 for Sibelius": "Dolet 3.4 for Sibelius",
"Dolet 3.3 for Sibelius": "Dolet 3.3 for Sibelius",
elts.append (ev)
return elts
+
+def musicxml_print_to_lily (el):
+ # TODO: Implement other print attributes
+ # <!ELEMENT print (page-layout?, system-layout?, staff-layout*,
+ # measure-layout?, measure-numbering?, part-name-display?,
+ # part-abbreviation-display?)>
+ # <!ATTLIST print
+ # staff-spacing %tenths; #IMPLIED
+ # new-system %yes-no; #IMPLIED
+ # new-page %yes-no-number; #IMPLIED
+ # blank-page NMTOKEN #IMPLIED
+ # page-number CDATA #IMPLIED
+ # >
+ elts = []
+ if (hasattr (el, "new-system")):
+ val = getattr (el, "new-system")
+ if (val == "yes"):
+ elts.append (musicexp.Break ("break"))
+ if (hasattr (el, "new-page")):
+ val = getattr (el, "new-page")
+ if (val == "yes"):
+ elts.append (musicexp.Break ("pageBreak"))
+ return elts
+
class Marker (musicexp.Music):
def __init__ (self):
voice_builder.set_measure_length (current_measure_length)
for n in voice._elements:
+ tie_started = False
if n.get_name () == 'forward':
continue
staff = n.get_maybe_exist_named_child ('staff')
chordnames_builder.add_barline (a, False)
continue
+
+ if isinstance (n, musicxml.Print):
+ for a in musicxml_print_to_lily (n):
+ voice_builder.add_command (a, False)
+ continue
+
# Continue any multimeasure-rests before trying to add bar checks!
# Don't handle new MM rests yet, because for them we want bar checks!
rest = n.get_maybe_exist_typed_child (musicxml.Rest)
if mxl_tie and mxl_tie.type == 'start':
ev_chord.append (musicexp.TieEvent ())
is_tied = True
+ tie_started = True
else:
is_tied = False
if not lnr in note_lyrics_processed:
lyrics[lnr].append ("\skip4")
- ## force trailing mm rests to be written out.
+ # Assume that a <tie> element only lasts for one note.
+ # This might not be correct MusicXML interpretation, but works for
+ # most cases and fixes broken files, which have the end tag missing
+ if is_tied and not tie_started:
+ is_tied = False
+
+ ## force trailing mm rests to be written out.
voice_builder.add_music (musicexp.ChordEvent (), Rational (0))
ly_voice = group_tuplets (voice_builder.elements, tuplet_events)
def voices_in_part_in_parts (parts):
"""return a Part -> Name -> Voice dictionary"""
- return dict([(p.id, voices_in_part (p)) for p in parts])
+ # don't crash if p doesn't have an id (that's invalid MusicXML,
+ # but such files are out in the wild!
+ dictionary = {}
+ for p in parts:
+ voices = voices_in_part (p)
+ if (hasattr (p, "id")):
+ dictionary[p.id] = voices
+ else:
+ # TODO: extract correct part id from other sources
+ dictionary[None] = voices
+ return dictionary;
def get_all_voices (parts):