|
|
@ -641,6 +641,15 @@ class DurationGroup(object): |
|
|
|
def genericNumber(self): |
|
|
|
return duration.baseDurationToTraditionalNumber[self.baseDuration] |
|
|
|
|
|
|
|
@property |
|
|
|
def tuplet(self): |
|
|
|
"""Return the tuplet of the shortest duration. |
|
|
|
Does *not* use self.hasTuplet() because that returns if any |
|
|
|
note has tuplet. We just want the logical shortest duration, |
|
|
|
not even the actual absolute shortes duration. |
|
|
|
In other words: the smallest notehead, does that have a tuplet?""" |
|
|
|
return self.minimumNote.duration.tuplet |
|
|
|
|
|
|
|
|
|
|
|
############################################## |
|
|
|
## Items ## |
|
|
@ -1738,13 +1747,13 @@ class Chord(Item): |
|
|
|
onlyOneDuration = durations.count(durations[0]) == len(durations) |
|
|
|
|
|
|
|
if onlyOneDuration: |
|
|
|
pre = _createLilypondTuplet(self.notelist[0].duration, carryLilypondRanges) |
|
|
|
tupletSubstring = _createLilypondTuplet(self.notelist[0].duration, carryLilypondRanges) |
|
|
|
if len(pitches) == 1: |
|
|
|
# The most common case: Just a single note |
|
|
|
return pre + pitches[0] + durations[0] #this is a string. |
|
|
|
return tupletSubstring + pitches[0] + durations[0] #this is a string. |
|
|
|
else: |
|
|
|
# A simple chord with mulitple pitches but just one duration |
|
|
|
return pre + "<" + " ".join(pitches) + ">" + durations[0] |
|
|
|
return tupletSubstring + "<" + " ".join(pitches) + ">" + durations[0] |
|
|
|
else: |
|
|
|
#TODO: Cache this |
|
|
|
|
|
|
@ -1772,7 +1781,9 @@ class Chord(Item): |
|
|
|
lilydur = lilydur[:-1] #without ~ #TODO: not supported yet. |
|
|
|
dur = lilydur + " * {}/{}".format(int(minimumTicksInChord), int(ticks)) #lilypond requires the x/y syntax, even if it is 1/y #TODO: this is very ugly |
|
|
|
substrings.append("\\\\ { <" + " ".join(lst) + ">" + dur + " }" ) |
|
|
|
result = "<<" + " ".join(substrings) + ">>" |
|
|
|
|
|
|
|
tupletSubstring = _createLilypondTuplet(self.durationGroup, carryLilypondRanges) |
|
|
|
result = tupletSubstring + "<<" + " ".join(substrings) + ">>" |
|
|
|
return result |
|
|
|
|
|
|
|
class Rest(Item): |
|
|
|