// FM synthesis by hand // This is a gnarly sounding FM line (from the harmonics generated by the triangle carrier). The index of modulation is randomly generated to to from no vibrato to modulation faster than a human can percieve. The time between notes is 1 second. // carrier TriOsc c => dac; // modulator SinOsc m => blackhole; // MIDI note to play 48 => float note; // carrier frequency Std.mtof(note) => float cf; // modulator frequency (as a ratio) 0.00 * cf => float mod => m.freq; // index of modulation 1 * cf => float index; 0 => int i; // time-loop while( true ) { now + 1::second => time deltaTime; while (deltaTime > now) { // set modulation frequency cf * i * 0.01 => m.freq; // modulate cf + (index * m.last()) => c.freq; // advance time by 1 sample 1::samp => now; } Std.rand2(1,20) => i; }