This repository was archived by the owner on Apr 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdrumloop.ck
More file actions
122 lines (109 loc) · 3.13 KB
/
drumloop.ck
File metadata and controls
122 lines (109 loc) · 3.13 KB
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
114
115
116
117
118
119
120
121
122
140 => float bpm;
1::minute/bpm * 4 => dur takt;
1::minute/bpm * 2 => dur halbe;
1::minute/bpm => dur viertel;
1::minute/bpm/2 => dur achtel;
1::minute/bpm/4 => dur sechzehntel;
OscRecv recv;
// use port 6449 (or whatever)
6449 => recv.port;
// start listening (launch thread)
recv.listen();
//rec.event( "/plinker/out/port/80, f" ) @=> OscEvent @ oeOutWeb;
//recv.event( "/plinker/in/port/80, f" ) @=> OscEvent @ oeInWeb;
5 => int glob_msg;
SndBuf drums[6];
string filename[6];
"Alesis_HR16A_03.wav" => filename[0];
"Alesis_HR16A_47.wav" => filename[1];
"Alesis_HR16A_16.wav" => filename[2];
"Alesis_HR16A_28.wav" => filename[3];
"Alesis_HR16A_17.wav" => filename[4];
"Alesis_HR16A_10.wav" => filename[5];
[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0] @=> int bd_row[];
[0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1] @=> int sd_row[];
[0,1,1,0,0,1,1,0,0,1,1,1,0,1,1,0] @=> int ch_row[];
[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1] @=> int oh_row[];
[0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0] @=> int cp_row[];
[0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0] @=> int cb_row[];
<<<"Loading drums...">>>;
// load the filename[] to drums[]
for (0 => int k; k<6; k++)
{
filename[k] => drums[k].read;
}
<<<"...done">>>;
<<<"Connecting drums to dac...">>>;
//connect drums[] to dac and set gain
for (0 => int j; j<6; j++)
{
0.3 => drums[j].gain;
drums[j] => dac;
}
<<<"...done">>>;
fun void play_drums()
{
takt - (now % takt) => now; //synch am taktbeginn
//0 => int drum_index;
0 => int curr_pos;
<<<"Play the drums">>>;
while(true)
{
//update_drum_row();
//<<<"drum_index: ", drum_index>>>;
//drums[drum_index].play;
if (bd_row[curr_pos])
{
0 => drums[0].pos;
<<<"BD">>>;
}
if (glob_msg > 0)
{
if (sd_row[curr_pos])
{
0 => drums[1].pos;
<<<"SD">>>;
}
if (glob_msg > 1)
{
if (ch_row[curr_pos])
{
0 => drums[2].pos;
<<<"CH">>>;
}
if (glob_msg > 2)
{
if (oh_row[curr_pos])
{
0 => drums[3].pos;
<<<"OH">>>;
}
if (glob_msg > 3)
{
if (cp_row[curr_pos])
{
0 => drums[4].pos;
<<<"CP">>>;
}
if (glob_msg > 4)
{
if (cb_row[curr_pos])
{
0 => drums[5].pos;
<<<"CB">>>;
}
}
}
}
}
}
(curr_pos +1)%16 => curr_pos;
<<<curr_pos>>>;
1::sechzehntel => now;
}
}
spork ~ play_drums();
while (true)
{
1::second => now;
}