Kick.ck

From CSWiki
Jump to: navigation, search
// kick.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 * 2.0 => dur t2;
t4 * 4.0 => dur t1;
fun void taktpos(dur module, dur offset) {
 module - ((now - offset) % module) => now;
}
// kick drum
sndbuf kick => dac;
"data/kick.wav" => kick.read;
///////////////(int)(kick.length/1::samp) => kick.pos;
(int)kick.length => kick.pos;
0.5 => kick.gain;
while(true) {
 taktpos(t1, 0::samp);
 0 => kick.pos;
 t2 => now;
 0 => kick.pos;
 t8 => now;
 0 => kick.pos;
}