-
Notifications
You must be signed in to change notification settings - Fork 0
/
diceSound.ck
58 lines (43 loc) · 1.15 KB
/
diceSound.ck
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
Chooser c;
me.arg(0) => string file;
Fader f;
Pan2 g;
0 => g.gain;
g.left => Control.leftOut;
g.right => Control.rightOut;
c.getFloat( -1.0, 1.0 ) => g.pan;
DiceSound dice;
c.getInt(1,4) => int choice;
2 => choice;
if ( choice == 1 ) {
new SlideRate @=> dice;
}
if ( choice == 2 ) {
new RepeatLoop @=> dice;
}
if ( choice == 3 ) {
new Wobbulator @=> dice;
}
if ( choice == 4 ) {
new Divisions @=> dice;
}
dice.initialise( file );
dice.buf => g;
g => Control.fxIn;
dice.getDiceLength() => dur duration;
duration / 5 => dur fadeLength;
<<< "Dicing with", file, "strategy", dice.idString(), "duration", duration / Control.srate >>>;
spork ~ dice.activity();
f.fadeIn( fadeLength, 0.2, g );
duration - fadeLength => now;
f.fadeOutBlocking(fadeLength, g);
0 => dice.active;
<<< "active", dice.active >>>;
dice.buf =< g =< Control.leftOut;
dice.buf =< g =< Control.rightOut;
// before tell the OSC server to kick off another diceSound run,
// let's wait a bit so we have a bit of breathing space
( c.getIntervalLong() / 2.0 )::second => now;
// Tell the server to spawn another
Control.oscSend.startMsg("diceSound", "i");
1 => Control.oscSend.addInt;