Re: setValueFunctionAtTime for AudioParam

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 UTC