Skip to content

Commit

Permalink
Merge pull request #570 from rtoy/131-setvaluecurveattime-linear-interp
Browse files Browse the repository at this point in the history
Fix #131: specify linear interpolation for setValueCurveAtTime
  • Loading branch information
padenot committed Aug 27, 2015
2 parents 60e3b28 + 622e6e4 commit 0099005
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1762,18 +1762,19 @@ <h2 id="AudioParam">The AudioParam Interface</h2>
</dd>
</dl>
<p>
During the time interval: <code>startTime</code> &lt;= t &lt;
<code>startTime</code> + <em>duration</em>, values will be calculated:
</p>
<pre>
v(t) = values[N * (t - startTime) / duration]
</pre>
<p>
where <em>N</em> is the length of the <em>values</em> array.
Let \(T_0\) be <code>startTime</code>, \(T_D\) be <code>duration</code>, \(V\) be the
<code>values</code> array, and \(N\) be the length of the <code>values</code> array. Then,
during the time interval: \(T_0 \le t &lt; T_0 + T_D\), let
$$
\begin{align*}
k &= \big\lfloor \frac{N}{T_D}(t-T_0) \big\rfloor \\
\end{align*}
$$
Then \(v(t)\) is computed by linearly interpolating between \(V[k]\) and \(V[k+1]\),
</p>
<p>
After the end of the curve time interval (t &gt;= <code>startTime</code> +
<em>duration</em>), the value will remain constant at the final curve
After the end of the curve time interval (\(t \ge T_0 + T_D\)),
the value will remain constant at the final curve
value, until there is another automation event (if any).
</p>
</dd>
Expand Down

0 comments on commit 0099005

Please sign in to comment.