getting the color of a track in m4l api. is it possible ??????
Jun 24 2011 | 11:17 am
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 | 11:52 am
- Jun 24 2011 | 3:00 pmI'm afraid you mean the clips of a track in arrangement view. We have no access to them.
- Jun 24 2011 | 4:25 pmAlthough 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.
- Jun 24 2011 | 5:50 pmBen with this configuration only 2 colors for a track.i think that get the color of a track is not useful
- Jun 24 2011 | 6:00 pmNot sure what you mean. You can refer to the clip color property for how it works.All the best, -Ben
- Jun 24 2011 | 6:16 pmif we run your patch we only set the track in 2 colors
- Jun 28 2011 | 4:15 pmAs 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:
- Sep 25 2011 | 7:57 pmNice solution Ben Bracken, but I would like to know the expression for the opposite conversion. Could you share please?Thanks
- Sep 25 2011 | 8:04 pmJust 'get' the property just like you'd get any other property.Edit: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 | 11:29 pmHey, 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 + 3x16 + 4*256 + 5*4096 + 3*65536 = 2 + 48 + 1024 + 20480 + 196608 = 218162Do I have to do the whole calculation in Max, or is there a better method??
- Sep 26 2011 | 3:22 amCheck 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 | 11:10 amHere is Ben's solution complemented with the opposite conversion.
- Sep 27 2011 | 9:06 pmAwesome, thanks for the suggestion!
- Jan 12 2021 | 4:39 pmOld topic, sorry for the resurrection. Is it possible to monitor the tracks color change in realtime? I mean, if I change it, can I get the new colour without sending a bang?
- Jan 13 2021 | 9:08 pmYes, color is an observable property of tracks.