문제

I wrote a simple web app using the Web Audio API, but I've noticed that when I issue a noteOn(0) command to a given source, followed by a noteOff(0), and then finally by another noteOn(0) command, the sound will turn on, turn off (as expected) but then won't turn on with the third command.

Is there something that I'm doing wrong? It's as simple as that, I can show you code but I feel it's redundant. Perhaps I need to reassign the buffer to the source after the noteOff, but I can't imagine that's how it was intended to be used.

도움이 되었습니까?

해결책

AudioBufferSourceNode can only be played once.

http://youtu.be/hFsCG7v9Y4c?t=18m22s

다른 팁

Reading here: http://www.html5rocks.com/en/tutorials/webaudio/intro/, and specifically here: http://www.html5rocks.com/en/tutorials/webaudio/intro/js/volume-sample.js, it looks like resetting the source/buffer after noteOff is the way to go. I switched that up and things are working great.

Working example code using .disconnect() with oscillator

http://en.wikiaudio.org/Web_Audio_API:Toggle_oscillator_on_and_off

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top