forked from musikinformatik/WavesetsEvent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
time-bandit.scd
61 lines (50 loc) · 1.04 KB
/
time-bandit.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
// more elaborate GUI
(
WavesetsEvent.prepareSynthDefs;
~wavesets = ~wavesets ?? {
WavesetsEvent.read(Platform.resourceDir +/+ "sounds/a11wlk01-44_1.aiff")
};
// edit me while playing
Tdef(\u, {
inf.do { |i|
var event;
event = (
start: ~start ? 0,
num: rrand(1, 10),
rate: 1.0,
rate2: 1.0,
repeats:1,
amp: 0.1
);
event = ~wavesets.asEvent(event);
event.play;
event[\dur].wait;
}
}).play;
)
// search for interesting offsets
/*
keyboard:
space: start Tdef(\u)
f post current file path
*/
(
var w = Window("time bandit", Rect(100, 100, 820, 50)).front;
var sl = Slider(w).orientation_(\horizontal);
var b = Button(w).states_([["open"]]);
b.action = {
Dialog.openPanel({ |path|
var ws = WavesetsEvent.new;
ws.readChannel(path, onComplete: { ~wavesets = ws; ~path = path })
})
};
sl.action = { |view| ~start = view.value.linlin(0, 1, 0, ~wavesets.size) };
sl.keyDownAction = { |view, char|
switch(char,
$f, { ~path.postcs },
$ , { Tdef(\u).play },
{ ~start.post; ",".postln }
)
};
w.layout = HLayout(sl, b);
)