Re: How to play back synthesized 22kHz audio in a glitch-free manner?

On Tue, Jun 18, 2013 at 11:04 AM, Jer Noble <jer.noble@apple.com> wrote:

>
> On Jun 18, 2013, at 10:24 AM, Chris Rogers <crogers@google.com> wrote:
>
>
>
>
> On Tue, Jun 18, 2013 at 8:55 AM, Jer Noble <jer.noble@apple.com> wrote:
>
>>
>> On Jun 18, 2013, at 6:55 AM, Joe Berkovitz <joe@noteflight.com> wrote:
>>
>> Actually, as co-editor of the use case document I am very interested in
>> understanding why the arbitrary concatenation of buffers is important. When
>> would this technique be used by a game? Is this for stitching together
>> prerecorded backgrounds?
>>
>>
>> Here's a good example of such a use case:
>> http://labs.echonest.com/Uploader/index.html
>>
>> The WebAudio app slices an uploaded piece of music into discrete chunks,
>> calculates paths between similar chunks, and "stitches" together an
>> inifintely long rendidion of the song by jumping in the timeline between
>> similar chunks.
>>
>> This app is currently implements its queueing model by calling
>> setTimeout(n), where n is 10ms before the anticipated end time of the
>> current sample. However, this causes stuttering and gaps whenever the timer
>> is late by more than 10ms. WebKit Nightlies implement JavaScript timer
>> coalescing when pages are not visible, which has lead the Infinite Jukebox
>> page to pause playback when it gets a 'visibilitychange'/'hidden' event.
>>
>
> A lookahead scheduling of 10ms is a bit optimistic.  Chris Wilson has
> written an excellent article about this topic:
> http://www.html5rocks.com/en/tutorials/audio/scheduling/
>
>
>
> Even so, timer coalescing can delay timers by very large amounts (perhaps
> even 1000ms!) so even some of the techniques Chris mentions in that article
> will fail unless very large lookahead queues are built up.
>

We have a tremendous amount of experience in the field over a couple of
years with developers using this technique - and it works very well.  That
said, there are definitely issues with timers being throttled on background
tabs.  At one point, we discussed a method context.callbackAtTime(when),
which would not have this problem.  Also, with the new ondone event for
AudioBufferSource, it would effectively be possible to "queue up" two
chunks, and then queue an additional chunk each time an ondone is received.

Received on Tuesday, 18 June 2013 19:00:35 UTC