使用 Chrome webkitAudioContext 开始播放加载的音频文件?
我正在使用 Chrome 网络音频 API 和 webkitAudioContext 来播放循环。我在几个循环之间进行交叉淡入淡出,类似于 Digital DJ 示例铬博客。
在他们的示例中,当循环到达循环末尾时,他们会切换样本,然后开始播放下一个加载的循环。我想立即开始新的循环并在其间进行交叉淡入淡出,但我还没有找到有关如何在中间开始播放新音频文件的示例,而不仅仅是从头开始播放。
我查看了 W3C Web Audio API 和 noteOn 参数您发送的只是与音频应开始播放时的上下文 currentTime 属性相关的时间编码。它总是从样本的开头开始播放。
是否有更多文档或我忽略了如何开始播放音频文件 2 秒的内容?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
AudioBufferSourceNode
的noteGrainOn
方法。该方法需要偏移量和持续时间。Try the
noteGrainOn
method of yourAudioBufferSourceNode
. That method takes an offset and a duration.