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