examples/basic/fm2.ck
raw| 1 | // basic FM synthesis using SinOsc (2 => .sync; also see fm3.ck) |
| 2 | |
| 3 | // modulator to carrier |
| 4 | SinOsc m => SinOsc c => dac; |
| 5 | |
| 6 | // carrier frequency |
| 7 | 440 => c.freq; |
| 8 | // modulator frequency |
| 9 | 110 => m.freq; |
| 10 | // index of modulation |
| 11 | 300 => m.gain; |
| 12 | |
| 13 | // phase modulation is FM synthesis (sync is 2) |
| 14 | 2 => c.sync; |
| 15 | |
| 16 | // time-loop |
| 17 | while( true ) 1::second => now; |