AudioParam.exponentialRampToValueAtTime() does not work as intended

Hello All,

I have been fiddling with AudioParam and found a weird thing:

var c = new AudioContext();
var o = c.createOscillator();
var g = c.createGainNode();

o.connect(g);
g.connect(c.destination);
o.noteOn(0); // for Safari

g.gain.setValueAtTime(0.0, 0);
g.gain.linearRampToValueAtTime(1.0, 0.01);
g.gain.exponentialRampToValueAtTime(0.0, 2.0); // ???

With the last line above, I am expecting to have a nice smooth fade out for
1.99 seconds, but it is not happening on Chrome (stable, 27.0.1453.93)  and
Safari (stable, 6.0.4 (7536.29.13)). The sine wave falls into 0 gain
immediately at 2.0 second. The jsfiddle link follows:

http://jsfiddle.net/hoch/3sXRq/2/

Am I missing something here?

Thank you in advance,
Hongchan


-- 
Hongchan Choi

Teaching Assistant / PhD Candidate
Center for Computer Research in Music and Acoustics (CCRMA)
Stanford University

http://ccrma.stanford.edu/~hongchan

Received on Friday, 24 May 2013 01:34:06 UTC