| 1 |
// sound chain |
| 2 |
SinOsc s => dac; // The usual sound patch. |
| 3 |
|
| 4 |
// set frequency // Sets frequency and gain. |
| 5 |
220.0 => s.freq; |
| 6 |
// set volume |
| 7 |
0.6 => s.gain; |
| 8 |
|
| 9 |
// chance logical variable |
| 10 |
1 => int chance; // (1) Defines an integer named chance to use as a logical |
| 11 |
// variable (will have a value of either 1 or 0). |
| 12 |
|
| 13 |
if (chance == 1) // (2) if statement. |
| 14 |
{ |
| 15 |
// sound will play only if chance == 1 |
| 16 |
1 :: second => now; // (3) Advances time and lets sound happen if true. |
| 17 |
} |
| 18 |
|
| 19 |
// set new frequency |
| 20 |
330.0 => s.freq; // Sets new frequency for a different note... |
| 21 |
1 :: second => now; // (4) ...then plays this new note. |