Re: Consensus gathering for the Dezippering issue

2013-12-04 01:48, Karl Tomlinson skrev:
> Raymond Toy writes:
>
>> Probably wanted  setTargetAtTime instead of exponentialRampToValueAtTime.
>> setTargetAtTime is, essentially, dezippering.
> You may be right, thanks.
>
> But setTargetAtTime() doesn't seem right either.
>
> Is there a reason to approach the new value slowly and
> asymptotically, if it is OK to move off the old value quickly and
> suddenly?
>
> setTargetAtTime seems designed for simulating first-order R/C
> circuits, rather than specifically for smoothing transitions.

Yes, you seem to be right. While it is often more natural to have 
exponential transitions for audio related parameters rather than linear 
transitions (especially true for frequency and volume parameters), the 
setTargetAtTime way of doing it only makes the time scale exponential 
(so you'll get the inverse-of-intended effect when going from a low to a 
high filter frequency value, for instance).

>
> I would have expected a transition from A to B to be the
> reflection of a transition from B to A.

A symmetrical smooth transition function could be the half-cosine 
function: v(t, V0, V1) = V0 + (V1 - V0) * (0.5 - 0.5 * cos(PI * (t - T0) 
/ (T1 - T0)))

...but for parameters that are exponential by nature (e.g. frequency), 
the smoothing function would probably be better off mapped to an 
exponential scale. For instance (not taking values <= 0 into account), 
calculate exp(v(t, log(V0), log(V1))) instead (absolutely not sure if it 
would work well though).


> But I fear that the appropriate transition will depend on the
> purpose, and this is going to get too difficult to specify for
> each use case.

Yes, as mentioned before, some values are better interpolated on a 
linear scale, while others are better interpolated on an exponential 
scale (or logarithmic - can never decide what to call it).

Also, it's quite difficult to set a reasonable default transition time 
that works for all cases.

/Marcus

>
> It would be better to provide appropriate tools for clients to
> perform the transition appropriate for their situation.
>




-- 
Marcus Geelnard
Technical Lead, Mobile Infrastructure
Opera Software

Received on Wednesday, 4 December 2013 10:21:12 UTC