This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

gain

Summary

Represents the amount of gain to apply. Its default value is 1 (no gain change). The nominal minValue is 0, but may be set negative for phase inversion. The nominal maxValue is 1, but higher values are allowed (no exception thrown). This parameter is a-rate.

Property of apis/webaudio/GainNodeapis/webaudio/GainNode

Syntax

var result = GainNode.gain;
GainNode.gain = value;

Return Value

Returns an object of type NumberNumber

Examples

var audioCtx = new AudioContext();
var gainNode = audioCtx.createGain();
gainNode.gain.value = 0.5;

Related specifications

W3C Web Audio API
W3C Editor’s Draft