| 1 |
// Listing 6.10 Simple resonant-filtered impulse makes for cool computer music |
| 2 |
|
| 3 |
// Computer music!! (1) Impulse through resonant filter |
| 4 |
Impulse imp => ResonZ filt => dac; |
| 5 |
|
| 6 |
// Set the Q ((2) Quality, amount of resonance) |
| 7 |
100.0 => filt.Q; // fairly high, to yield a pitch |
| 8 |
|
| 9 |
while (1) |
| 10 |
{ |
| 11 |
// pick a random frequency |
| 12 |
Math.random2f(500.0,2500.0) => filt.freq; |
| 13 |
|
| 14 |
// fire our impulse, and hang out a bit |
| 15 |
100.0 => imp.next; // (3) Tells impulse to output 100.0 |
| 16 |
// (only on next sample). |
| 17 |
0.1 :: second => now; |
| 18 |
} |
| 19 |
|