Modulation Works

by Ehsan Ziya

JavaScript

var context = new webkitAudioContext();

var osc1 = context.createOscillator(); 
var osc2 = context.createOscillator();
var gain = context.createGainNode();
    gain.gain.value = 100;
    osc2.type = "sawtooth";
    osc1.type = "sine";
    osc1.frequency.value = 200;
    osc2.frequency.value = 1;
    osc2.connect(gain);
    gain.connect(osc1.frequency);
    osc1.connect(context.destination);
    osc1.noteOn(0);
    osc2.noteOn(0);