The 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.
Note: 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 , or 4
|
Channel interpretation | "speakers" |
ConvolverNode()
ConvolverNode
object instance.Inherits properties from its parent, AudioNode
.
ConvolverNode.buffer
AudioBuffer
containing the (possibly multichannel) impulse response used by the ConvolverNode
to create the reverb effect.
ConvolverNode.normalize
buffer
attribute is set, or not.No specific method; inherits methods from its parent, AudioNode
.
The following example shows basic usage of an AudioContext to create a convolver node.
Note: You will need to find an impulse response to complete the example below. See this Codepen for an applied example.
var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var reverb = audioCtx.createConvolver(); ... function base64ToArrayBuffer(base64) { var binaryString = window.atob(base64); var len = binaryString.length; var bytes = new Uint8Array(len); for (var i = 0; i < len; i++) { bytes[i] = binaryString.charCodeAt(i); } return bytes.buffer; } ... var reverbSoundArrayBuffer = base64ToArrayBuffer(impulseResponse); audioCtx.decodeAudioData(reverbSoundArrayBuffer, function(buffer) { reverb.buffer = buffer; }, function(e) { alert('Error when decoding audio data ' + e.err); })
Specification | Status | Comment |
---|---|---|
Web Audio API The definition of 'ConvolverNode' in that specification. | Working Draft |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 14 | Yes | 25 | No | 15 | 6 |
ConvolverNode() constructor |
55 | ? | 53 | No | 42 | ? |
buffer |
14 | 12 | 25 | No | 15 | 6 |
normalize |
14 | 12 | 25 | No | 15 | 6 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | 18 | Yes | 26 | 15 | ? | Yes |
ConvolverNode() constructor |
55 | 55 | ? | 53 | 42 | ? | 6.0 |
buffer |
Yes | 18 | Yes | 26 | 15 | ? | Yes |
normalize |
Yes | 18 | Yes | 26 | 15 | ? | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ConvolverNode