Вопрос

I'm working with the Chrome web audio API and webkitAudioContext to play loops. I have several loops that I'm crossfading in between similar to the Digital DJ example on chromium blog.

In their example they are switching the samples when the loop hits the end of a cycle and then they start playing the next loaded loop. I want to start the new loop instantly and crossfade in between but I have yet to find an example on how to start play a new audio file in the middle and not only from start.

I've looked through the W3C Web Audio API and the noteOn parameter you send in is only a time coded related to the context currentTime attribute when the audio should start playing. It always start playing from the beginning of the sample.

Is there more documentation or something I have overlooked how to start playing an audio file 2seconds in to it?

Это было полезно?

Решение

Try the noteGrainOn method of your AudioBufferSourceNode. That method takes an offset and a duration.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top