Following on from my TouchOSC screen interface to Sonic Pi which featured a Push2 like layout, I decided to try interfacing a real Ableton Push2 device to Sonic Pi. Unliked the TouchOSC project, this only uses midi messages to control and be controlled by Push2. Ableton publish a document
giving details of how you can interact with the various leds in the Push2, and I have utilised this information to build a program in Sonic Pi, which creates a polyphonic player which gets its input from the 64 key matrix on the Push 2. Some of the Push2 buttons are also used to select synths, keys, and other features discussed in the video. All of the leds are controlled entirely by Sonic Pi.
The program was quite intersting to develop. I wanted to emulate the same keyboard layout as used with Live 10 and Push2, and this meant mapping the keyboard layout which goes linearly from midi 36 up to midi 99 so that it gave a scale along the bottom row, which is shifted three notes to the right on each successive row as you move upwards. I also had to decode column and row for each key to make it easy to add the helper keys shwon in green when a key is pressed, which give the same sounding note. I utilised code I had used previously to control a “long” note in Sonic Pi, switching it on when a key is pressed, and then killing the note when the key is released, thus giving variable length notes.
Midi_cc messages can be used to control the leds (many of which are rgb leds), and then can alos be controlled by midi note_on messages. I used a mixture.
There is some documentation on using the display panel as well, but this is more complex, but I hope to explore this too at a later date, but I expect that it will need a helper app as well to use this.
I am continously impressed at just how versatile Sonic Pi is, in that it can tackle a project like this.