- From: Chris Wilson <cwilso@google.com>
- Date: Tue, 27 May 2014 13:44:23 -0700
- To: Arnau Julia <Arnau.Julia@ircam.fr>
- Cc: Joseph Berkovitz <joe@noteflight.com>, "public-audio-dev@w3.org" <public-audio-dev@w3.org>
- Message-ID: <CAJK2wqX1S2g68D4KuN5HOWikgXvjqGbXCGkM+NqGv15fC=VVLw@mail.gmail.com>
We need to be more precise about currentTime updating in blocks, because it is a bit unclear. But yes, Joe's answer is the right one (keeping in mind you should be sure to be scheduling ahead a bit, as this example does). On Tue, May 27, 2014 at 8:29 AM, Arnau Julia <Arnau.Julia@ircam.fr> wrote: > Hi Joseph, > > Thanks for your answer. I really know how to start two sources at specific > time. It is more that I would like to know how it works because I didn't > find nothing about that in the specification. :-) > > Thank you, > > Arnau > > On 27 mai 2014, at 17:17, Joseph Berkovitz <joe@noteflight.com> wrote: > > Hi Julia, > > Setting aside the part of your post that relates to the rate at which > currentTime is updated, I wanted to note that it is easy to start two > sources at a specific time: > > On May 27, 2014, at 10:06 AM, Arnau Julia <Arnau.Julia@ircam.fr> wrote: > > Therefore, as I understand, if I want to start two sources at a specific > time I can't do something like this, > > function start(){ > source1.start(audioContext.currentTime+1); > source2.start(audioContext.currentTime+1); > } > > because it's not possible to guarantee that the currentTime for these two > instructions will be the same. > > > > You could, however, do this, if you wanted to be completely sure: > > function start(){ > var t = audioContext.currentTime+1; > source1.start(t); > source2.start(t); > } > > Overall I don’t think it is a good idea (even if it were possible) to rely > on sample-accurate ("a-rate") updates of the currentTime clock in the main > thread, because there is always some unpredictability in the thread’s > timing, and it’s likely to be large relative to the duration of a sample > frame. The main browser thread can yield CPU time to other interrupt-driven > processes (including things outside the browser) at some point between > acquiring currentTime’s value and employing that value for scheduling > purposes. > > . . . . . ...Joe > > *Joe Berkovitz* > President > > *Noteflight LLC* > Boston, Mass. > phone: +1 978 314 6271 > www.noteflight.com > "Your music, everywhere" > > >
Received on Tuesday, 27 May 2014 20:44:53 UTC