初めて Web オーディオ API に挑戦しようとしています。現時点では、Hello World に相当する単純な音声が欲しいと思っています。つまり、440HZ サインオシレーターです。API から、それを作成する関数は「createOscillator」であり、使用しているブラウザー (Canary および Firefox の最新ビルド) によっては存在しないようです。createBufferSource() のような AudioContext オブジェクトを介して取得されたと思っていましたが、そうではないようです。誰かが問題を明らかにすることはできますか? 事前に感謝し、以下の私のコードを見つけてください:
<script>
window.onload = init();
function init ()
{
if (typeof AudioContext == "function") {
var audioContext = new AudioContext();
} else if (typeof webkitAudioContext == "function") {
var audioContext = new webkitAudioContext();
}
var source = audioContext.createOscillator();
source.connect(audioContext.destination);
source.start();
}
</script>