-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDust-Variation.scd
79 lines (64 loc) · 1.56 KB
/
Dust-Variation.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
// Dust - Variation (SuperCollider score)
// Copyright Tony Wallace 2014
// http://tonywallace.com
Server.default = s = Server.local.boot;
(
SynthDef(\twDustVariation, {
var intervalCount = 7,
intervalRatio = 3/2,
baseFreq = 110.0,
baseLevel = 0.02,
baseDuration = 30.0,
osc = [];
// Sub tone:
osc = osc.add(SinOsc.ar(
freq: baseFreq / 2.0,
mul: EnvGen.kr(
envelope: Env(
levels: [0.000001, baseLevel, baseLevel, 0.000001],
times: [baseDuration, baseDuration * (intervalCount * 2), baseDuration],
curve: \exponential),
doneAction: 2)
)
);
// Harmonics:
intervalCount.do({
arg i;
var oscRatio = intervalRatio**i,
oscFreq = baseFreq * oscRatio,
oscLevel = baseLevel / oscRatio,
rampTime = baseDuration * (i + 1),
holdTime = baseDuration * ((intervalCount - i) * 2);
var densityEnv = Env(
levels: [10.0, 100.0, 100.0, 10.0],
times: [rampTime, holdTime, rampTime],
curve: \linear);
// Grainsin:
osc = osc.add(GrainSin.ar(
numChannels: 2,
trigger: Dust.kr(
density: EnvGen.kr(
envelope: densityEnv,
doneAction: 2)
),
freq: oscFreq,
pan: Dust.kr(
density: EnvGen.kr(
envelope: densityEnv,
doneAction: 2),
mul: 2.0,
add: -1.0),
mul: EnvGen.kr(
envelope: Env(
levels: [0.000001, oscLevel, oscLevel, 0.000001],
times: [rampTime, holdTime, rampTime],
curve: \exponential),
doneAction: 2)
)
);
});
Out.ar([0, 1], Mix.ar(osc));
}).load(s);
)
// Play:
Synth(\twDustVariation);