| 1 |
// Listing 9.11 kick.ck kick drum file, conducted by BPM |
| 2 |
// kick.ck, on the fly drumming with global BPM conducting |
| 3 |
SndBuf kick => dac; |
| 4 |
1 => kick.gain; |
| 5 |
me.dir(-1)+"/audio/kick_04.wav" => kick.read; // (1) Reads a kick drum sound for this instrument |
| 6 |
|
| 7 |
// make a conductor for our tempo |
| 8 |
// this is set and updated elsewhere |
| 9 |
BPM tempo; // (2) Makes a BPM to use to sync with others |
| 10 |
while (1) { // (3) Infinite loop |
| 11 |
|
| 12 |
// update our basic beat each measure |
| 13 |
tempo.quarterNote => dur quarter; // (4) Uses quarter note from BPM |
| 14 |
|
| 15 |
// play a measure of quarter note kicks |
| 16 |
for (0 => int beat; beat < 4; beat++) { // (5) Four-beat measure |
| 17 |
0 => kick.pos; // (6) Plays on every beat |
| 18 |
quarter => now; |
| 19 |
} |
| 20 |
} |