W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2014

Re: Having some problems with envelopes

From: Ray Bellis <ray@bellis.me.uk>
Date: Thu, 24 Jul 2014 09:39:36 -0400
Message-ID: <53D10C98.7050601@bellis.me.uk>
To: "public-audio@w3.org" <public-audio@w3.org>
CC: Chris Wilson <cwilso@google.com>
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,

Received on Thursday, 24 July 2014 13:40:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:14 UTC