<mode>major</mode>
</key>
<time symbol="common">
- <beats>4</beats>
+ <beats>5</beats>
<beat-type>4</beat-type>
</time>
<clef>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="yes" number="1" placement="below" type="start"/>
+ <tuplet bracket="yes" number="1" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="yes" number="1" placement="below" show-number="none" type="start"/>
+ <tuplet bracket="yes" number="1" show-number="none" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="yes" number="1" placement="below" show-number="both" type="start"/>
+ <tuplet bracket="yes" number="1" show-number="both" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="yes" number="1" placement="below" type="start"/>
+ <tuplet bracket="yes" number="1" show-number="both" show-type="actual" type="start"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet number="1" type="stop"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet bracket="yes" number="1" show-number="both" show-type="both" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet number="1" placement="below" type="start"/>
+ <tuplet bracket="yes" line-shape="curved" number="1" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet number="1" placement="below" show-number="none" type="start"/>
+ <tuplet bracket="yes" line-shape="curved" number="1" show-number="none" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet number="1" placement="below" show-number="both" type="start"/>
+ <tuplet bracket="yes" line-shape="curved" number="1" show-number="both" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet number="1" placement="below" type="start"/>
+ <tuplet bracket="yes" line-shape="curved" number="1" show-number="both" show-type="actual" type="start"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet number="1" type="stop"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet bracket="yes" line-shape="curved" number="1" show-number="both" show-type="both" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="no" number="1" placement="below" type="start"/>
+ <tuplet bracket="no" number="1" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
<tuplet bracket="no" number="1" show-number="none" type="start"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="no" number="1" placement="below" show-number="both" type="start"/>
+ <tuplet bracket="no" number="1" show-number="both" type="start"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet number="1" type="stop"/>
+ </notations>
+ </note>
+ <note>
+ <pitch>
+ <step>C</step>
+ <octave>5</octave>
+ </pitch>
+ <duration>136</duration>
+ <voice>1</voice>
+ <type>eighth</type>
+ <time-modification>
+ <actual-notes>3</actual-notes>
+ <normal-notes>2</normal-notes>
+ </time-modification>
+ <notations>
+ <tuplet bracket="no" number="1" show-number="both" show-type="actual" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
- <tuplet bracket="no" number="1" placement="below" type="start"/>
+ <tuplet bracket="no" number="1" show-number="both" show-type="both" type="start"/>
</notations>
</note>
<note>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>4</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
<tuplet number="1" placement="below" show-number="both" type="start"/>
</notations>
<actual-notes>4</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>4</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>4</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">begin</beam>
<notations>
<tuplet number="1" placement="below" type="start"/>
</notations>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">continue</beam>
</note>
<note>
<pitch>
<actual-notes>17</actual-notes>
<normal-notes>3</normal-notes>
</time-modification>
- <beam number="1">end</beam>
<notations>
<tuplet number="1" type="stop"/>
</notations>
<duration>204</duration>
<voice>1</voice>
<type>eighth</type>
- <beam number="1">begin</beam>
</note>
<note>
<pitch>
<duration>204</duration>
<voice>1</voice>
<type>eighth</type>
- <beam number="1">end</beam>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
needed_additional_definitions = []
additional_definitions = {
+
"snappizzicato": """#(define-markup-command (snappizzicato layout props) ()
(interpret-markup layout props
(markup #:stencil
(list 'draw-line 0.1 0 0.1 0 1)
'(-0.1 . 0.1) '(0.1 . 1)))
0.7 X))))""",
+
"eyeglasses": """eyeglassesps = #"0.15 setlinewidth
-0.9 0 translate
1.1 1.1 scale
3.30 2.00 lineto
3.42 2.26 3.80 2.40 3.65 1.70 curveto
stroke"
-eyeglasses = \markup { \with-dimensions #'(0 . 4.4) #'(0 . 2.5) \postscript #eyeglassesps }"""
+eyeglasses = \markup { \with-dimensions #'(0 . 4.4) #'(0 . 2.5) \postscript #eyeglassesps }""",
+
+ "tuplet-note-wrapper": """ % a formatter function, which is simply a wrapper around an existing
+ % tuplet formatter function. It takes the value returned by the given
+ % function and appends a note of given length.
+ #(define-public ((tuplet-number::append-note-wrapper function note) grob)
+ (let* ((txt (if function (function grob) #f)))
+ (if txt
+ (markup txt #:fontsize -5 #:note note UP)
+ (markup #:fontsize -5 #:note note UP)
+ )
+ )
+ )""",
+
}
def round_to_two_digits (val):
# TODO: Implement repeats until the end without explicit ending bar
return music_list
+def musicxml_tuplet_to_lily (tuplet_elt, fraction):
+ tsm = musicexp.TimeScaledMusic ()
+ tsm.numerator = fraction[0]
+ tsm.denominator = fraction[1]
+
+ if hasattr (tuplet_elt, 'bracket') and tuplet_elt.bracket == "no":
+ tsm.display_bracket = None
+ elif hasattr (tuplet_elt, 'line-shape') and getattr (tuplet_elt, 'line-shape') == "curved":
+ tsm.display_bracket = "curved"
+ else:
+ tsm.display_bracket = "bracket"
+
+ display_values = {"none": None, "actual": "actual", "both": "both"}
+ if hasattr (tuplet_elt, "show-number"):
+ tsm.display_number = display_values.get (getattr (tuplet_elt, "show-number"), "actual")
+ if getattr (tuplet_elt, "show-number") == "both":
+ needed_additional_definitions.append ("tuplet-note-wrapper")
+ if hasattr (tuplet_elt, "show-type"):
+ tsm.display_type = display_values.get (getattr (tuplet_elt, "show-type"), None)
+
+ # TODO: Handle non-standard display (extract the type from the tuplet-actual
+ # and tuplet-normal children
+ # TODO: We need the type from the time-modification tag!
+ return tsm
def group_tuplets (music_list, events):
if hasattr (tuplet_elt, 'number'):
nr = getattr (tuplet_elt, 'number')
if tuplet_elt.type == 'start':
- tuplet_info = [j, None, fraction]
+ tuplet_object = musicxml_tuplet_to_lily (tuplet_elt, fraction)
+ tuplet_info = [j, None, tuplet_object]
indices.append (tuplet_info)
brackets[nr] = tuplet_info
elif tuplet_elt.type == 'stop':
bracket_info = brackets.get (nr, None)
if bracket_info:
- bracket_info[1] = j
+ bracket_info[1] = j # Set the ending position to j
del brackets[nr]
new_list = []
last = 0
- for (i1, i2, frac) in indices:
+ for (i1, i2, tsm) in indices:
if i1 > i2:
continue
last = i2 + 1
seq.elements = music_list[i1:last]
- tsm = musicexp.TimeScaledMusic ()
tsm.element = seq
- tsm.numerator = frac[0]
- tsm.denominator = frac[1]
-
new_list.append (tsm)
new_list.extend (music_list[last:])
for notations in notations_children:
for tuplet_event in notations.get_tuplets():
mod = n.get_maybe_exist_typed_child (musicxml.Time_modification)
+ # TODO: Extract the type of note (for possible display later on!)
frac = (1,1)
if mod:
frac = mod.get_fraction ()