Now let's attack the Push directly from Max (rather than through Live and the LiveAPI):
Here's the file: Media:PushPix.zip
Fun, right? Also, pretty useless in this state - but it should open some doors for you to be able to use the button matrix as a interesting display element.
The main patch is pretty basic Jitter image-handling: we use the jit.grab object to get our webcam image, then turn it into an 8x8 matrix by allowing the jit.matrix to auto-interpolate the values. 8x8 is, of course, the dimensions of our Push button matrix.
All of the really cool stuff, however, is happening within the "matrix-to-push-buttons" subpatcher.
This subpatcher is all about formatting the image pixel values to the sysex values needed by the Push.
In this patch, we gather up all of the data about each pixel, then format it using a set of pack objects. The first pack object gives us the necessary sysex header:
0xF0 - MIDI System Exclusive message start 0x47 - Manufacturers ID 0x7F - System Exclusive Device ID 0x15 - Product model ID 0x04 - Message type identifier (RGB Light Display) 0x00 - Number of data bytes to follow (most significant) 0x08 - Number of data bytes to follow (least significant) <LED Number> - LED index... <Transition Type> - Transition Type Value
The only things we need to change is the LED Number and the "Transition Type", which I've not really been able to grok (although leaving it at 0 seems to work fine).
The second pack object collects up all of the RGB values, split up into 4-byte nibbles. I take advantage of Max's bit manipulation values to get everything in order. The last byte has to be an "0xF7", telling the system that the message is complete.
You'll notice that I've listed the sysex info in hexidecimal numbers, but the patch shows them in decimal. Do you have to do all that conversion? Not at all - in fact, if you enter "pack 0xF0", the numbers are auto-converted into decimal when you click off the object. Auto-conversion? Cool!
I hope that you enjoy this fun little patch, and find an interesting use when putting together your own high-color Push interface!