Re: General Notes on Web Audio API from TPAC

On Mon, Nov 28, 2011 at 11:39 AM, Alistair MacDonald <al@signedon.com>wrote:

> Hi Group,
>
> While working with the Web Audio API at TPAC I was taking some notes. I
> sent these to Chris Rogers and we started discussing this a few weeks back.
>
> Some of the technical discussion may be very useful / interesting to
> people experimenting with the API, so I'm going to forward the thread to
> public-audio here.
>
> At the bottom of the email I have attached the original notes I sent to
> Chris.
>
> Comments/discussion always welcome,
>
>>
>> P O S S I B L E  -  B U G S
>> ===========================
>>
>>
>>
>> AudioParam ...RampToValueAtTime( 0, 0 )
>> ---------------------------------------
>>
>> Exponential ramps do not seem to work properly when starting using "zero"
>> values.
>> I would expect to hear the sound ramping in from 0 or out to 0, instead
>> the
>> transition appears to be immediate when it reaches the given time. Much
>> like the
>> behavior of the setValueAtTime() method.
>>
>
> This is a consequence of the math behind exponential curves.  You can
> always have an exponentially increasing curve from
> value1 -> value2
>
>
It's not clear from the webaudio docs what an exponential ramp should do,
but we could define the ramp to be

value1 + (value2-value1)*(1-exp(-t/C))

This will be an exponential ramp starting at value1 and asymptotically
approaching value2.

Two major differences:


   - 0 is valid starting point.
   - We never actually reach value2, but just get closer and closer.

Ray

Received on Thursday, 1 December 2011 09:34:11 UTC