\set Timing.measureLength = $mlen
\set Timing.timeSignatureFraction = #(cons (ly:moment-main-numerator $mlen)
(ly:moment-main-denominator $mlen))
-\set Timing.beatLength = $beat
+\set Timing.baseMoment = $beat
% TODO: Implement beatGrouping and auto-beam-settings!!!
#} ))
if staff_lines:
lines = string.atoi (staff_lines.get_text ())
+ # TODO: Handle other staff attributes like staff-space, etc.
+
staff = None
if clef_sign == "percussion" and lines == 1:
staff = musicexp.RhythmicStaff ()
staff.string_tunings = staff_attributes_to_string_tunings (attributes)
# staff.tablature_format = ???
else:
- # TODO: Handle case with lines <> 5!
staff = musicexp.Staff ()
+ # TODO: Handle case with lines <> 5!
+ if (lines != 5):
+ staff.add_context_modification ("\\override StaffSymbol #'line-count = #%s" % lines)
+
return staff
transposition.pitch = musicexp.Pitch ().transposed (shift)
return transposition
+def musicxml_staff_details_to_lily (attributes):
+ details = attributes.get_maybe_exist_named_child ('staff-details')
+ if not details:
+ return None
+
+ ## TODO: Handle staff-type, staff-lines, staff-tuning, capo, staff-size
+ ret = []
+
+ stafflines = details.get_maybe_exist_named_child ('staff-lines')
+ if stafflines:
+ lines = string.atoi (stafflines.get_text ());
+ lines_event = musicexp.StaffLinesEvent (lines);
+ ret.append (lines_event);
+
+ return ret;
+
def musicxml_attributes_to_lily (attrs):
elts = []
'time': musicxml_time_to_lily,
'key': musicxml_key_to_lily,
'transpose': musicxml_transpose_to_lily,
+ 'staff-details': musicxml_staff_details_to_lily,
}
for (k, func) in attr_dispatch.items ():
children = attrs.get_named_children (k)
if children:
ev = func (attrs)
- if ev:
+ if isinstance (ev, list):
+ for e in ev:
+ elts.append (e)
+ elif ev:
elts.append (ev)
return elts
if ev:
# TODO: set the correct direction! Unfortunately, \mark in ly does
# not seem to support directions!
+ ev.force_direction = dir
res.append (ev)
continue
acc = n.get_maybe_exist_named_child ('accidental')
if acc:
# let's not force accs everywhere.
- event.cautionary = acc.editorial
+ event.cautionary = acc.cautionary
+ # TODO: Handle editorial accidentals
+ # TODO: Handle the level-display setting for displaying brackets/parentheses
elif n.get_maybe_exist_typed_child (musicxml.Unpitched):
# Unpitched elements have display-step and can also have
# Allow the user to leave out the .xml or xml on the filename
basefilename = args[0].decode('utf-8')
if basefilename == "-": # Read from stdin
- basefilename = "-"
+ filename = "-"
else:
filename = get_existing_filename_with_extension (basefilename, "xml")
if not filename: