-
Notifications
You must be signed in to change notification settings - Fork 0
/
osc_controller.scd
63 lines (52 loc) · 1.8 KB
/
osc_controller.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
53
54
55
56
57
58
59
60
61
62
63
// retrieve the current IP and port
NetAddr.localAddr
OSCFunc.trace(true); // Turn posting on
OSCFunc.trace(false); // Turn posting off
s.boot;
(
SynthDef(\SOSsnare,
{arg out = 0, sustain = 0.1, drum_mode_level = 0.25,
snare_level = 40, snare_tightness = 1000,
freq = 405, amp = 0.8;
var drum_mode_sin_1, drum_mode_sin_2, drum_mode_pmosc, drum_mode_mix, drum_mode_env;
var snare_noise, snare_brf_1, snare_brf_2, snare_brf_3, snare_brf_4, snare_reson;
var snare_env;
var snare_drum_mix;
drum_mode_env = EnvGen.ar(Env.perc(0.005, sustain), 1.0, doneAction: 2);
drum_mode_sin_1 = SinOsc.ar(freq*0.53, 0, drum_mode_env * 0.5);
drum_mode_sin_2 = SinOsc.ar(freq, 0, drum_mode_env * 0.5);
drum_mode_pmosc = PMOsc.ar( Saw.ar(freq*0.85),
184,
0.5/1.3,
mul: drum_mode_env*5,
add: 0);
drum_mode_mix = Mix.new([drum_mode_sin_1, drum_mode_sin_2, drum_mode_pmosc]) * drum_mode_level;
// choose either noise source below
// snare_noise = Crackle.ar(2.01, 1);
snare_noise = LFNoise0.ar(20000, 0.1);
snare_env = EnvGen.ar(Env.perc(0.005, sustain), 1.0, doneAction: 2);
snare_brf_1 = BRF.ar(in: snare_noise, freq: 8000, mul: 0.5, rq: 0.1);
snare_brf_2 = BRF.ar(in: snare_brf_1, freq: 5000, mul: 0.5, rq: 0.1);
snare_brf_3 = BRF.ar(in: snare_brf_2, freq: 3600, mul: 0.5, rq: 0.1);
snare_brf_4 = BRF.ar(in: snare_brf_3, freq: 2000, mul: snare_env, rq: 0.0001);
snare_reson = Resonz.ar(snare_brf_4, snare_tightness, mul: snare_level) ;
snare_drum_mix = Mix.new([drum_mode_mix, snare_reson]) * 5 * amp;
Out.ar(out, [snare_drum_mix, snare_drum_mix])
}
).add;
)
//receiving OSC in SC from Webots
(
OSCdef.new(\makeping, {
arg msg;
var osc;
osc = Synth(\SOSsnare, [
\sustain, msg[1] * 1.7,
\amp, 1,
\drum_mode_level, 0.25,
\snare_level, 60
]);
}, "/controllers/robotic_arm");
)
OSCdef.freeAll;
s.quit