1

When I call

myGainNode.gain.value = 0;
myGainNode.gain.linearRampToValueAtTime(1, currTime + 5000);

does the gain audioparam literally linearly ramp the gain coefficient from 0 to 1 in 5 seconds?

Or does it ramp in terms of decibels and instead ramp from some negligibly small value to 6.02dB (equivalent to doubling the amplitudes of the audio) and linearly interpolate the decibel values along the way?

dangerChihuahua007
  • 20,299
  • 35
  • 117
  • 206

1 Answers1

2

As per the specification gain is an (a-rate) AudioParam and does not have any specific implementation. So it will linearly ramp the coefficient.

(Currently) the only two ways to ramp parameter values are either linear or exponentially. If you would like to implement your own type of ramping(ie. logarithmically) you can use setValueCurveAtTime to define your logarithmic curve.

LJᛃ
  • 7,655
  • 2
  • 24
  • 35