//ramp frequency on a lowpass filter
__().sine().lowpass({q:20}).dac();
__("sine").start();
//parameters: target, time (in secs), param to ramp & init value (optional)
//initialize lowpass to 1000 then ramp the frequency
//to 100 in .25 seconds.
__("lowpass").ramp(100,.25,"frequency",1000);
//target & time can be arrays of values
__().saw(180).gain(0).dac();
__("saw").start();
__("gain").ramp(
[1,0,1,0,1,0,1,0],
[1,0.25,0.25,0.25,0.25,0.25,0.25,1],
"gain",
0
);
//ramp multiple parameters on multiple nodes
__().sine(1000).gain(0).dac();
__("sine").start();
//init frequency on sine to 1000, then ramp to 80 in 5 secs,
//then ramp back to 1000 in 5 more
__("sine").ramp([80,1000],[5,5],"frequency",1000);
//init gain on the gain node to 0, then ramp to 1 in 5 secs,
//then ramp back to 0 in another 5 secs
__("gain").ramp([1,0],[5,5],"gain",0);
ADSR
//10 second envelope on the adsr. ramp frequency on lfo & lowpass
__().lfo({gain:100}).sine(300).lowpass({q:20}).adsr(10).dac().play();
__("adsr").adsr("trigger");
__("lfo").ramp([100,10],[5,5],"frequency",10);
__("lowpass").ramp([150,900],[5,5],"frequency",900);
//adsr parameters : attack, decay, sustain, hold, release
__().sine().adsr([1,1,0.35,1,2.25]).gain(0.25).dac().play();
__().sine(880).adsr([1.2,0.8,0.5,0.5,2.5]).connect("gain");
__().sine(1760).adsr([2,1,0.35,1,2]).connect("gain");
__("adsr").adsr("trigger");//trigger all adsr at once
//parameters : attack, decay, sustain, release
__().saw(30).adsr({id:"a2"}).dac().play();
//envelope arguments can be a param to the node or the trigger method
__("#a2").adsr("trigger",[0.025,0.15,0.15,1]);
//short cut parameter : "fast" or "slow" (.25 or 1)
__().sine().adsr({id:"a4"}).dac().play();
__("#a4").adsr("trigger","fast");