Push 2 color codes

patrickkidd's icon

It looks like they changed the button color codes from Push 1 to Push 2 when programming the grid. Does anyone have the new Push 2 button color codes?

Thanks!

Ricardo's icon

Belive you can find all you're looking for here:
https://github.com/Ableton/push-interface

Sébastien's icon

Hi PATRICKKIDD,
You can try this index I made. Works for me.
Have fun!

indexRGB.txt
txt
patrickkidd's icon

Man, those are both great resources.

Sebastien: I suppose it would be possible to manually re-map your RGB set to something with more functional meaning. For example, if one wanted to pulse opaque green to transparent green then you would have to find all of the greens and set them in order.

Ricardo: Your contribution looks like a great map if you are using raw MIDI, although I'm not sure how to integrate this when using the control_surface API in M4L. For example I only grab the Button_Grid component on the control_surface object while leaving the rest of the components (displays, buttons) in their default Ableton-provided functions. Any thoughts? Maybe it's possible to send the midi control data to push while the control_surface object is grabbed?

Sébastien's icon

Hi PATRICKKIDD,
Good idea! Keep me posted on that.

As for Raw Midi I also wonder how this could be implemented inside a M4l. Since sysexin object ports are blocked and that imp.sysexin port only works if Push2 is already turned on before I drop a M4L in a track. See topics below.

hollyhook's icon

A picture of the colors push 1 and 2: https://twitter.com/holllyhook/status/711673027138875393

The pad in the left top corner has color code 0 (off), color code 63 is bottom right.

patrickkidd's icon

I am getting the message that there isn't really any rhyme or reason with the ordering of the codes. So I guess that doing things like opacity fades isn't really possible with the control_surface API in M4L.

woyteg's icon

HI!
I recently made a patch that queries all color codes via sysex, and saves them in a txt.
Then I made another patch that accepts a color as input and picks the closest color from this list (via euclidean distance). It needs thomas grills python external for the distance thing and the file location is hardcoded in the python script. I don't have any time to make this useable for everybody, but I can post everything "as is" if anybody is interested..

patrickkidd's icon

I would definitely appreciate that.

woyteg's icon
Max Patch
Copy patch and select New From Clipboard in Max.

getting push2's color palette (messy patch but working..)

woyteg's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Color picker patch. Python scrpt needed for this coming in next post.
(this forum is driving me crazy. Maybe I'm getting old but it used to be great, responsive, simple, now I'm struggling to upload a patch)

woyteg's icon

You need numpy for the script to run. (Wow, deactivating adblock plus makes the forum work. I hate that.)

woyteg's icon

sorry for the spam, uploading the script as file failed. Here you go. I know it's messy. no time..

# py/pyext - python script objects for PD and MaxMSP

# try:

    # import pushHelpers
# except:
#     print "ERROR: failed loading pushHelpers.midiHelpers"

try:
    import pyext
except:
    print "ERROR: This script must be loaded by the PD/Max pyext external"
try:
    import numpy as np
except:
    print "ERROR: failed loading numpy"
# try:
#     import itertools
# except:
#     print "ERROR: failed loading itertools"

class Example1(pyext._class):
    # number of inlets and outlets
    _inlets=1
    _outlets=2

    def __init__(self):
        return

    def list_1(self,*s):
        with open('/Users/macuserin/Documents/Max/Projects/pushTests/data/push2ColorPalette.txt') as f:
            myColl = f.read()

        lines = myColl.split('\n')

        target = s

        dists = []

        for line in lines:
            sp = line.split()
            try:
                color = [int(sp[1]), int(sp[2]), int(sp[3]), int(sp[4].replace(';', ''))]
                dist = self.getDistance(color, target)
                dists.append(dist)
                # print color
            except:
                pass

        absDists = abs(np.array(dists))
        mini = np.argmin(absDists)
        # print mini
        # print lines[mini]

        self._outlet(1,int(mini))
        return

    def getDistance(self, color1, color2):
        # import numpy as np
        a = np.array(color1)
        b = np.array(color2)
        dist = np.linalg.norm(a-b)
        return dist

# with open('../data/push2ColorPalette.txt') as f:
#     myColl = f.read()

# lines = myColl.split('\n')

# target = [10, 12, 50, 100]

# dists = []

# for line in lines:
#     sp = line.split()
#     try:
#         color = [int(sp[1]), int(sp[2]), int(sp[3]), int(sp[4].replace(';', ''))]
#         dist = getDistance(color, target)
#         dists.append(dist)
#         print color
#     except:
#         pass

# absDists = abs(np.array(dists))
# mini = np.argmin(absDists)
# print mini
# print lines[mini]