1:''}.get (self.span_direction, '')
class ArpeggioEvent(Event):
+ def __init__ (self):
+ Event.__init__ (self)
+ self.direction = 0
def wait_for_note (self):
return True;
def ly_expression (self):
+ # TODO: Use self.direction for up/down arpeggios
return ('\\arpeggio')
# default is -
return { 1: '^', -1: '_', 0: '-' }.get (self.force_direction, '-')
def ly_expression (self):
- return '%s%s' % (self.direction_mod (), self.type)
+ if self.type:
+ return '%s%s' % (self.direction_mod (), self.type)
+ else:
+ return ''
class NoDirectionArticulationEvent (ArticulationEvent):
def ly_expression (self):
- return '\\%s' % self.type
+ if self.type:
+ return '\\%s' % self.type
+ else:
+ return ''
class MarkupEvent (ShortArticulationEvent):
def __init__ (self):
for [staff_id, voices] in self.part_information:
if staff_id:
- printer ('\\context Staff = "%s" << ' % staff_id)
+ printer ('\\context %s = "%s" << ' % (self.stafftype, staff_id))
else:
- printer ('\\context Staff << ')
+ printer ('\\context %s << ' % self.stafftype)
printer.newline ()
n = 0
nr_voices = len (voices)
return self._lyrics
-
class Part (Music_xml_node):
def __init__ (self):
Music_xml_node.__init__ (self)
self._voices = []
+ self._staff_attributes_dict = {}
def get_part_list (self):
n = self
for (s, vids) in staff_to_voice_dict.items ():
staff_attributes = part.extract_attributes_for_staff (start_attr, s)
staff_attributes.read_self ()
+ part._staff_attributes_dict[s] = staff_attributes
for v in vids:
voices[v].insert (0, staff_attributes)
voices[v]._elements[0].read_self()
ev.force_direction = dir
return ev
+
+def musicxml_arpeggiate_to_lily_event (mxl_event):
+ ev = musicexp.ArpeggioEvent ()
+ ev.direction = {"up": 1, "down": -1}.get (getattr (mxl_event, 'direction', None), 0)
+ return ev
+
+
def musicxml_tremolo_to_lily_event (mxl_event):
ev = musicexp.TremoloEvent ()
ev.bars = mxl_event.get_text ()
# -) (class, name) (like string, only that a different class than ArticulationEvent is used)
# TODO: Some translations are missing!
articulations_dict = {
- "accent": (musicexp.ShortArticulationEvent, ">"),
+ "accent": (musicexp.ShortArticulationEvent, ">"), # or "accent"
"accidental-mark": musicxml_accidental_mark,
"bend": musicxml_bend_to_lily_event,
"breath-mark": (musicexp.NoDirectionArticulationEvent, "breathe"),
#"caesura": "caesura",
#"delayed-turn": "?",
- #"detached-legato": "",
+ "detached-legato": (musicexp.ShortArticulationEvent, "_"), # or "portato"
#"doit": "",
#"double-tongue": "",
"down-bow": "downbow",
"inverted-mordent": "prall",
"inverted-turn": "reverseturn",
"mordent": "mordent",
- #"open-string": "",
+ "open-string": "open",
#"plop": "",
#"pluck": "",
- #"portato": (musicexp.ShortArticulationEvent, "_"), # does not exist in MusicXML
#"pull-off": "",
#"schleifer": "?",
#"scoop": "",
#"shake": "?",
#"snap-pizzicato": "",
#"spiccato": "",
- "staccatissimo": (musicexp.ShortArticulationEvent, "|"),
- "staccato": (musicexp.ShortArticulationEvent, "."),
- "stopped": (musicexp.ShortArticulationEvent, "+"),
+ "staccatissimo": (musicexp.ShortArticulationEvent, "|"), # or "staccatissimo"
+ "staccato": (musicexp.ShortArticulationEvent, "."), # or "staccato"
+ "stopped": (musicexp.ShortArticulationEvent, "+"), # or "stopped"
#"stress": "",
"string": musicxml_string_event,
- "strong-accent": (musicexp.ShortArticulationEvent, "^"),
+ "strong-accent": (musicexp.ShortArticulationEvent, "^"), # or "marcato"
#"tap": "",
- "tenuto": (musicexp.ShortArticulationEvent, "-"),
+ "tenuto": (musicexp.ShortArticulationEvent, "-"), # or "tenuto"
#"thumb-position": "",
#"toe": "",
"turn": "turn",
arpeggiate = notations.get_named_children ('arpeggiate')
for a in arpeggiate:
- ev_chord.append (musicexp.ArpeggioEvent ())
+ ev = musicxml_arpeggiate_to_lily_event (a)
+ if ev:
+ ev_chord.append (ev)
glissandos = notations.get_named_children ('glissando')
for a in glissandos:
staves = uniq_list (staves)
staves.sort ()
for s in staves:
- #((music, lyrics), mxlvoice))
thisstaff_raw_voices = [(voice_name, voice.lyrics_order)
for (voice_name, voice) in nv_dict.items ()
if voice.voicedata._start_staff == s]