shorepine / amy

AMY - the Additive Music synthesizer librarY

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting "attempting to access detached ArrayBuffer" after a couple dozens of notes played

davay42 opened this issue · comments

commented

Hi! I'm trying out AMY as a synth for my music learning platform. I successfully fitted the wasm into my Vue setup, but there appears some weird glitch. After playing somewhere more that 20 notes the sound stops and I got this error:

Uncaught TypeError: attempting to access detached ArrayBuffer
    audioCallback amy.vue:56
    onaudioprocess amy.vue:89
    setupAudio amy.vue:88
    startAudio amy.vue:124
    piano_down amy.vue:144
    setup amy.vue:155
    listener index.mjs:241

Tested in Firefox and Chrome. You can try it here:

https://chromatone.center/practice/experiments/amy/

The code is a slight modification of the example www/amy.js code in a Vue 3 component. Check it here:

https://github.com/chromatone/chromatone.center/blob/master/content/practice/experiments/amy/amy.vue

I'm a JS dev and have little experience with wasm stuff so I just don't know how to debug this further. Any ideas? May this be helpful?

commented

Yeah, dug a bit more ant it happens that this error is easily avoided by adding a check for the heap length as suggested in the mentioned issue

  callback = function audioCallback(l) {
    // lazy loading of the audio buffer we use to talk to c++/emscripten
    if (dataHeap == null ||      dataHeap.length == 0      ) {
      data = new Float32Array(l.length);