Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GainNode

GainNode

Baseline Widely available

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

TheGainNode interface represents a change in volume. It is anAudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. AGainNode always has exactly one input and one output, both with the same number of channels.

The gain is a unitless value, changing with time, that is multiplied to each corresponding sample of all input channels. If modified, the new gain is instantly applied, causing unaesthetic 'clicks' in the resulting audio. To prevent this from happening, never change the value directly but use the exponential interpolation methods on theAudioParam interface.

The GainNode is increasing the gain of the output.

EventTarget AudioNode GainNode
Number of inputs1
Number of outputs1
Channel count mode"max"
Channel count2 (not used in the default count mode)
Channel interpretation"speakers"

Constructor

GainNode()

Creates and returns a newGainNode object. As an alternative, you can use theBaseAudioContext.createGain() factory method; seeCreating an AudioNode.

Instance properties

Inherits properties from its parent,AudioNode.

GainNode.gainRead only

Ana-rateAudioParam representing the amount of gain to apply. You have to setAudioParam.value or use the methods ofAudioParam to change the effect of gain.

Instance methods

No specific method; inherits methods from its parent,AudioNode.

Example

SeeBaseAudioContext.createGain() for example code showing how to use anAudioContext to create aGainNode.

Specifications

Specification
Web Audio API
# GainNode

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp