Getting clip info #89
-
Hi, First of all, thanks for your incredible work! I’m having a hard time figuring out where/how I can add event listeners to clips for a given song. Could you please point me to some documentation on how to access each name spaces’ observable traits? E.g. I see that if I want Song-View traits, I need to go through |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @jonathan3692bf, Observing a value on all clips isn't trivial since you need to manually add the event listener to each clip in your session. In arrangement view, a basic solution that just covers the first track might look like this: const tracks = await ableton.song.get("tracks");
const clips = await tracks[0].get("arrangement_clips");
for(const clip of clips) {
await clip.addListener("name", (name) => console.log("New name:", name))
} For session view, it would look like this: const tracks = await ableton.song.get("tracks");
const clipSlots = await tracks[0].get("clip_slots");
for (const clipSlot of clipSlots) {
const clip = await clipSlot.get("clip"); // might be null if the slot is empty
await clip?.addListener("name", (name) => console.log("New name:", name));
} This only adds listeners to the current clips though, so you'd have to add an event listener to the track for I hope this helps! |
Beta Was this translation helpful? Give feedback.
Hey @jonathan3692bf,
Observing a value on all clips isn't trivial since you need to manually add the event listener to each clip in your session. In arrangement view, a basic solution that just covers the first track might look like this:
For session view, it would look like this: