Skip to main content

GainNode

The GainNode interface represents the change in volume (amplitude) of the audio signal. It is an AudioNode that applies given gain to processing audio data.

Direct gain modification often results in unpleasant 'clicks'. To avoid this effect, utilize exponential interpolation methods from the AudioParam.

gain-node

AudioNode properties

Number of inputs1
Number of outputs1
Channel count2
Channel count modemax
Channel interpretationspeakers

Envelope - ADSR

Envelope is term widely used in music and sound engineering, it describes how a sound changes over time. The most common way of describing an envelope is ADSR. This acronym stands for: attack, decay, sustain and release.

  • Attack - the time it takes for the sound to reach its peak volume from the beginning.
  • Decay - the time it takes for the sound to reach the sustain level after the peak volume.
  • Sustain - the volume level that the sound will stay at until the key is released.
  • Release - the time it takes for the sound to fade out after the key is released.

ADSR Example

You can read more about envelopes and ADSR on Wikipedia.

Constructor

BaseAudioContext.createGain()

Properties

NameTypeDescription
gainAudioParama-rate AudioParam representing value of gain to apply.
Read only

Remarks

gain

  • Default value is 1.0.
  • Nominal range is -∞ to ∞.

We are Software Mansion.