Cracked Documentation examples/modulation.html

//simple frequency modulation //the "modulates" parameter on the gain tells it to connect //to the frequency audio param of the 2nd sine. __().sine(.1).gain({gain:100,modulates:"frequency"}).sine().dac(.25); //start up the sines __("sine").start();

//slightly more complex example //the "modulates" parameter on the gain tells it to connect //to the frequency audio param of the 2nd sine. __().sine(.1).gain({gain:100,modulates:"frequency"}).sine().dac(.15); //same as the line above, but add a delay after the gain __().sine(.1).gain(100).delay({modulates:"frequency",delay:1}).sine().connect("dac"); //start up the sines __("sine").start();

//brown noise as a modulation source __(). brown(). lowpass({frequency:20,q:30}). gain({gain:1000,modulates:"frequency"}). sine(40). dac(.15); //lfo modulates the frequency of the lowpass __().lfo({frequency:.15,gain:5}).connect("lowpass"); //start it up __("sine,brown,lfo").start();

LFO

//create & connect an lfo to a sine and then to output //lfo defaults: type=sawtooth, frequency=6, gain=1000, modulates=frequency __().lfo().sine().dac(.15); //start up lfo & sine __("sine,lfo").start();

//create & connect an lfo to a sine and then to output //set master gain to .25 __().lfo({frequency:4,type:"sine",gain:10,id:"lfo1"}).sine().dac(.25); //connect lfo #2 to lfo#1, modulate gain __().lfo({frequency:.1,modulates:"gain",gain:50,type:"sine"}).connect("#lfo1"); //start __("sine,lfo").start();

//create & connect a sine to output //set master gain to .25 __().sine().gain(.5).dac(.25); //create a 2nd sine with double the frequency __().sine(880).gain(.25).connect("dac"); //connect an lfo to both sines __().lfo({frequency:4,type:"sine",gain:20}).connect("sine"); //start __("sine,lfo").start();

//create sine & gain nodes and connect to output __().sine(180).gain(.75).dac(.5); //create an lfo and connect to the gain node //slow sawtooth ramp __().lfo({modulates:"gain",frequency:.15,gain:1}).connect("gain"); //start __("sine,lfo").start();

//create sine & gain nodes and connect to output __().sine(180).gain().dac(.5); //cheap tremolo effect __().lfo({modulates:"gain",frequency:10,gain:1,type:"triangle"}).connect("gain"); //start __("sine,lfo").start();

//lfo with pink noise as its type. __(). lfo({type:"pink",gain:500,modulates:"detune"}). sine(180). dac(); //start it up __("sine,lfo").start();

//set up a sine with a delay __().sine(300).delay().dac(0.25); //lfo modulating the delay time & feedback parameters of the delay __().lfo({type:"sine",modulates:"feedback",frequency:0.05,gain:0.01}).connect("delay"); __().lfo({type:"sine",modulates:"delay",frequency:0.1,gain:0.015}).connect("delay"); __("sine,lfo").start();

//create saw->panner->dac __().saw().panner().dac(0.25); //create an lfo and connect it to modulate the panner __().lfo({type:"square", modulates:"pan", frequency:1}).connect("panner").play();