Re: Having some problems with envelopes

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 13:40:05 UTC