Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. BaseAudioContext
  4. createConvolver()

BaseAudioContext: createConvolver() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨April 2021⁩.

ThecreateConvolver() method of theBaseAudioContextinterface creates aConvolverNode, which is commonly used to applyreverb effects to your audio. See thespec definition of Convolution for more information.

Note:TheConvolverNode()constructor is the recommended way to create aConvolverNode; seeCreating an AudioNode.

Syntax

js
createConvolver()

Parameters

None.

Return value

AConvolverNode.

Examples

Creating a convolver node

The following example shows how to use an AudioContext to create a convolver node.You create anAudioBuffer containing a sound sample to be usedas an ambience to shape the convolution (called theimpulse response) andapply that to the convolver. The example below uses a short sample of a concert hallcrowd, so the reverb effect applied is really deep and echoey.

For more complete applied examples/information, check out ourVoice-change-O-matic demo (seeapp.js for the code that is excerpted below).

js
const audioCtx = new AudioContext();// …const convolver = audioCtx.createConvolver();// …// Grab audio track via fetch() for convolver nodetry {  const response = await fetch(    "https://mdn.github.io/voice-change-o-matic/audio/concert-crowd.ogg",  );  const arrayBuffer = await response.arrayBuffer();  const decodedAudio = await audioCtx.decodeAudioData(arrayBuffer);  convolver.buffer = decodedAudio;} catch (error) {  console.error(    `Unable to fetch the audio file: ${name} Error: ${err.message}`,  );}

Specifications

Specification
Web Audio API
# dom-baseaudiocontext-createconvolver

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp