W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Re: setValueFunctionAtTime for AudioParam

From: Chris Rogers <crogers@google.com>
Date: Wed, 28 Mar 2012 17:55:47 -0700
Message-ID: <CA+EzO0=BTS9c3KYbjtxc=EHuSNodJ3eoeiecFZBXtaPf1giUSA@mail.gmail.com>
To: Patrick Borgeat <patrick@borgeat.de>
Cc: public-audio@w3.org
Hi Patrick,

Sorry, somehow I missed this thread.

I think what you might be looking for is:

partial interface AudioParam {
    void setValueCurveAtTime(in Float32Array values, in float time, in
float duration);
}

In this way, arbitrary sample-accurate parameter value changes can be
scheduled.  This array could be filled with a slow sine function as in your
example.  As a second example, a high-resolution amplitude envelope with
arbitrary shape (more complex than standard ADSR) could be applied to an
audio sample.

Instead of a callbacks from the audio engine to JavaScript as you're
envisioning (which would be much less efficient), the control flow works in
the opposite direction, with the JavaScript pushing precise curves to the
parameter at exact times.

Chris

On Wed, Mar 21, 2012 at 1:39 PM, Patrick Borgeat <patrick@borgeat.de> wrote:

> Hello list,
>
> are there considerations to add a method like setValueFunctionAtTime to
> AudioParam? I imagine it could be very handy as many value automations can
> be expressed easily as functions over time and each change of parameter
> would require the creation of a whole Float32Array.
>
> A good example is controlling a Filter parameter with a slow sine function
> (acting as a low frequency oscillator) but off course there are many more
> possibilities.
>
> Yours sincerely,
> Patrick Borgeat
>
>
Received on Thursday, 29 March 2012 00:56:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 29 March 2012 00:56:22 GMT