AbletonClipMonitor
- class pylive_played_clip.AbletonClipMonitor(dim_color: str | None = None, dim_ratio: float = 2.0, polling_delay: float = 0.1, no_reset: bool = False)
This class is used to manage the variables for monitoring Ableton.
Class Properties
dim_color: Optional[str] - The color to dim to
dim_ratio: float - The ratio to dim to.
polling_delay: float - The delay between scans of the live set tracks.
polling_delay: float - The delay between scans of the live set tracks.
ableton: live.Set - The pylive Set object
num_of_tracks: int - The number of tracks in the live set.
original_cell_color: typing.Dict - A dictionary tracking the original color in the cells that have been changed.
dim_clip_on_track: typing.Dict - When a track starts to play, we make a record in this dictionary. When it is no longer playing, we know it is time to dim the clip.
- __init__(dim_color: str | None = None, dim_ratio: float = 2.0, polling_delay: float = 0.1, no_reset: bool = False) None
- Parameters:
dim_color (Optional[str]) – The color, in hex such as FFFFFF, to dim to.
dim_ratio (int) – The ratio to dim the color by. Should be greater or equal to 1. The RGB color will be converted to HSB, the brightness divided by this ratio, then converted back to RGB.
polling_delay (float) – The number of seconds between queries to Ableton
no_reset (bool) – If set to true, ableton will not be reset when it stops playing.
- Returns:
An instance of the AbletonClipMonitor object.
- Return type:
AbletonClipMonitor
- capture_playing_clip_info(track_index: int, playing_clip_index: int) None
Records the information of the currently playing clip.
- dim_color_of_played_clip(track_index: int) None
Records the information of the currently playing clip.
- Parameters:
track_index (int) – The index of the live set track to query.
- Returns:
Nothing
- Return type:
None
- dim_ratio_is_valid(dim_ratio: float) bool
Tests if the dim_ratio value is valid. :param dim_ratio: The dim color a a six character hex web color. :type dim_ratio: float
- Returns:
A boolean indicating if the passed in dim_ratio is valid.
- Return type:
- get_dimmed_color_int_from_ratio(track_index) int
Get the color we should dim to based on the recorded clip color and the dim_ratio.
- Parameters:
track_index (int) – The index of the live set track to query.
- Returns:
Nothing
- Return type:
None
- get_number_of_tracks() int
Queries Ableton to get the number of tracks in the open set.
- Returns:
The number of tracks in the live set.
- Type:
- restore_clip_colors() None
Restores the clips to their original colors.
- Returns:
Nothing
- Return type:
None
- scan_track(track_index: int) None
Scans a single tracks for clips that have started to play or stopped and need to be dimmed.
- Parameters:
track_index (int) – The index of the live set track to query.
- Returns:
Nothing
- Return type:
None
- scan_tracks() None
Scans all of the tracks for clips that have started to play or stopped and need to be dimmed.
- Returns:
Nothing
- Return type:
None