W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: Questions about AudioParam

From: Robert O'Callahan <robert@ocallahan.org>
Date: Tue, 11 Dec 2012 14:41:43 +1300
Message-ID: <CAOp6jLYK4aip5j7_VZTG+Hurdz8s02sPjDzA5L_o18fTeiE0og@mail.gmail.com>
To: Chris Rogers <crogers@google.com>
Cc: Ehsan Akhgari <ehsan.akhgari@gmail.com>, public-audio@w3.org
On Tue, Dec 11, 2012 at 2:27 PM, Chris Rogers <crogers@google.com> wrote:

> I can see how an AudioParam could keep a record for .computedValue for the
> last N "rendering quantums", so it could look back in time to the
> .computedValue corresponding to the snapshot of .currentTime you're
> suggesting.  But we can't go back an arbitrary amount of time, since we
> don't have infinite storage.  This value is computed based on timeline
> values and also audio-rate signals (from other AudioNodes) connected to it.
>  So we don't necessarily have all the information we need to compute this
> value on-the-fly arbitrarily backwards in time.
>

One possible approach:
1) Before you modify an AudioParam in a way that could affect its value at
currentTime, compute and save the current computedValue. Flush these saved
values at the next stable state.
2) When you update the snapshot of currentTime, grab the value at
currentTime of the output of every AudioNode that is being used as input to
an AudioParam and store the result somewhere as part of the snapshot.
Then you should have enough information to recompute computedValue at
currentTime for any AudioParam.

Perhaps there is a clever technique, and I'd have to understand more
> specific details of exactly how you'd approach it.  But in any case, I
> would not like any solution which would worsen the normal average update
> rate of these parameters if animated at 60fps in requestAnimationFrame().
>  In other words, if a solution to synchronize these values to a snapshot
> caused the average performance of the animation to appear more choppy, then
> that seems bad.
>

It wouldn't. The browser is not allowed to update the page rendering while
script is running (ignoring some async compositing features that aren't
relevant here), so we'd be able to snapshot state at least as often as we
repaint the screen.

Rob
-- 
Jesus called them together and said, “You know that the rulers of the
Gentiles lord it over them, and their high officials exercise authority
over them. Not so with you. Instead, whoever wants to become great among
you must be your servant, and whoever wants to be first must be your
slave — just
as the Son of Man did not come to be served, but to serve, and to give his
life as a ransom for many.” [Matthew 20:25-28]
Received on Tuesday, 11 December 2012 01:42:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:04 UTC