--- title: GainNode slug: Web/API/GainNode translation_of: Web/API/GainNode ---
{{ APIRef("Web Audio API") }}
GainNode
介面代表的是音量改變。 這是 {{domxref("AudioNode")}} 音訊處理模組,可以對輸入的訊號做增益 (gain) 後輸出。一個 GainNode
有一個輸入和一個輸出,兩者有相同的聲道數。
增益 (gain) 是無單位的數值,隨時間變化,會用來和所有輸入聲道的取樣做相乘。 如果更改的話,新的增益會用 de-zippering 演算法處理,以避免輸出聲音出現難聽的「喀」聲。
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" |
Inherits properties from its parent, {{domxref("AudioNode")}}.
No specific method; inherits methods from its parent, {{domxref("AudioNode")}}.
{{page("/en-US/docs/Web/API/AudioContext.createGain","Example")}}
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Audio API', '#the-gainnode-interface', 'GainNode')}} | {{Spec2('Web Audio API')}} |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | {{CompatChrome(10.0)}}{{property_prefix("webkit")}} | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(25.0)}} | {{CompatNo}} | {{CompatOpera(15)}}{{property_prefix("webkit")}} {{CompatOpera(22)}} |
6.0{{property_prefix("webkit")}} |
constructor | {{CompatChrome(55.0)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatOpera(42)}} | {{CompatUnknown}} |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | 26.0 | 1.2 | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatChrome(33.0)}} |
constructor | {{CompatNo}} | {{CompatChrome(55.0)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatOpera(42)}} | {{CompatUnknown}} | {{CompatChrome(55.0)}} |