-
Notifications
You must be signed in to change notification settings - Fork 0
/
rA-groove2.ck
113 lines (95 loc) · 2.4 KB
/
rA-groove2.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
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
// groove receiver
Groover groover;
groover.init();
groover.go();
// patch
sndbuf s[9];
LPF filter[9];
JCRev r => dac;
for( int i; i < s.cap(); i++ )
{
// disable filter (for now)
// s[i] => filter[i] => r;
s[i] => r;
Math.random2f(100, 200) => filter[i].freq;
2 => filter[i].Q;
0 => s[i].gain;
}
.01 => r.mix;
"Sounds/Silence.au" => s[0].read;
"Sounds/HBell1Open.au" => s[1].read;
"Sounds/HBell1OpenB.au" => s[2].read;
"Sounds/HBell1Closed.au" => s[3].read;
"Sounds/HBell1ClosedB.au" => s[4].read;
"Sounds/HDjemBass.au" => s[5].read;
"Sounds/HDjemBass.au" => s[6].read;
"Sounds/HDjemTone.au" => s[7].read;
"Sounds/HDjemSlap.au" => s[8].read;
// create our OSC receiver
OscRecv recv;
// use port 6449
6449 => recv.port;
// start listening (launch thread)
recv.listen();
// create an address in the receiver, store in new variable
recv.event( "/plork/synch/clock, i i" ) @=> OscEvent oe;
recv.event( "/plork/synch/filter, f f" ) @=> OscEvent filterEvent;
// <<< pane.width(), pane.height() >>>;
[[1.0, 0.2, 0.3, 0.2, 0.4, 0.1, 0.2, 0.1],
[0.5, 0.1, 0.3, 0.2, 0.4, 0.1, 0.2, 0.1],
[0.8, 0.1, 0.3, 0.2, 0.5, 0.1, 0.2, 0.1],
[0.4, 0.1, 0.3, 0.2, 0.3, 0.1, 0.2, 0.1]] @=> float mygains[][];
int x;
int y;
int value;
spork ~ listenFilterEvent();
// infinite event loop
while ( true )
{
// wait for event to arrive
oe => now;
// grab the next message from the queue.
while( oe.nextMsg() != 0 )
{
// get x and y
oe.getInt() => x;
oe.getInt() => y;
// set glow
groover.setPos( x, y );
// get value
groover.getStep( x, y ) => value;
// play the thing
play( value );
}
}
// do something
fun void play( int value )
{
float temp;
if( value == 0 ) return;
// if( std.rand2f(0.0,1.0) < mygains[y][x] )
// {
// <<< "playing:", value >>>;
0.2 + std.rand2f( 0.0, mygains[y][x] ) => temp;
temp => s[value].gain;
0 => s[value].pos;
// }
}
fun void listenFilterEvent()
{
while(true)
{
filterEvent => now;
while( filterEvent.nextMsg() != 0 )
{
// get x and y
filterEvent.getFloat() => float freq;
filterEvent.getFloat() => float Q;
for(0 => int i; i < filter.size(); i++)
{
freq => filter[i].freq;
Q => filter[i].Q;
}
}
}
}