ConvolverNode
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" |
Constructor
ConvolverNode()
-
Creates a new
ConvolverNode
object instance.
Properties
Inherits properties from its parent, AudioNode
.
ConvolverNode.buffer
-
A mono, stereo, or 4-channel
AudioBuffer
containing the (possibly multichannel) impulse response used by theConvolverNode
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.
Methods
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.
Note: 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);
Specifications
Specification |
---|
Web Audio API # ConvolverNode |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
ConvolverNode |
14 |
12 |
25 |
No |
15 |
6 |
≤37 |
18 |
25 |
14 |
Yes |
1.0 |
ConvolverNode |
55 |
79 |
53 |
No |
42 |
14.1 |
55 |
55 |
53 |
42 |
14.5 |
6.0 |
buffer |
14 |
12 |
25 |
No |
15 |
6 |
≤37 |
18 |
25 |
14 |
Yes |
1.0 |
normalize |
14 |
12 |
25 |
No |
15 |
6 |
≤37 |
18 |
25 |
14 |
Yes |
1.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ConvolverNode