# 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",
# page-number CDATA #IMPLIED
# >
elts = []
- if (hasattr (el, "new-system")):
+ if (hasattr (el, "new-system") and conversion_settings.convert_page_layout):
val = getattr (el, "new-system")
if (val == "yes"):
elts.append (musicexp.Break ("break"))
- if (hasattr (el, "new-page")):
+ if (hasattr (el, "new-page") and conversion_settings.convert_page_layout):
val = getattr (el, "new-page")
if (val == "yes"):
elts.append (musicexp.Break ("pageBreak"))
# TODO: How should I best convert the font-family attribute?
# TODO: How can I represent the underline, overline and line-through
- # attributes in Lilypond? Values of these attributes indicate
+ # attributes in LilyPond? Values of these attributes indicate
# the number of lines
return event
ev.bass = musicxml_chordpitch_to_lily (bass)
inversion = n.get_maybe_exist_named_child ('inversion')
if inversion:
- # TODO: Lilypond does not support inversions, does it?
+ # TODO: LilyPond does not support inversions, does it?
# Mail from Carl Sorensen on lilypond-devel, June 11, 2008:
# 4. LilyPond supports the first inversion in the form of added
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')
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):
dest = "convert_rest_positions",
help = _ ("do not convert exact vertical positions of rests"))
+ p.add_option ('--npl', '--no-page-layout',
+ action = "store_false",
+ default = True,
+ dest = "convert_page_layout",
+ help = _ ("do not convert the exact page layout and breaks"))
+
p.add_option ('--no-beaming',
action = "store_false",
default = True,
print_ly_additional_definitions (printer, filename)
if score_information:
score_information.print_ly (printer)
- if paper_information:
+ if paper_information and conversion_settings.convert_page_layout:
paper_information.print_ly (printer)
if layout_information:
layout_information.print_ly (printer)
needed_additional_definitions.append (options.language)
additional_definitions[options.language] = "\\include \"%s.ly\"\n" % options.language
conversion_settings.ignore_beaming = not options.convert_beaming
+ conversion_settings.convert_page_layout = options.convert_page_layout
# Allow the user to leave out the .xml or xml on the filename
basefilename = args[0].decode('utf-8')