Re: Having some problems with envelopes

I think these are related.  You would currently need to keep track of the
calculations yourself to determine the current value, but if we exposed the
computedValue at the last time, you could use that.  You will of course
need to calculate the attack time yourself (i.e. the attack segment of the
second note starts from non-zero, but you want to keep the slope of the
ramp the same, IIUC).

Can you tell me, in your experience do "typical ADSR" envelopes use Linear
ramps or exponential?  My understanding has been that attacks are typically
linear, but decays are exponential, but I've not found very definitive
information.

setValueCurve does not interpolate, by definition, so I don't know that it
would be a good model.


On Thu, Jul 24, 2014 at 6:39 AM, Ray Bellis <ray@bellis.me.uk> wrote:

> On 23/07/2014 16:57, Chris Wilson wrote:
> > I'd been toying with the idea of suggesting the idea that
> > "cancelScheduledValues should explicitly set a "previously scheduled
> > parameter value" of the current value, at that time.  WDYT?
>
> I'm not sure how it would help.
>
> The fundamental difficulty in correctly emulating an ADSR EG is that the
> separate phases are triggered by a combination of the note on/off "gate"
> and the current level of the EG itself.
>
> Take this, for example, representing a key being pressed twice without
> the first note completing.
>
>     /\     /\
>    /  \___/  \_____
>   /                \
>  /                  \
>
>  X       OX       O
>
> The first attack phase lasts 4 units, but because the second note is
> starting with the EG already above zero its attack phase only lasts 2
> units, and its decay phase (and subsequent sustain phase) start
> commensurately sooner relative to the second "note on" event.
>
> This may not fit with the "WebAudio way" of creating a new chain of
> modules for each note (with the EG implicitly starting at zero for each
> note) but it's what's needed to emulate a typical monosynth - probably
> even more so for the filter EG than for the volume EG.
>
> I didn't try it yet, but the only API call I can see that might help is
> to exclusively use setValueCurveAtTime() and manually calculate every
> single step of the envelope manually.
>
> kind regards,
>
> Ray
>
>

Received on Thursday, 24 July 2014 15:34:47 UTC