- From: Jonathan Baudanza <jon@jonb.org>
- Date: Wed, 16 Nov 2011 13:56:39 -0800
- To: public-audio@w3.org
- Message-ID: <CAP26MZvoqRhTG3pZupo+tq2dd6yAC3Cn6q+aE5QotqFi_D0fjw@mail.gmail.com>
On Wed, Nov 16, 2011 at 1:43 PM, Robert O'Callahan <robert@ocallahan.org>wrote: > > The callback function will still run on the JS main thread, right? (It > needs to, to touch the AudioNode objects.) So you'll still glitch when the > main thread is running some other script (or doing something else) at that > exact moment. > > In ProcessedMediaStream I solved this problem by having the addInput > method take a time parameter (relative to the progress of the output > stream, sample-accurate) at which the input stream becomes enabled and > unblocks. > > I'm not familiar with ProcessedMediaStream, but it sounds like addInput() performs the same function as noteOn(when) on AudioBufferSourceNode. Scheduling sample accurate playback isn't a problem with the WebAudio spec. The problem is "scheduling the scheduling" of the playback. For some applications you may be able to do all the scheduling upfront. If you're scheduling sounds based on some real time interaction with the user (music for example), it's not so simple. This is where context.callbackAtTime comes in.
Received on Wednesday, 16 November 2011 21:57:07 UTC