ConvolverNode

ConvolverNode interface is an AudioNode that performs a Linear Convolution on a given AudioBuffer , often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output.

注意 : For more information on the theory behind Linear Convolution, see the Convolution article on Wikipedia .

Number of inputs 1
Number of outputs 1
Channel count mode "clamped-max"
Channel count 1 , 2 ,或 4
Channel interpretation "speakers"

构造函数

ConvolverNode()
创建新的 ConvolverNode object instance.

特性

Inherits properties from its parent, AudioNode .

ConvolverNode.buffer
A mono, stereo, or 4-channel AudioBuffer containing the (possibly multichannel) impulse response used by the ConvolverNode to create the reverb effect.
ConvolverNode.normalize
A boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is set, or not.

方法

No specific method; inherits methods from its parent, AudioNode .

ConvolverNode Example

The following example shows basic usage of an AudioContext to create a convolver node.

注意 : You will need to find an impulse response to complete the example below. See this Codepen for an applied example.

let audioCtx = new window.AudioContext();
async function createReverb() {
    let convolver = audioCtx.createConvolver();
    // load impulse response from file
    let response     = await fetch("path/to/impulse-response.wav");
    let arraybuffer  = await response.arrayBuffer();
    convolver.buffer = await audioCtx.decodeAudioData(arraybuffer);
    return convolver;
}
...
let reverb = await createReverb();
// someOtherAudioNode -> reverb -> destination
someOtherAudioNode.connect(reverb);
reverb.connect(audioCtx.destination);
					

规范

规范 状态 Comment
Web 音频 API
The definition of 'ConvolverNode' in that specification.
工作草案

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
ConvolverNode Chrome 14 Edge ≤18 Firefox 25 IE 不支持 No Opera 15 Safari 6 WebView Android Yes Chrome Android 18 Firefox Android 26 Opera Android 14 Safari iOS Yes Samsung Internet Android 1.0
ConvolverNode() 构造函数 Chrome 55 Edge ≤79 Firefox 53 IE 不支持 No Opera 42 Safari ? WebView Android 55 Chrome Android 55 Firefox Android 53 Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
buffer Chrome 14 Edge 12 Firefox 25 IE 不支持 No Opera 15 Safari 6 WebView Android Yes Chrome Android 18 Firefox Android 26 Opera Android 14 Safari iOS Yes Samsung Internet Android 1.0
normalize Chrome 14 Edge 12 Firefox 25 IE 不支持 No Opera 15 Safari 6 WebView Android Yes Chrome Android 18 Firefox Android 26 Opera Android 14 Safari iOS Yes Samsung Internet Android 1.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知

另请参阅