OscillatorでAudio生成(シンセシス)
var osc =audioctx.createOscillator();
var gain = audioctx.createGain();
osc.connect(gain);
gain.connect(audioctx.destination);
function Setup() {
if(play == 0) {
osc.start(0);
play = 1;
}
var type = document.getElementById("type").selectedIndex;
var freq = parseFloat(document.getElementById("freq").value);
var level = parseFloat(document.getElementById("level").value);
osc.type = type;
osc.frequency.value = freq;
gain.gain.value = level;
}
Friday, June 7, 2013