--- title: GainNode.gain slug: Web/API/GainNode/gain translation_of: Web/API/GainNode/gain ---
{{ APIRef("Web Audio API") }}
{{ domxref("GainNode") }} 接口的gain属性是一个a-rate {{domxref("AudioParam")}} ,表示可利用的增益量.
var audioCtx = new AudioContext(); var gainNode = audioCtx.createGain(); gainNode.gain.value = 0.5;
An {{domxref("AudioParam")}}.
Note: Though the AudioParam
returned is read-only, the value it represents is not.
{{page("/en-US/docs/Web/API/AudioContext.createGain","Example")}}
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Audio API', '#widl-GainNode-gain', 'gain')}} | {{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}} | 15.0{{property_prefix("webkit")}} 22 (unprefixed) |
6.0{{property_prefix("webkit")}} |
Feature | Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | {{CompatVersionUnknown}} | 26.0 | 1.2 | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | 33.0 |