{{ APIRef("Web Audio API") }}
The GainNode
interface represents a change in volume. It is an {{domxref("AudioNode")}} audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode
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 applied using a de-zippering algorithm in order to prevent unaesthetic 'clicks' from appearing in the resulting audio.
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" |
Properties
Inherits properties from its parent, {{domxref("AudioNode")}}.
- {{domxref("GainNode.gain")}} {{readonlyinline}}
- Is an {{a-rate}} {{domxref("AudioParam")}} representing the amount of gain to apply.
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
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(10.0)}}{{property_prefix("webkit")}} | {{CompatGeckoDesktop(25.0)}} | {{CompatNo}} | 15.0{{property_prefix("webkit")}} 22 |
6.0{{property_prefix("webkit")}} |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | 26.0 | 1.2 | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | 33.0 |