Precise control over transient effects in immediate sounds

[1] attempts to implement an ADSR curve for a simple DTMF dialer.
It tries to play the sound with minimal latency, but loses control
over the envelope and duration of the sound because the sound
cannot start precisely at currentTime.

The setTargetAtTime() description says it is "useful for
implementing the "decay" and "release" portions of an ADSR
envelope", but it is only useful if precise times of phase
transitions are known.  These are known when the sound is started
in the future, but not if it is started with minimal latency.

The only way I can see to handle this with the current API might
be to use setValueCurveAtTime() because that has a duration
parameter, but behaviour when startTime is in the past is not
defined AFAICS and it would seem unfortunate to need to specify
per-sample values on the envelope, even during linear or sustained

Is there a reason why the API provides control at absolute times
but not at relative times?  At one stage AudioParam times at least
were spec'd as relative times [2] but that was considered an error

Do we need to add linearRampToValueAtInterval() and

Is it better to try to schedule with a consistent lag than to
start the sounds as soon as possible?  If so, I don't know how to
pick this lag.  The client doesn't know how much lag the
implementation might have between the js and audio threads, and
neither the implementation nor the client know how much longer the
script will take to run before the next stable state.


Received on Monday, 25 November 2013 07:14:00 UTC