- From: Paul Adenot <padenot@mozilla.com>
- Date: Mon, 11 May 2015 13:46:06 +0200
- To: Marc Breuer <marcgfx@gmail.com>
- Cc: "public-audio@w3.org Group" <public-audio@w3.org>
On Sat, May 9, 2015 at 2:39 PM, Marc Breuer <marcgfx@gmail.com> wrote: > I have an endlessly looping sample and would like to jump to different > positions within it to randomize the output. > > currently I believe this is what is expected for every jump: > I must stop the current AudioBufferSourceNode > I must create a new AudioBufferSourceNode and start at my desired position > > maybe there is a better approach? what I am doing seems rather > wasteful/complicated. AudioBufferSourceNode are cheap to create, this is the recommended approach. No copy happens when setting the buffer, for example. > I have the same issue for audio I need to pause/resume, as I cant find a way > to continue playing at a desired position. > > my current implementation for pause/resume is to simply turn volume to 0 and > back. I had implemented it setting/getting AudioContext.currentTime, but I > only just noticed that this property is readonly in the specs. > my jumping implementation fails badly and seems to stack up more and more > samples > I could post some code if desired, but decided against bloating the question You can now use suspend/resume for that. It's available on recent Firefox and Chrome (at least on canary/nightly builds, I'm not exactly sure when it's gonna be available in release). Also, this is probably not the right venue for such questions, please direct those to public-audio-dev [0] in the future. This mailing list is to discuss spec issues. Cheers, Paul. [0]: https://lists.w3.org/Archives/Public/public-audio-dev/
Received on Monday, 11 May 2015 11:47:00 UTC