From CSWiki
// hihat.ck
// constructing a percussion set
// Rasmus Kaj program implemented by Gary Williams
60::second / 125.0 => dur t4;
t4 / 2.0 => dur t8;
t4 / 4.0 => dur t16;
t4 / 8.0 => dur t32;
t4 / 16.0 => dur t64;
t4 * 2.0 => dur t2;
t4 * 4.0 => dur t1;
fun void taktpos(dur module, dur offset) {
module - ((now - offset) % module) => now;
}
// hihat sound buffers
sndbuf open => dac;
sndbuf closed => dac;
"data/hihat-open.wav" => open.read;
"data/hihat.wav" => closed.read;
(int)(open.length) => int tlen;
///////////////(int)(tlen/1::samp) => open.pos;
tlen => open.pos;
(int)(closed.length) => int tmplen;
//////////////(int)(tmplen/1::samp) => closed.pos;
tmplen => closed.pos;
// the kick pattern
while(true) {
taktpos(t2, 0::samp);
0 => closed.pos;
t8 - t64 => now;
0 => open.pos;
t8 + t64 => now;
0 => open.pos;
t8 - t64 => now;
0 => closed.pos;
}