Re: Creating ADSR Envelopes

On 11/01/2013 21:05, Chris Wilson wrote:
> I would just read the current value, set it, calculate the proper
> timing for a linear ramp to keep the appropriate slope, and schedule
> it.  (The synth examples I've done thus far do not reuse/retrigger
> the same envelope.) Retriggering an envelope in a JS event handler
> is easy enough to do - retriggering inside the WA thread is a bit
> harder, since you want to do programmatic things.  That might have
> to wait for a future "audio shader" programmability feature.
>
> The release portion, where this triggering could cause slope
> differences, I already use setTargetAtTime() for, as (AIUI) releases
> are frequently non-linear.

Every (analogue) EG circuit I've looked at used an exponential 1/RC
curve for all three - attack, decay, and release.

Knowing the start value, time constant and target value, it's possible
to calculate at what future time "t" some particular value will be 
reached[*], but it's not *that* easy.

Ray

[*] in a 1/RC charging circuit the target value is only ever 
"approached" as the limit of the curve, and never actually reached.

Received on Friday, 11 January 2013 21:18:01 UTC