«Basic Ableton Push control with Modality» by LFSaw

on 29 Jan'17 20:07 in modalitycookbookableton push

Example on how to interface SuperCollider with Ableton Push via Modality toolkit. (I only have the first version here, send me a second version and I'll make it compatible with that ;) )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// 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);
};
raw 2443 chars (focus & ctrl+a+c to copy)
reception
comments