From: Reinhold Kainhofer Date: Mon, 8 Dec 2008 21:28:56 +0000 (+0100) Subject: MusicXML: Implement lyrics extenders X-Git-Tag: release/2.12.0-1~13^2~27^2~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=413aeab5abbb9ebe01f41154ac6cd49bd806b2fe;p=lilypond.git MusicXML: Implement lyrics extenders --- diff --git a/input/regression/musicxml/61a-Lyrics.xml b/input/regression/musicxml/61a-Lyrics.xml index 81e0d60835..69642ea874 100644 --- a/input/regression/musicxml/61a-Lyrics.xml +++ b/input/regression/musicxml/61a-Lyrics.xml @@ -82,7 +82,6 @@ single Ja! - @@ -130,7 +129,6 @@ end ra! - @@ -144,9 +142,6 @@ 1 1 quarter - - - @@ -157,9 +152,8 @@ 1 quarter - begin + single Bah! - @@ -170,9 +164,6 @@ 2 1 half - - - light-heavy diff --git a/input/regression/musicxml/61k-Lyrics-SpannersExtenders.xml b/input/regression/musicxml/61k-Lyrics-SpannersExtenders.xml new file mode 100644 index 0000000000..95293128d3 --- /dev/null +++ b/input/regression/musicxml/61k-Lyrics-SpannersExtenders.xml @@ -0,0 +1,172 @@ + + + + + + Lyrics spanners: continued + syllables and extenders, possibly spanning multiple notes. The + intermediate notes do not have any <lyric> + element. + + + + + MusicXML Part + + + + + + + 1 + + 0 + major + + + + G + 2 + + + + + C + 5 + + 1 + 1 + quarter + + single + A + + + + + + C + 5 + + 1 + 1 + quarter + + + + C + 5 + + 1 + 1 + quarter + + begin + b + + + + + C + 5 + + 1 + 1 + quarter + + + + + + + C + 5 + + 1 + 1 + quarter + + + + C + 5 + + 1 + 1 + quarter + + end + CC + + + + + + C + 5 + + 1 + 1 + quarter + + + + C + 5 + + 1 + 1 + quarter + + + + + + + C + 5 + + 1 + 1 + quarter + + single + e + + + + + + C + 5 + + 1 + 1 + quarter + + + + C + 5 + + 1 + 1 + quarter + + + + 1 + 1 + quarter + + + light-heavy + + + + + diff --git a/python/musicxml.py b/python/musicxml.py index 9a918ba6b3..b6a5bbeac8 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -539,6 +539,8 @@ class Syllabic (Music_xml_node): return (text == "begin") or (text == "middle") class Elision (Music_xml_node): pass +class Extend (Music_xml_node): + pass class Text (Music_xml_node): pass @@ -1173,6 +1175,7 @@ class_dict = { 'direction-type': DirType, 'duration': Duration, 'elision': Elision, + 'extend': Extend, 'frame': Frame, 'frame-note': Frame_Note, 'figured-bass': FiguredBass, diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index dca950e8f7..e37702686e 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -1763,6 +1763,7 @@ def musicxml_note_to_lily_main_event (n): def musicxml_lyrics_to_text (lyrics): # TODO: Implement text styles for lyrics syllables continued = False + extended = False text = '' for e in lyrics.get_all_children (): if isinstance (e, musicxml.Syllabic): @@ -1775,15 +1776,24 @@ def musicxml_lyrics_to_text (lyrics): if text: text += " " continued = False + extended = False + elif isinstance (e, musicxml.Extend): + if text: + text += " " + extended = True if text == "-" and continued: return "--" - elif text == "_" and continued: + elif text == "_" and extended: return "__" elif continued and text: return musicxml.escape_ly_output_string (text) + " --" elif continued: return "--" + elif extended and text: + return musicxml.escape_ly_output_string (text) + " __" + elif extended: + return "__" elif text: return musicxml.escape_ly_output_string (text) else: