W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2011

Re: WebAudio feedback and suggestions

From: Chris Rogers <crogers@google.com>
Date: Wed, 16 Nov 2011 14:56:03 -0800
Message-ID: <CA+EzO0m3zw99TOGQPHhhBfrGb8oYA8TnHLPk0tuqoPHQSCbUkQ@mail.gmail.com>
To: Jonathan Baudanza <jon@jonb.org>
Cc: public-audio@w3.org
On Wed, Nov 16, 2011 at 2:11 PM, Jonathan Baudanza <jon@jonb.org> wrote:

> On Wed, Nov 16, 2011 at 1:24 PM, Chris Rogers <crogers@google.com> wrote:
>> Jonathan, thanks for the explanation.  I'm pretty sure I understand what
>> you mean here.  Ideally, we would never see this "unfortunate event" and
>> all events would be scheduled sufficiently in advance (at least ~100ms),
>> but your solution seems like the right approach if the event "misses"
>> because it is scheduled too close to "now".  It may be worth considering an
>> attribute which can control this behavior, so we can control how this works.
> Yes having callbackAtTime() available should significantly mitigate this
> "unfortunate event".  I imagine it will still happen when implementers
> naively use setTimeout or the thread is blocked by a window.alert or some
> long running loop.  The audio playback will glitch but it would be nice if
> the API recovered nicely.

There's always the chance that the callback will get called back late
because the main thread is busy doing something else (gc, page-rendering,
running other JS).  That's why it's important to make sure you don't try to
callback too "soon" into the future, or you'll risk getting the callback
late.  Luckily, for most sequencing applications  it's almost always
possible to schedule events at least 50ms or 100ms (or so) into the future
and avoid these kind of problems.  By the way, it's not really an audio
"glitch" that occurs if the callback is late, it's just that the event gets
handled late, resulting in a note playing a bit late, for example.

Received on Wednesday, 16 November 2011 22:56:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:49:57 UTC