mutwo.reaper_converters¶
Convert mutwo data to data readable by the Reaper DAW.
Object |
Documentation |
---|---|
Make Reaper Marker entries. |
|
Convert |
|
Convert |
- class EventToReaperMarkerString(chronon_to_marker_name=ChrononToMarkerName(), chronon_to_marker_color=ChrononToMarkerColor())[source]¶
Bases:
EventConverter
Make Reaper Marker entries.
- Parameters:
chronon_to_marker_name (Callable[[core_events.Chronon], str]) – A function which converts a
Chronon
to the marker name. If the function returnsNone
mutwo will ignore` the current event. By default chronon_to_marker_name is set toChrononToMarkerName
.chronon_to_marker_color (Callable[[core_events.Chronon], str]) – A function which converts a
Chronon
to the marker color. If the function returnsNone
mutwo will ignore` the current event. By default chronon_to_marker_name is set toChrononToMarkerColor
.
The resulting string can be copied into the respective reaper project file one line before the ‘<PROJBAY’ tag.
Example:
>>> from mutwo import reaper_converters >>> from mutwo import core_events >>> marker_converter = reaper_converters.EventToReaperMarkerString() >>> events = core_events.Consecution([core_events.Chronon(2), core_events.Chronon(3)]) >>> events[0].name = 'beginning' >>> events[0].color = r'0 16797088 1 B {A4376701-5AA5-246B-900B-28ABC969123A}' >>> events[1].name = 'center' >>> events[1].color = r'0 18849803 1 B {E4DD7D23-98F4-CA97-8587-F4259A9498F7}' >>> print(marker_converter.convert(events)) MARKER 0 0.0 beginning 0 16797088 1 B {A4376701-5AA5-246B-900B-28ABC969123A} MARKER 1 2.0 center 0 18849803 1 B {E4DD7D23-98F4-CA97-8587-F4259A9498F7}
Public Methods:
convert
(event_to_convert)Convert event to reaper markers (as plain string).
Inherited from
MutwoObject
copy
()Return a deep copy of mutwo object.
- convert(event_to_convert)[source]¶
Convert event to reaper markers (as plain string).
- Parameters:
event_to_convert (events.abc.Event) – The event which shall be converted to reaper marker entries.
- Returns:
The reaper marker entries as plain strings. Copy them to your reaper project file one line before the ‘<PROJBAY’ tag and the next time when you open the project they will appear.
- Return type:
str
- Return type:
str
- class ChrononToMarkerName(attribute_name=None, exception_value=None)[source]¶
Bases:
ChrononToAttribute
Convert
Chronon
to a name of a marker.By default mutwo will fetch from an event the
DEFAULT_MARKER_NAME_ATTRIBUTE_NAME
. If no attribute with attribute_name can be found the converter will simply returnNone
.Public Methods:
Inherited from
ChrononToAttribute
convert
(chronon_to_convert)Extract from a
mutwo.core_events.Chronon
an attribute.Inherited from
MutwoObject
copy
()Return a deep copy of mutwo object.
- Parameters:
attribute_name (Optional[str]) –
- class ChrononToMarkerColor(attribute_name=None, exception_value=None)[source]¶
Bases:
ChrononToAttribute
Convert
Chronon
to the color of a marker.By default mutwo will fetch from an event the
DEFAULT_MARKER_COLOR_ATTRIBUTE_NAME
. If no attribute with attribute_name can be found the converter will simply returnNone
.Public Methods:
Inherited from
ChrononToAttribute
convert
(chronon_to_convert)Extract from a
mutwo.core_events.Chronon
an attribute.Inherited from
MutwoObject
copy
()Return a deep copy of mutwo object.
- Parameters:
attribute_name (Optional[str]) –
mutwo.reaper_converters.configurations¶
- DEFAULT_MARKER_COLOR_ATTRIBUTE_NAME = 'color'¶
The default attribute name
ChrononToMarkerColor
is searching for.
- DEFAULT_MARKER_NAME_ATTRIBUTE_NAME = 'name'¶
The default attribute name
ChrononToMarkerName
is searching for.