examples/book/digital-artists/chapter1/Listing1.19.ck
raw| 1 | // Listing 1.19 Using more than one oscillator |
| 2 | |
| 3 | // connect two oscillators to the dac |
| 4 | SinOsc s => dac; // Our usual sine wave |
| 5 | SinOsc s2 => dac; // (1) Another sine wave oscillator |
| 6 | |
| 7 | // set their frequencies and gains |
| 8 | 220 => s.freq; // (2) Sets frequency of first sine |
| 9 | 1030 => s2.freq; // (3) Sets frequency of second sine |
| 10 | 0.5 => s.gain; // (4) Sets gains to 1/2 |
| 11 | 0.5 => s2.gain; |
| 12 | |
| 13 | second => now; // (5) Lets time pass so you can hear the sound. |
| 14 | |
| 15 |