AudioParam.setValueCurveAtTime

I am trying to write tests for w3c/web-platform-tests and have a few
questions and observations about the setValueCurveAtTime method.

The Chrome and Firefox implementations give different results.  If you have
a 5 element curve - stretched over 1 second then:

   - Chrome changes from element 0 to element 1 at around 0.1 seconds.
   - Firefox changes from element 0 to element 1 at around 0.2 seconds.

The difference indicates that Firefox is rounding the index down and Chrome
is rounding to the nearest whole number.

The specification states that the values should be calculated as:
  v(t) = values[N * (t - startTime) / duration]

Wouldn't it be more useful to calculate the value as:
  v(t) = values[Floor((N-1) * (t - startTime) / duration)]

As this means that the curve would start at startTime, and end at
startTime+duration.

Also, the "curve" part of the name infers that we should be interpolating
the values.  However the specification and browser implementations only
give discrete values.  This means the method is useless for envelopes.

Regards
Andy

Received on Monday, 23 June 2014 09:49:34 UTC