-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbus_ar.scd
52 lines (43 loc) · 1.82 KB
/
bus_ar.scd
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
(
// the arg direct will control the proportion of direct to processed signal
SynthDef("tutorial-DecayPink", { arg outBus = 0, effectBus, direct = 0.5;
var source;
// Decaying pulses of PinkNoise. We'll add reverb later.
source = Decay2.ar(Impulse.ar(1, 0.25), 0.01, 0.2, PinkNoise.ar);
// this will be our main output
Out.ar(outBus, source * direct);
// this will be our effects output
Out.ar(effectBus, source * (1 - direct));
}).add;
SynthDef("tutorial-DecaySin", { arg outBus = 0, effectBus, direct = 0.5;
var source;
// Decaying pulses of a modulating sine wave. We'll add reverb later.
source = Decay2.ar(Impulse.ar(0.3, 0.25), 0.3, 1, SinOsc.ar(SinOsc.kr(0.2, 0, 110, 440)));
// this will be our main output
Out.ar(outBus, source * direct);
// this will be our effects output
Out.ar(effectBus, source * (1 - direct));
}).add;
SynthDef("tutorial-Reverb", { arg outBus = 0, inBus;
var input;
input = In.ar(inBus, 1);
// a low-rent reverb
// aNumber.do will evaluate its function argument a corresponding number of times
// {}.dup(n) will evaluate the function n times, and return an Array of the results
// The default for n is 2, so this makes a stereo reverb
16.do({ input = AllpassC.ar(input, 0.04, { Rand(0.001,0.04) }.dup, 3)});
Out.ar(outBus, input);
}).add;
b = Bus.audio(s,1); // this will be our effects bus
)
(
x = Synth.new("tutorial-Reverb", [\inBus, b]);
y = Synth.before(x, "tutorial-DecayPink", [\effectBus, b]);
z = Synth.before(x, "tutorial-DecaySin", [\effectBus, b, \outBus, 1]);
)
// Change the balance of wet to dry
y.set(\direct, 1); // only direct PinkNoise
z.set(\direct, 1); // only direct Sine wave
y.set(\direct, 0); // only reverberated PinkNoise
z.set(\direct, 0); // only reverberated Sine wave
x.free; y.free; z.free; b.free;