Skip to content

Commit

Permalink
parameters/abc/Duration.from_any += parse tuple/list to FlexTempo
Browse files Browse the repository at this point in the history
With this patch we can now parse lists or tuples to a 'FlexTempo'.
This means the following works now:

> from mutwo import core_events
> chn = core_events.Chronon(4)
> chn.tempo = [[0, 30], [4, 60]]
  • Loading branch information
levinericzimmermann committed Apr 8, 2024
1 parent 4dab052 commit d9697a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mutwo/core_parameters/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,7 @@ def from_any(cls: typing.Type[T], object: Tempo.Type) -> T:
return object
case float() | int() | fractions.Fraction() | builtin_fraction():
return core_parameters.DirectTempo(object)
case list() | tuple():
return core_parameters.FlexTempo(object)
case _:
raise core_utilities.CannotParseError(object, cls)

0 comments on commit d9697a0

Please sign in to comment.