| 1 |
// Listing 1.3 Using comments to document code and control execution |
| 2 |
|
| 3 |
// Author: ChucK Team // Initial comment, documents who |
| 4 |
// Date: Today's date // wrote the program and when. |
| 5 |
|
| 6 |
// make a sound chain ("patch") |
| 7 |
SinOsc s => dac; // Sets up sound signal chain. |
| 8 |
|
| 9 |
// prints out program name |
| 10 |
<<< "Hello Sine!" >>>; // (1) Prints a greeting message. |
| 11 |
|
| 12 |
// set volume to 0.6 // Sets up parameters to play a note. |
| 13 |
.6 => s.gain; |
| 14 |
// set frequency to 220.0 |
| 15 |
220.0 => s.freq; |
| 16 |
// play for 1 second |
| 17 |
second => now; |
| 18 |
|
| 19 |
0.5 => s.gain; // set volume to 0.5 // Plays another note. |
| 20 |
440 => s.freq; // set frequency to 440 |
| 21 |
2::second => now; // play for two seconds |
| 22 |
|
| 23 |
// comment out this third note for now |
| 24 |
/* |
| 25 |
0.3 => s.gain; // (2) Don't play this last note |
| 26 |
330 => s.freq; // right now, because we've |
| 27 |
3::second => now; // commented it out. |
| 28 |
*/ |