getting the color of a track in m4l api. is it possible ??????

Jun 24, 2011 at 11:17am

getting the color of a track in m4l api. is it possible ??????


i am trying to get the color of a track in ableton live, using the live api in m4l.
Can it be done? (no possibility found in the docs).
I know i can access the color of a clip, but of the track? should be simple….

thank you !

Jun 24, 2011 at 11:52am

do you mean track or clip?

you can read and it from the clip:

Reference pages are friends not enemies … ;)

Jun 24, 2011 at 3:00pm

I’m afraid you mean the clips of a track in arrangement view. We have no access to them.

Jun 24, 2011 at 4:25pm

Although it is missing from the docs, track ‘color’ is a gettable/settable property. I’ll try to make sure that it gets in the next update.

– Pasted Max Patch, click to expand. –
Jun 24, 2011 at 5:50pm

Ben with this configuration only 2 colors for a track.

i think that get the color of a track is not useful

Jun 24, 2011 at 6:00pm

Not sure what you mean. You can refer to the clip color property for how it works.

All the best,

Jun 24, 2011 at 6:16pm

if we run your patch we only set the track in 2 colors

Jun 28, 2011 at 4:15pm

As outlined in the clip color ref entry, the RGB value of the color is in the form 0x00rrggbb or (2^16 * red) + (2^8) * green + blue, where red, green and blue are values from 0 (dark) to 255 (light).

Here is an example that does the conversion for you from rgb:

– Pasted Max Patch, click to expand. –
Sep 25, 2011 at 7:57pm

Nice solution Ben Bracken, but I would like to know the expression for the opposite conversion. Could you share please?


Sep 25, 2011 at 8:04pm

Just ‘get’ the property just like you’d get any other property.


Ah; I think I understand what you meant; going from the big int value back to the rgb notation ?

Well, the ref page mentioned above should make that obvious IMO… Simply convert the int value to a hex value and split it apart; you’ll end up with rr gg bb.

Sep 25, 2011 at 11:29pm

Hey, thanks for the reply. I tried your method by using the number box with the hex selection. However I am facing a problem: When I want to convert i.e. the red value in hex is FF0000 and if you split it you get FF=255, 00=0, 00=0. But when you set to blue, which is 00FF00, the first digits are discarded from the number box. This leaves me one option to do the whole hex conversion which is the following:

i.e. number 35432 in hex to dec:

2x(16^0) + 3x(16^1) + 4x(16^2) + 5x(16^3) + 3x(16^4) =
2 + 3×16 + 4*256 + 5*4096 + 3*65536 =
2 + 48 + 1024 + 20480 + 196608 =

Do I have to do the whole calculation in Max, or is there a better method??

Sep 26, 2011 at 3:22am

Check the original refpage again.

Its not ff0000, its 00ff0000. As in 0x00rrggbb.

Edit: I also wonder if you didn’t mix up hex -> dec with dec -> hex, but at this time I’m not going to check myself to be sure.

Sep 26, 2011 at 11:10am

Here is Ben’s solution complemented with the opposite conversion.

– Pasted Max Patch, click to expand. –
Sep 27, 2011 at 9:06pm

Awesome, thanks for the suggestion!


You must be logged in to reply to this topic.