Back to Content

GainNode: gain property

files/en-us/web/api/gainnode/gain/index.md

latest795 B
Original Source

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

The gain property of the {{ domxref("GainNode") }} interface is an a-rate {{domxref("AudioParam")}} representing the amount of gain to apply.

Value

An {{domxref("AudioParam")}}.

[!NOTE] Though the AudioParam returned is read-only, the value it represents is not.

Examples

See BaseAudioContext.createGain() for example code showing how to use an AudioContext to create a GainNode, which is then used to mute and unmute the audio by changing the gain property value.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also