-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSynthDynamicValuesFromArduinoTest_onlyIf.scd
More file actions
100 lines (84 loc) · 1.55 KB
/
Copy pathSynthDynamicValuesFromArduinoTest_onlyIf.scd
File metadata and controls
100 lines (84 loc) · 1.55 KB
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
SerialPort.devices;
~port = SerialPort.new("COM3", 57600);
(
~charArray = [ ];
~getValues = Routine.new({
{
~ascii = ~port.read.asAscii;
if(~ascii.isDecDigit, {~charArray = ~charArray.add(~ascii)});
if(~ascii == $d, {
~vala = ~charArray.collect(_.digit).convertDigits;
~charArray = [ ];
});
if(~ascii == $e, {
~valb = ~charArray.collect(_.digit).convertDigits;
~charArray = [ ];
});
if(~ascii == $f, {
~valc = ~charArray.collect(_.digit).convertDigits;
~charArray = [ ];
});
}.loop;
}).play;
)
~vala;
~valb;
~valc;
~port.close;
s.boot;
(
SynthDef.new(\saw, {
arg cutoff=1000;
var sig;
sig = Saw.ar([50,51]);
sig = RLPF.ar(sig, cutoff.lag(0.02), 0.25, 0.2);
Out.ar(0, sig);
}).add;
)
(
SynthDef.new(\saw1, {
arg cutoff=500;
var sig;
sig = Saw.ar([49,52]);
sig = RLPF.ar(sig, cutoff.lag(0.02), 0.25, 0.2);
Out.ar(0, sig);
}).add;
)
(
SynthDef.new(\saw2, {
arg cutoff=200;
var sig;
sig = Saw.ar([49,52]);
sig = RLPF.ar(sig, cutoff.lag(0.02), 0.25, 0.2);
Out.ar(0, sig);
}).add;
)
x = Synth.new(\saw);
y = Synth.new(\saw1);
w = Synth.new(\saw2);
x.free;
y.free;
w.free;
x.set(\cutoff,~vala.linexp(0, 255, 80, 4000));
(
~control = Routine.new({
{
x.set(\cutoff, ~vala.linexp(0, 255, 80, 4000));
0.0001.wait;
y.set(\cutoff, ~valc.linexp(0, 255, 120, 4000));
0.0001.wait;
w.set(\cutoff, ~valb.linexp(0, 255, 1000, 2000));
0.0001.wait;
}.loop;
}).play;
)
(
~control1 = Routine.new({
{
y.set(\cutoff, ~valc.linexp(0, 255, 120, 4000));
0.0001.wait;
}.loop;
}).play;
)
x.free;
y.free;