- From: Chris Rogers <crogers@google.com>
- Date: Fri, 11 Jan 2013 12:47:51 -0800
- To: Ray Bellis <ray@bellis.me.uk>
- Cc: Chris Wilson <cwilso@google.com>, "Robert O'Callahan" <robert@ocallahan.org>, Yotam Mann <matoyotambien@gmail.com>, "public-audio@w3.org" <public-audio@w3.org>
- Message-ID: <CA+EzO0n72Hd2zYpw89JSg5=9mAiko2-aJosHftLfMABaDAQjJg@mail.gmail.com>
On Fri, Jan 11, 2013 at 12:41 PM, Ray Bellis <ray@bellis.me.uk> wrote: > On 11/01/2013 17:29, Chris Wilson wrote: > >> Well, that could of course give you a value for a future time based on >> what's currently known in the scheduler; if other calls are scheduled, >> or the .value is set, that might not reflect reality, though. I think >> it would be easier (and actually clarify the normal case, too) to have >> something that schedules taking the current result of scheduling and >> setting it as the currently scheduled value (at that point in time), and >> cancels any currently pending or in-progress scheduling events. >> > > Isn't there a further problem in that to correctly emulate an ADSR > generator that hasn't started from 0 you must both shorten the attack phase > and reschedule the decay and sustain phases accordingly. > > AIUI, on analogue synths the A and D values typically affected the _slope_ > of the attack and delay, which then only indirectly affects the _timing_ of > those phases. This would have been done by tuning the 1/RC > time constant of a charging capacitor, where the R component was the knob > on the panel. > > If the EG is at 0.5 when triggered, you need to have roughly half as long > an attack phase, not one of the same duration with half the slope. > If you're talking about an RC circuit then it has a particular time-constant. So you can use setTargetAtTime() with the time-constant. This is basically the same as charging/discharging a capacitor... > The decay (and sustain) have to start sooner, because the decay phase is > triggered by the EG reaching its peak value. Again, timing is a > consequence of the slope, not the other way around. > > If you follow the WebAudio mantra of dynamically creating nodes as they're > needed there's less of a problem, because a dynamically created EG node > would always start at zero. However, doing so would make it difficult to > emulate the ADSR effects you get when an EG is repeatedly retriggered > without ever reaching its zero point. > > Ray > >
Received on Friday, 11 January 2013 20:48:18 UTC