-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
voltage.scd
113 lines (106 loc) · 2.04 KB
/
voltage.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
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
110
111
112
113
(
(
SynthDef(\just, {
|
out,
freq,
harmonic = 1,
channel |
var vco;
vco = DC.ar(freq * harmonic);
OffsetOut.ar(channel, vco);
}).add
);
(
SynthDef(\pitch, {
|
out,
n,
channel,
stepsPerOctave = 12,
rate = 1,
delta,
begin,
end,
portamento = 0 |
var slew, env, phase;
n = n + (stepsPerOctave / 12);
n = (n + (n / stepsPerOctave) * (1 / (stepsPerOctave + 1)) / 10);
slew = (portamento);
slew = (slew + (slew / stepsPerOctave) * (1 / (stepsPerOctave + 1)) / 10);
env = Env([n, n + slew], [delta / rate]);
phase = Line.ar(begin, end, delta / rate);
OffsetOut.ar(channel, IEnvGen.ar(env, phase));
}).add
);
(
SynthDef(\gate, {
|
out,
channel,
amp,
n |
n = n * 5;
OffsetOut.ar(channel, DC.ar(n) * amp);
}).add
);
(
SynthDef(\voltage, {
|
out,
channel,
n,
rate = 1,
delta,
begin,
amp = 1,
end,
portamento = 0 |
var slew, env, phase;
n = n * 5;
slew = (portamento);
rate = rate;
env = Env([n, n + slew], [delta / rate]);
phase = Line.ar(begin, end, delta / rate);
OffsetOut.ar(channel, EnvGen.ar(env, phase) * amp);
}).add
);
(
SynthDef(\saw, {
|
out,
channel,
amp = 1,
rate = 0.5 |
OffsetOut.ar(channel, abs(Saw.ar(rate)) * amp);
}).add;
);
(
SynthDef(\lfo, {
|
out,
channel,
amp = 1,
rate = 0.5 |
OffsetOut.ar(channel, K2A.ar(abs(SinOsc.ar(rate, 0)) * amp));
}).add;
);
(
SynthDef(\ar, {
|
out,
channel,
attack = 0.01,
decay = 0.25,
sustain = 0.25,
release = 0.25,
begin,
amp = 1,
end |
var env, phase;
env = Env.adsr(attack, decay, sustain, release);
phase = Line.ar(begin, end, sustain);
OffsetOut.ar(channel, IEnvGen.ar(env, phase) * amp);
}).add
);
)