AudioContext.destination

AudioContextdestination属性返回一个AudioDestinationNode表示 context 中所有音频(节点)的最终目标节点,一般是音频渲染设备,比如扬声器。

语法

var audioCtx = new AudioContext();
gainNode.connect(audioCtx.destination);

返回值

例子

注意:想要完整的例子,可以去看看MDN Github repo的 DEMO,比如panner-node

var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
// Older webkit/blink browsers require a prefix

var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();

oscillatorNode.connect(gainNode);
gainNode.connect(audioCtx.destination);

规范

Specification
Web Audio API
# dom-baseaudiocontext-destination

浏览器兼容性

BCD tables only load in the browser

另见