-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEnvEdit examples.scd
73 lines (49 loc) · 1.58 KB
/
EnvEdit examples.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
//Envelope GUI.
//Add Node - Control-click
//Delete node - delete key
//Change slope - Select Node. Then Option-click and drag.
//Delete slope - Select Node. Shift-click on node.
//Add or remove a release node - Double click.
//This is a work in progress. Jeremy Van Buskirk - [email protected]
e = EnvEdit();
e.asEnv.postcs;
e.asEnv.test;
//Add to a window.
(
w = Window.new;
w.addFlowLayout();
c = EnvEdit(parent: w.view, bounds: 180@125);
d = EnvEdit(parent: w.view, bounds: 180@125);
w.front;
)
//You can also set the env.
//You can not set releaseNode via Env currently. ReleaseNode must be set using the GUI
g = EnvEdit(Env([ 0.0, 1.0, 0.5, 0.25, 0.0 ], [ 0.25, 0.25, 0.25, 0.25 ], [-5, -5, -5, -5]));
g.asEnv.postcs;
g.asEnv.test;
//GUI range will automatically be set between the min. and max. levels.
//GUI duration is set to total duration
n = EnvEdit(Env([ 20.0, 800.0, 400, 20.0 ], [ 1.5, 0.5, 1 ], [3, -3, 3]));
//Examples with sound.
//amplitude Env.
(
var button, envel;
w = Window.new("Ampiltude Envelope");
w.addFlowLayout();
envel = EnvEdit(Env([ 0.0, 1.0, 0.0 ], [ 0.5, 0.5 ], \sin), w.view );
button = Button(w, 80@40)
.states_([["Play", Color.black]])
.action_({{SinOsc.ar(470) * EnvGen.kr(envel.asEnv, doneAction: 2)}.play});
w.front;
)
//Frequency Env.
(
var button, envel;
w = Window.new("Frequency Envelope");
w.addFlowLayout();
envel = EnvEdit(Env([ 100.0, 400.0, 250.0, 100 ], [ 4.5, 3.5, 2.3], [3, 3, 3]), w.view );
button = Button(w, 80@40)
.states_([["Play", Color.black]])
.action_({{SinOsc.ar(EnvGen.kr(envel.asEnv, doneAction: 2))}.play});
w.front;
)