second/samp => float srate; TriOsc t => Gain sm => blackhole; Step s => sm; t.freq(0.05); // 20 second period sm.gain(0.5); // 0 - 1 range 1::samp => now; // tick one sample to initialize t.last() Clarinet c => dac; while (true) { sm.last() * 100.0 => float periodSeconds; // get get slow-changing control value, scale up to rate in seconds <<<"periodSeconds",periodSeconds>>>; 2*pi => float sinScale; // rate in radians at 1 sec period if (periodSeconds>0.0) periodSeconds /=> sinScale; // convert to desire rate in radians now/second => float nowInSeconds; // current time in seconds nowInSeconds * sinScale => float currentPhase;// convert to phase angle using rate in radians 0.1 => c.stopBlowing; // note off 50::ms => now; // wait a tiny bit Math.sin(currentPhase) => float v; 440.0 + (v * 220.0) => float f; // use the new value as a frequency f => c.freq; // to clarinet 0.8 => c.startBlowing; // note on 100::ms => now; // tone for 100ms }