ConvolverNode - Web APIs 编辑

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 inputs1
Number of outputs1
Channel count mode"clamped-max"
Channel count1, 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 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.

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

SpecificationStatusComment
Web Audio API
The definition of 'ConvolverNode' in that specification.
Working Draft

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:109 次

字数:4468

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文