«Easy side chain / side compression / gating» by rukano

on 25 Nov'16 17:02 in padskickgatecompressorcompressionside chainsidechain

Quick example how to use the Compander UGen for gating/side chaining

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
////////////////////////////////////////////////////////////////////////////
// Quick example of side chaining via direct audio channels and with proxyspace
// by rukano

s.boot;

////////////////////////////////////////
// side chain compression w/o proxyspace

k = Bus.audio(s, 2); // channels for the kick
x = Bus.audio(s, 2); // channels for the pad

{ Out.ar(k, Decay2.ar(Impulse.ar(2), 0.01, 1) * SinOsc.ar(80).dup) }.play; // shitty kick
{ Out.ar(x, Splay.ar(Saw.ar([60, 62, 65, 67].midicps/2)) * 0.5) }.play; // shitty pads

// master out
(
z.free; // so you can change parameters and reexecute it w/o adding more fx on top of each other
z = {
	var kick = In.ar(k, 2); // get the kick signal
	var pads = In.ar(x, 2); // get the pads signal
	var thresh = 0.1; // this would be the amp threshold when the Compander should "do" something
	var compression = 0.1; // the reduction ratio (reduction if below 1... expansion if above 1 !
	var attack = 0.01;
	var release = 0.1;
	var snd = Compander.ar(pads, kick, thresh, 1, compression, attack, release); // compressed signal with sidechain
	Out.ar(0, snd + kick); // add the kick to it, cause otherwise you will only have the compressed pads!
}.play(addAction: \addToTail); // add to tail to work as master effect
)

/////////////////////////////
// side chain with proxy space:

// our favourite live coding environment:
p = ProxySpace.push(s);

~pads = { Splay.ar(Saw.ar([60, 62, 65, 67].midicps/2)) * 0.5 }; // shitty pads
~kick = { Decay2.ar(Impulse.ar(2), 0.01, 1) * SinOsc.ar(80).dup }; // shitty kicks

~master.play; // node proxy for everything (as a master effect)
(
~master = {
	// same arguments as the other example:
	var thresh = 0.1;
	var compression = 0.1;
	var attack = 0.01;
	var release = 0.1;
	// here you get the signals directly from the node proxies, not over audio channels... easier to read
	var snd = Compander.ar(~pads.ar, ~kick.ar, thresh, 1, compression, attack, release);
	snd + ~kick.ar // the proxy has it's own output. Alternatively you can ~kick.play to hear the kick directly, you won't have to add it here
}
)

// That's it
raw 2163 chars (focus & ctrl+a+c to copy)
reception
comments