Ableton / push-interface

The Ableton Push 2 MIDI and display interface manual.
644 stars 74 forks source link

How to translate Max For Live colors to Palette Color Index ? #22

Open peeddrroo opened 5 years ago

peeddrroo commented 5 years ago

Hi

From what I understood, it is not possible to send direct RGB values to Push LEDs. It's a shame, it would be very useful. Anyway, I am trying to send colors I retrieve from M4L objects to Push LEDs. It's pretty cumbersome : I have to translate the 0x00rrggbb values into RGB, then calculate the Euclidian distance to each of the Index Color Palettes entries and find the lowest, then get the corresponding Index. And it's not even accurate. I guess it's done more easily inside the software. Is there a way to achieve this "easiest way" inside M4L ?

brunchboy commented 5 years ago

There are enough palette entries to use one for each button, so my approach has been to set a color palette entry to the exact color I need and use it.

peeddrroo commented 5 years ago

Thanks, that's interesting, I'm going to investigate this. I am trying to build a device that lights up buttons depending on the color of certain objects in Live. So I need to get all possible colors (independently from the Color Intensity and Color Hue set in the Preferences). I'm not sure your method will apply, I've got to figure it out.

brunchboy commented 5 years ago

That’s what I needed as well, my lighting control software wants to be able to set any button to any hue, saturation, and value, so I convert those to RGB values, set the appropriate palette entry, and then send the corresponding note to the button. It gives me the ability to use all RGB values on all buttons. The (Clojure) source code of my Push and Push 2 controller implementations can be found here: https://github.com/Deep-Symmetry/afterglow/tree/master/src/afterglow/controllers

peeddrroo commented 5 years ago

Hey Many thanks for your answers. I managed to get the buttons with the right RGB color using sysex and Color Index entries ! That's a huge step forward. However, there's once thing I don't get : when you say that there's enough entries for each button, you mean 0-127, right ? There's no way to use entries above 127 ? The problem I have is that the color indexes I use for each button are going to conflict with Live's colors. For instance : Color Index 127 defaults to Red (255, 0, 0), and lights up the Record button accordingly. If I use color index 127 to temporarily light up a pad with Green (0, 255, 0), the Record button is going to turn green... how can I avoid that ?

brunchboy commented 5 years ago

I’m afraid I don’t quite understand your question, are you trying to use buttons at the same time as Live is? I don’t, I only use them when the Push is in User mode. I start by querying and saving all the existing palette values into a table in my code, then start using them for my own purposes. When the user switches back to Live mode, I restore all the palettes to the values they previously had, so they work properly for Live. See the gather-led-palettes and restore-led-palettes functions in my Push 2 controller implementation: https://github.com/Deep-Symmetry/afterglow/blob/master/src/afterglow/controllers/ableton_push_2.clj#L183-L220

rsu-ableton commented 5 years ago

peedroo wrote:

I am trying to build a device that lights up buttons depending on the color of certain objects in Live.

There is a certain fixed set of object colors in Live. This set changes from version to version, as does the color palette of Push2, because we are making improvements. For example, since Live 10, for the Live 10 standard display colors (e.g. for clips) as well as for UI element colors there are matched colors for the push2 display and pads/buttons. We are not publishing these relations as they might change anytime. Just as a hint, for Live 10 the Push2 palette entries 1..26 are bright standard colors, and the entries (65, 66), (67, 68) etc. are their less bright and even darker counterparts. The entries 27...64 correspond to certain functional colors in the UI.

rsu-ableton commented 5 years ago

@peeddrroo and @brunchboy I understand that there is a desire to directly control the RGB colors of Push2 pads and buttons. I can assure you the requirement is not forgotten. I'll therefore keep this issue open, although I can't comment on if and when such a function could be implemented and delivered with Live.

brunchboy commented 5 years ago

Thanks, @rsu-ableton that is actually rather surprising to hear. If a solution is ever available, it will be more important for people who have not already implemented an adequate workaround like mine, but that is the majority of developers out there of course. 😄