From d5237b2e71848215116647a537681d41865326fe Mon Sep 17 00:00:00 2001 From: PhotonicVelocity Date: Wed, 28 Jan 2026 15:04:33 -0800 Subject: [PATCH] Add read-only clip properties --- README.md | 6 ++++++ abletonosc/clip.py | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 083bb8d..6cf500a 100644 --- a/README.md +++ b/README.md @@ -374,11 +374,16 @@ Represents an audio or MIDI clip. Can be used to start/stop clips, and query/mod | /live/clip/get/pitch_fine | track_id, clip_id | track_id, clip_id, cents | Get clip fine re-pitch | | /live/clip/set/pitch_fine | track_id, clip_id, cents | | Set clip fine re-pitch | | /live/clip/get/file_path | track_id, clip_id | track_id, clip_id, file_path | Get clip file path | +| /live/clip/get/available_warp_modes | track_id, clip_id | track_id, clip_id, warp_mode, ... | Get available warp modes | +| /live/clip/get/has_envelopes | track_id, clip_id | track_id, clip_id, has_envelopes | Query whether clip has envelopes | +| /live/clip/get/is_arrangement_clip | track_id, clip_id | track_id, clip_id, is_arrangement_clip | Query whether clip is in arrangement view | | /live/clip/get/is_audio_clip | track_id, clip_id | track_id, clip_id, is_audio_clip | Query whether clip is audio | | /live/clip/get/is_midi_clip | track_id, clip_id | track_id, clip_id, is_midi_clip | Query whether clip is MIDI | | /live/clip/get/is_playing | track_id, clip_id | track_id, clip_id, is_playing | Query whether clip is playing | | /live/clip/get/is_overdubbing | track_id, clip_id | track_id, clip_id, is_overdubbing | Query whether clip is overdubbing | | /live/clip/get/is_recording | track_id, clip_id | track_id, clip_id, is_recording | Query whether clip is recording | +| /live/clip/get/is_session_clip | track_id, clip_id | track_id, clip_id, is_session_clip | Query whether clip is in session view | +| /live/clip/get/is_take_lane_clip | track_id, clip_id | track_id, clip_id, is_take_lane_clip | Query whether clip is a take lane clip | | /live/clip/get/will_record_on_start | track_id, clip_id | track_id, clip_id, will_record_on_start | Query whether clip will record on start | | /live/clip/get/playing_position | track_id, clip_id | track_id, clip_id, playing_position | Get clip's playing position | | /live/clip/start_listen/playing_position | track_id, clip_id | | Start listening for clip's playing position. Replies are sent to /live/clip/get/playing_position, with args: track_id, clip_id, playing_position | @@ -389,6 +394,7 @@ Represents an audio or MIDI clip. Can be used to start/stop clips, and query/mod | /live/clip/set/loop_end | track_id, clip_id, loop_end | | Set clip's loop end | | /live/clip/get/warping | track_id, clip_id | track_id, clip_id, warping | Get clip's warp mode | | /live/clip/set/warping | track_id, clip_id, warping | | Set clip's warp mode | +| /live/clip/get/sample_rate | track_id, clip_id | track_id, clip_id, sample_rate | Get clip sample rate | | /live/clip/get/launch_mode | track_id, clip_id | track_id, clip_id, launch_mode | Get clip's launch mode (0=Trigger, 1=Gate, 2=Toggle, 3=Repeat) | | /live/clip/set/launch_mode | track_id, clip_id, launch_mode | | Set clip's launch mode (0=Trigger, 1=Gate, 2=Toggle, 3=Repeat) | | /live/clip/get/launch_quantization | track_id, clip_id | track_id, clip_id, launch_quantization | Get clip's launch Quantization Value (0=Global, 1=None, 2=8Bars, 3=4Bars, 4=2Bars, 5=1Bar, 6=1/2, 7=1/2T, 8=1/4, 9=1/4T, 10=1/8, 11=1/8T, 12=1/16, 13=1/16T, 14=1/32) | diff --git a/abletonosc/clip.py b/abletonosc/clip.py index ce29fa0..21a21f5 100644 --- a/abletonosc/clip.py +++ b/abletonosc/clip.py @@ -73,23 +73,27 @@ def clip_callback(params: Tuple[Any]) -> Tuple: "end_time", "file_path", "gain_display_string", + "has_envelopes", "has_groove", + "is_arrangement_clip", "is_midi_clip", "is_audio_clip", "is_overdubbing", "is_playing", "is_recording", + "is_session_clip", + "is_take_lane_clip", "is_triggered", "length", "playing_position", "sample_length", + "sample_rate", "start_time", "will_record_on_start" ## TODO list: - ##"groove", ## if other than None, says "Error handling OSC message: Infered arg_value type is not supported" - ## is_arrangement_clip - ##"warp_markers", ## "Infered arg_value type is not supported" - ##"view", ##"Infered arg_value type is not supported" + ## - "groove"; returns Groove object; needs custom serialization / API + ## - "warp_markers"; returns list of dicts; needs custom serialization + ## - "view"; returns ClipView object; needs custom serialization / API ] properties_rw = [ "color", @@ -167,6 +171,12 @@ def clip_remove_notes(clip, params: Tuple[Any] = ()): self.osc_server.add_handler("/live/clip/add/notes", create_clip_callback(clip_add_notes)) self.osc_server.add_handler("/live/clip/remove/notes", create_clip_callback(clip_remove_notes)) + def clip_get_available_warp_modes(clip, _): + return tuple(int(mode) for mode in clip.available_warp_modes) + + self.osc_server.add_handler("/live/clip/get/available_warp_modes", + create_clip_callback(clip_get_available_warp_modes)) + def clips_filter_handler(params: Tuple): # TODO: Pre-cache clip notes if len(self._clip_notes_cache) == 0: