// title: Basic Ableton Push control with Modality // author: LFSaw // description: // Example on how to interface SuperCollider with Ableton Push via [Modality](http://modalityteam.github.io/) toolkit. (I only have the first version here, send me a second version and I'll make it compatible with that ;) ) // code: // create Mktl for the Push controller, it has two ports, the 2nd one is the "default" // make sure, ableton is not running (it grabs the device) // there is a specified class that simplifies use of LEDs, everything else is the same as in MKtl k = MPush('push'); // standard method k = MKtl('push', "ableton-push", multiIndex: 1); k.trace(true); // wiggle some pots / buttons k.trace(false); k.elAt(\pad, \8, \1); // symbols represent button names (typically starting at 1), integers are indices (starting at 0) // set an action to post aftertouch values k.elAt(\pad, \8, \1).action = {|el| el.value.postln; } // remove action k.elAt(\pad, \8, \1).action= nil; // on-action: k.elAt(\pad, \8, \1, \on).action = {|el| "on:\t%".format(el.value).postln } // off-action: k.elAt(\pad, \8, \1, \off).action = {|el| "off:\t%".format(el.value).postln } // set lights k.setPadLight(k.elAt(\pad, \8, \1, \on), \green); k.setBtLight(k.elementAt(\bt, 0, 0), \green); k.setBtLight(k.elementAt(\bt, 1, 0), \blue); k.setCtlLight(k.elementAt(\btCtl), blink: \slow); k.setCtlLight(k.elementAt(\btCtl), blink: \steady); // turn off all lights k.lightsOff // use for sounds: s.boot; s.latency = nil; q = (); // a dict; // let's use a pad q.pad = k.elAt(\pad, \8, \1); // this is the pad: k.setPadLight(q.pad.elAt(\on), \red, \half); ( Ndef(\myGendy).addSpec(\wiggle, [55, 220,'exp']); Ndef(\myGendy).addSpec(\ampScale, [0.01,0.03]); Ndef(\myGendy).addSpec(\durScale, [0.01,0.03]); Ndef(\myGendy).addSpec(\changespeed, [0.1,100, \exp]); Ndef(\myGendy, {|wiggle = 55, ampScale = 0.03, durScale = 0.1, changespeed = 1| // Pan2.ar(Gendy3.ar(1,2,ad,0.07,wiggle,ampScale,0.1, ), Gendy1.ar(2, minfreq: 0.1, maxfreq: 100)) Splay.ar(Gendy3.ar(3,5,1.0,1.0, ( Array.fill(5,{ LFNoise0.kr(Rand(0, 1.3) * changespeed,1,2) }) * wiggle ), ampscale: ampScale, durscale: durScale, initCPs: 5, mul:0.1 ))}) ) Ndef(\myGendy).gui q.pad.elAt(\on).action = {|el| Ndef(\myGendy).vol = el.value; Ndef(\myGendy).setUni(\durScale, 1-el.value, \wiggle, el.value); }; q.pad.elAt(\off).action = {|el| Ndef(\myGendy).vol = el.value; }; q.pad.elAt(\touch).action = {|el| Ndef(\myGendy).setUni(\durScale, 1-el.value, \wiggle, el.value); }; k.elAt(\ribbon, \bend).action = {|el| Ndef(\myGendy).setUni(\changespeed, el.value); };