mutwo.timeline_converters

Convert mutwo.timeline_interfaces.TimeLine to objects useable by other parts of mutwo.

Object

Documentation

mutwo.timeline_converters.TimeLineToEventPlacementDict

mutwo.timeline_converters.TimeLineToConcurrence

Create event with Concurrence for each tag.

mutwo.timeline_converters.TimeLineToEventPlacementTuple

Fetch from TimeLine all EventPlacement which contains of user defined tags.

mutwo.timeline_converters.EventPlacementTupleToGaplessEventPlacementTuple

Fill empty EventPlacement into the gaps between two EventPlacement.

mutwo.timeline_converters.EventPlacementTupleToSplitEventPlacementDict

Split EventPlacement into new `EventPlacement`s by tags.

class TimeLineToEventPlacementDict[source]

Bases: Converter

Public Methods:

convert(timeline_to_convert)

Inherited from Converter

convert(...)

Inherited from MutwoObject

copy()

Return a deep copy of mutwo object.


convert(timeline_to_convert)[source]
Parameters:

timeline_to_convert (TimeLine) –

Return type:

dict[‘str’, tuple[mutwo.timeline_interfaces.timelines.EventPlacement, …]]

class TimeLineToConcurrence(random_seed=100)[source]

Bases: Converter

Create event with Concurrence for each tag.

Parameters:

random_seed (int) – Seed for random operation in case start_or_start_range or end_or_end_range of an mutwo.timeline_interfaces.EventPlacement is a ranges.Range and TimeLineToConcurrence needs to pick a value within the given range.

The main intention of this converter is to convert a TimeLine into a representation which is useable for concrete third party converters like mutwo.midi_converters.EventToMidiFile.

To be successful the tagged events in the mutwo.timeline_interfaces.EventPlacement in the mutwo.timeline_interfaces.TimeLine which is converted need a specific structure: the deepest nested structure they can follow is:

core_events.Concurrence[
core_events.Consecution[

core_events.Chronon

]

]

Because this will be the final structure. This clean ordering is necessary to be functional with various third party converters as e.g. mutwo.midi_converters.EventToMidiFile.

Public Methods:

convert(timeline_to_convert)

Inherited from Converter

convert(...)

Inherited from MutwoObject

copy()

Return a deep copy of mutwo object.


convert(timeline_to_convert)[source]
Parameters:

timeline_to_convert (TimeLine) –

Return type:

Concurrence[Concurrence[Consecution[Chronon]]]

class TimeLineToEventPlacementTuple[source]

Bases: Converter

Fetch from TimeLine all EventPlacement which contains of user defined tags.

Unlike TimeLineToEventPlacementDict this converter doesn’t split the fetched mutwo.timeline_interfaces.EventPlacement`s into different `tuples, but returns all of them in one common tuple.

Public Methods:

convert(timeline_to_convert, tag_tuple)

Inherited from Converter

convert(...)

Inherited from MutwoObject

copy()

Return a deep copy of mutwo object.


convert(timeline_to_convert, tag_tuple)[source]
Parameters:
  • timeline_to_convert (TimeLine) –

  • tag_tuple (tuple['str', ...]) –

Return type:

tuple[mutwo.timeline_interfaces.timelines.EventPlacement, …]

class EventPlacementTupleToGaplessEventPlacementTuple[source]

Bases: Converter

Fill empty EventPlacement into the gaps between two EventPlacement.

Public Methods:

convert(event_placement_tuple_to_convert[, ...])

Inherited from Converter

convert(...)

Inherited from MutwoObject

copy()

Return a deep copy of mutwo object.


convert(event_placement_tuple_to_convert, duration=None)[source]
Parameters:
Return type:

tuple[mutwo.timeline_interfaces.timelines.EventPlacement, …]

class EventPlacementTupleToSplitEventPlacementDict[source]

Bases: Converter

Split EventPlacement into new `EventPlacement`s by tags.

So the returned event attribute of each returned mutwo.timeline_interfaces.EventPlacement only contains one specific tagged event.

Public Methods:

convert(event_placement_tuple_to_convert)

Inherited from Converter

convert(...)

Inherited from MutwoObject

copy()

Return a deep copy of mutwo object.


convert(event_placement_tuple_to_convert)[source]
Parameters:

event_placement_tuple_to_convert (tuple[mutwo.timeline_interfaces.timelines.EventPlacement, ...]) –

Return type:

dict[‘str’, tuple[mutwo.timeline_interfaces.timelines.EventPlacement, …]]