无法让振荡器产生噪音?我想我错过了一些显而易见但却不知道的东西。关注https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createOscillator
<!DOCTYPE html>
<html>
<head>
<title>Audio API</title>
</head>
<body>
<script>
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
var oscillator = audioContext.createOscillator();
oscillator.type = 'square';
oscillator.frequency.value = 3000;
oscillator.start();
</script>
</body>
</html>
答案 0 :(得分:1)
您需要将振荡器节点连接到音频目标:
oscillator.frequency.value = 3000;
oscillator.connect( audioContext.destination );
oscillator.start();