//set up sounds to control
__().sine().lowpass().gain().dac();
//add a delay in parallel
__("sine").delay().connect("gain");
//use attr() to set any attribute in any combination on a node
__("lowpass").attr({"frequency":200,"q":5});
__("sine").attr({"detune":6});
__("gain").attr({"gain":0.5});
__("delay").attr({"delay":1,feedback:0.9});
Start, Stop & Play
//set up sounds to control
__().sine().lowpass().gain().dac();
//start the sine
__("sine").start();
//stop the sine
__("sine").stop();
//add a sawtooth
__().saw().connect("lowpass");
//start the saw and the sine
__("saw,sine").start();
//stop the saw
__("saw").stop();
//stop everything;
__("*").stop();
//start everything
__.play();
Convenience Methods
//set up sounds to control
__().sine().lowpass().gain().dac();
//add a delay in parallel
__("sine").delay().connect("gain");
//example convenience methods to set a single parameter
__("lowpass").frequency(200);
__("sine").detune(6);
__("gain").volume(0.5);
__("delay").time(1);
__("delay").feedback(0.9);
//set up sounds to control
__().
sampler({path:"../../data/various/gun-cock.wav",loop:true}).
ring().
gain().
dac(0.5).
play();
//use jquery to bind to events from the slider
$("input[type='range']").bind("input",function(evt){
if(evt && evt.target) {
var mods = $(evt.target).data("modifies");
if(mods==="speed") {
__("sampler").speed(evt.target.value);
} else if(mods==="distortion") {
__("ring").distortion(evt.target.value);
} else if(mods==="frequency") {
__("ring").frequency(evt.target.value);
}
}
});