In the for loop instead of var i = 0 you can use let i = 0 or i would always be equal to the latest.
Oh I got it!!! Sorry…my JS is self-taught…I understand now the “let” usage…LOL
Actually let i doesn’t do the trick.
let thenote does.
You are kind of combining the old with the new in a way not intended. Think you can scrap all that timer stuff. That 0 in the queueWaveTable
does the scheduling for you natively in WebAudio, which is way more accurate since it runs in its own thread, not the UI thread, which is only run 60 times a second.
Replace it with audioContext.currentTime + futureSeconds
, instead of 0, like I think you originally had it. You can just run through all your notes. If you wish to stop, you can then call player.cancelQueue(audioContext)
.
Thanks!
Now the version is up at www.findbach.com/betax1
Major issue is: the laptop/computer can generate the WebAudioFont sound just fine, but the iPad and iPhones aren’t making any sound. Is there a method to deal with loading the WebAudioFont on mobile devices?
L