Added total_duration and total_beats
This commit is contained in:
@ -126,6 +126,14 @@ class Ziffers(Sequence):
|
||||
if isinstance(val, Event)
|
||||
]
|
||||
|
||||
def total_duration(self) -> float:
|
||||
"""Return total duration"""
|
||||
return sum([val.duration for val in self.evaluated_values if isinstance(val, Event)])
|
||||
|
||||
def total_beats(self) -> float:
|
||||
"""Return total beats"""
|
||||
return sum(self.beats())
|
||||
|
||||
def beats(self) -> list[float]:
|
||||
"""Return list of pitch durations as floats"""
|
||||
return [
|
||||
|
||||
@ -334,6 +334,7 @@ class Subdivision(Sequence):
|
||||
if isinstance(item, Event):
|
||||
if duration is not None:
|
||||
item.duration = new_d
|
||||
item.beat = new_d*4
|
||||
yield item
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user