--- title: GainNode slug: Web/API/GainNode translation_of: Web/API/GainNode ---

{{ APIRef("Web Audio API") }}

GainNode 介面代表的是音量改變。 這是 {{domxref("AudioNode")}} 音訊處理模組,可以對輸入的訊號做增益 (gain) 後輸出。一個 GainNode 有一個輸入和一個輸出,兩者有相同的聲道數。

增益 (gain) 是無單位的數值,隨時間變化,會用來和所有輸入聲道的取樣做相乘。 如果更改的話,新的增益會用 de-zippering 演算法處理,以避免輸出聲音出現難聽的「喀」聲。

The GainNode is increasing the gain of the output.

Number of inputs 1
Number of outputs 1
Channel count mode "max"
Channel count 2 (not used in the default count mode)
Channel interpretation "speakers"

Constructor

{{domxref("GainNode.GainNode", "GainNode()")}}
Creates a new instance of an GainNode object.

Properties

Inherits properties from its parent, {{domxref("AudioNode")}}.

{{domxref("GainNode.gain")}} {{readonlyinline}}
a-rate {{domxref("AudioParam")}} ,代表增益值

Methods

No specific method; inherits methods from its parent, {{domxref("AudioNode")}}.

Example

{{page("/en-US/docs/Web/API/AudioContext.createGain","Example")}}

Specifications

Specification Status Comment
{{SpecName('Web Audio API', '#the-gainnode-interface', 'GainNode')}} {{Spec2('Web Audio API')}}  

Browser compatibility

{{Compat("api.GainNode")}}

See also