ConvolverNode

翻译不完整。 请帮助我们翻译这篇文章!

ConvolverNode 接口是一个对给定 AudioBuffer 上执行线性卷积的 AudioNode,一般用来做音频混响效果。每一个 ConvolverNode 都会有一个输入值和输出值。

注意: 更多线性卷积理论的相关信息,请参阅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 对象实例。

属性

继承其父级的属性, AudioNode.

ConvolverNode.buffer
一个被 ConvolverNode 用来产生混响效果的单声道、立体声或四声道的音频缓冲器,包含了(可能是多声道)脉冲反应(IR)。
ConvolverNode.normalize
布尔值,在设置缓冲区属性时,可绝定是否对来自 buffer 的脉冲反应按等功率归一化进行缩放。

方法

没有具体的方法,从其父继承方法,AudioNode.

ConvolverNode 例子

下面的示例展示了 AudioContext 创建卷积节点的基础用法。

注意: 你需要找到一个脉冲反应来完成下面的示例。可查看 此处 的实例.

let audioCtx = new window.AudioContext();

async function createReverb() {
    let convolver = audioCtx.createConvolver();

    // 从文件加载脉冲反应
    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);

规范

规范 状态 注释
Web Audio API
ConvolverNode
Working Draft

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
ConvolverNodeChrome Full support 14Edge Full support 12Firefox Full support 25IE No support NoOpera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 26Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android Full support 1.0
ConvolverNode() constructorChrome Full support 55Edge Full support 79Firefox Full support 53IE No support NoOpera Full support 42Safari No support NoWebView Android Full support 55Chrome Android Full support 55Firefox Android Full support 53Opera Android Full support 42Safari iOS No support NoSamsung Internet Android Full support 6.0
bufferChrome Full support 14Edge Full support 12Firefox Full support 25IE No support NoOpera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 26Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android Full support 1.0
normalizeChrome Full support 14Edge Full support 12Firefox Full support 25IE No support NoOpera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 26Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android Full support 1.0

Legend

Full support  
Full support
No support  
No support

相关链接