私は現在、オーディオコンテキストを使用してトーンを生成しようとしているプロジェクトに取り組んでいます。ここに私がこれまでに来たものです:2つの機能の間を行き来する方法
$("#btn").click(function(){
var context = new (window.AudioContext || window.webkitAudioContext)();
var osc = context.createOscillator(); // instantiate an oscillator
osc.type = 'sine'; // this is the default - also square, sawtooth, triangle
osc.frequency.value = 440; // Hz
osc.connect(context.destination); // connect it to the destination
osc.start(); // start the oscillator
osc.stop(context.currentTime + 1);
})
私は解決策を得ました。それは完璧に私が探しているトーンを作る。ただし、6回以下のアクティベーションでのみ動作します。言い換えれば、ボタンを6回以上(id === "btn"で)クリックすると、もはやトーンを作りません。ここで
上記と同じ構文を持つjsFiddle.netリンクはあなたは私が問題を解決する手助けすることはできますか?
https://stackoverflow.com/questions/43511096/uncaught-domexception-failed-to -construct-audiocontext-the-number-of-hardwarおよびhttps://stackoverflow.com/questions/25046470/failed-to-construct-audiocontext-number-of-hardware-contexts-reached-maximum –