Web audio API: noteOn after noteOff not working?

I wrote a simple web application using the web audio API, but I noticed that when I noteOn(0) command for a given source, and then noteOff(0) , and then finally with another noteOn(0) command, the sound turns on, turns off (as expected), but then does not turn on with the third command.

Is there something I'm doing wrong? It is so simple, I can show you the code, but I feel it is superfluous. Perhaps I need to reassign the buffer for the source after noteOff , but I cannot imagine how it should have been used.

+6
source share
3 answers

AudioBufferSourceNode can only be played once.

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

+7
source

Read here: http://www.html5rocks.com/en/tutorials/webaudio/intro/ , and specifically here: http://www.html5rocks.com/en/tutorials/webaudio/intro/js/volume-sample. js , this is like flushing the source / buffer after noteOff is the way to go. I switched it and everything works fine.

+2
source

Working example code using .disconnect () with a generator

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

+1
source

Source: https://habr.com/ru/post/919549/


All Articles