Collect Сlip IDs by Сolor

Just Evan's icon

Hi, I'm getting a list of clips in an arrangement_view and I need to collect the id of the clips that have a color ("16777215" (white color from the ableton palette)) excluding the clips with a different color.

Q: How can I check clips for color matching and save them to a list?

Source Audio's icon

I guess you would observe all clips for color, and store matching

into coll.

I am not using Live - don't ask me how to do that ....

this will give you idea about coll stuff

tyler mazaika's icon

FWIW you’d want to get the color_index property, not the color property. The color property changes when the theme brightness changes.

Just Evan's icon

Source Audio, thanks for the answer!

This does work, but I'm looking for a way to do it dynamically, meaning that if I change the color of a clip (to 16777215) it will automatically be collected, or deleted if I change its color to another color (not 16777215).

Max Patch
Copy patch and select New From Clipboard in Max.

Just Evan's icon

tyler mazaika, thanks for the tip!

TFL's icon

Since you want to observe all your clips, and your number of clips might change, you either want to

  • Have one [live.observer color] per clip (requiring to create/delete, send the corresponding id to each live.observer programmatically, using script messages to thispatcher, after regularly pooling the number of clips on the track). A bit tedious to program but more efficient as you can pool the list of clips not so often, like every 5 seconds

  • or just regularly pool the list of clips, then their color using live.objects. Much easier to do, but less efficient as you might need a faster pooling rate (like every 0.3 seconds) if you want your system to be reactive enough

Just Evan's icon

TFL, Can you tell me a little more about the first tip?

Do you mean dynamically creating new objects via [thispathcer] to observe each new clip (new clip == new observer for its id)?

TFL's icon

Yes, this is what I mean.
Here is an example, using script messages to create a bunch of objects (pairs of live.observer + prepend), connect them together, and sens them messages (send "id id**" to live.observer to tell it which clip to observe)
I made this in Max standalone, the ids are fake values, you'll need to the logic to the context of M4L.

You'll need to retrieve the list of all existing clips before triggering the bang, and re-do this anytime a clip is created or deleted (or maybe moved, as I don't know if moving a clip changes its id).

Max Patch
Copy patch and select New From Clipboard in Max.

Just Evan's icon

TFL, Thank you! I think this is a great starting point to figure this out. Appreciate your help!

Source Audio's icon

as first, to monitor change of color in a clip,

which I guess you do manually, try this.

It reports selected clip, and then color or color_index, or whatever else you want to know

about selected clip.

next thing is , if you need a bunch of observers,

search for poly~ solutions on the forum.