| 1 |
// Listing 6.3 Sci-fi techno dance bass line using the PulseOsc UGen |
| 2 |
|
| 3 |
//PulsOsc for techno-bass, by ChucK Programmer, 2014 |
| 4 |
PulseOsc p => dac; // connect a new PulseOsc to dac |
| 5 |
|
| 6 |
// infinite loop of sci-fi techno! |
| 7 |
while (true) |
| 8 |
{ |
| 9 |
Math.random2f(0.01,0.5) => p.width; // set random pulse width |
| 10 |
if (Math.random2(0,1)) // pick a pitch randomly |
| 11 |
{ |
| 12 |
84.0 => p.freq; // from one of |
| 13 |
} |
| 14 |
else |
| 15 |
{ |
| 16 |
100.0 => p.freq; // two different pitches |
| 17 |
} |
| 18 |
|
| 19 |
1 => p.gain; // turn on oscillator |
| 20 |
0.06 :: second => now; // hang out a bit |
| 21 |
|
| 22 |
0.0 => p.gain; // turn off oscillator |
| 23 |
0.04 :: second => now; // hang out a bit |
| 24 |
} |