Skip to content

Switch from faust2webaudio to faustwasm - #72

Merged
sletz merged 7 commits into
grame-cncm:masterfrom
ijc8:master
Jan 17, 2024
Merged

Switch from faust2webaudio to faustwasm#72
sletz merged 7 commits into
grame-cncm:masterfrom
ijc8:master

Conversation

@ijc8

@ijc8 ijc8 commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@ijc8

ijc8 commented Jun 12, 2023

Copy link
Copy Markdown
Contributor Author

Open question: what's depending on the assignments to window.faust and window.faustEnv?

@sletz

sletz commented Jun 13, 2023

Copy link
Copy Markdown
Member

@Fr0stbyteR may have an idea?

@Fr0stbyteR

Copy link
Copy Markdown
Contributor

Thank you @ijc8 for the work! For further development you can check this branch of mine https://github.com/Fr0stbyteR/fausteditorweb/tree/migrate-faustwasm that has used faustwasm for a while, or maybe you already know that.
Regarding the assignments to the global scope, they are purely for debugging purposes. It might be good to put everything inside faustEnv I think.

@sletz

sletz commented Jul 5, 2023

Copy link
Copy Markdown
Member

Thanks. After fixing the conflict I could test:

  • SVG rendering is broken: the root level properly displays, but then clicking on the blue boxes should go inside the boxes hierarchy, but does not work anymore, with this error:
e2ae41c9-08f8-401e-be53-28351d42c742:8 Uncaught ErrnoError {node: undefined, errno: 44, code: 'ENOENT', message: 'No such file or directory', setErrno: ƒ, …}code: "ENOENT"errno: 44message: "No such file or directory"node: undefinedsetErrno: ƒ (errno)stack: "Error\n    at new ErrnoError (blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:70853)\n    at Object.open (blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:63988)\n    at Object.readFile (blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:67731)\n    at SVGAElement.<anonymous> (http://127.0.0.1:8000/dist/index.js:51984:38)\n    at HTMLDivElement.dispatch (http://127.0.0.1:8000/dist/index.js:26303:27)\n    at elemData.handle (http://127.0.0.1:8000/dist/index.js:26107:28)"[[Prototype]]: Error
    at Object.ensureErrnoError (blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:70947)
    at Object.staticInit (blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:71153)
    at blob:http://127.0.0.1:8000/e2ae41c9-08f8-401e-be53-28351d42c742:8:163145
    at instantiateFaustModuleFromFile (http://127.0.0.1:8000/dist/index.js:46917:29)
open @ e2ae41c9-08f8-401e-be53-28351d42c742:8
readFile @ e2ae41c9-08f8-401e-be53-28351d42c742:8
(anonymous) @ index.js:51984
dispatch @ index.js:26303
elemData.handle @ index.js:26107

@ijc8

ijc8 commented Jul 19, 2023

Copy link
Copy Markdown
Contributor Author

(Context: @sletz observed some mysterious errors when trying this PR with messages like emsc, table index is out of bounds, memory index out of bounds.)

@sletz Per your observations, I tried opening 10 .dsp files in Firefox and Chrome, switching between them and compiling, refreshing, checking & unchecking "Use AudioWorklet" and "Save DSP Code", enabling/disabling polyphony, etc., and none of this reproduced the issue.

However, I was finally able to reproduce by trying to compile greyhole.dsp. This reliably generates these errors even without any other files loaded or options checked.

This also causes issues (hanging tab) with the updated fausteditor and faustplayground, so I don't think it's an issue with faustide (or this PR) specifically.

I believe that it's instead the same issue as grame-cncm/faustwasm#3, and I suspect that it's a memory issue. Both greyhole and jpverb (used in grame-cncm/faustwasm#3) are long reverbs with big delay lines (indeed, the SuperCollider docs for these effects include the note "Please increase server realtime memory for this to work properly"), and this explanation aligns with the error messages you've seen.

The fix will likely involve tweaking memory-related flags passed to emscripten (in https://github.com/grame-cncm/faust/blob/df02f97f7d0c4fb67fa7a7949dabcc58b199775f/build/wasmglue/CMakeLists.txt#L56) and updating faustwasm with a new build.

@sletz

sletz commented Jul 19, 2023

Copy link
Copy Markdown
Member

I don't think this is related to the memory consumed by the DSP code itself (that is after being compiled and instantiated), but the Faust => wasm compilation process itself.
I'll have a look ASAP.

ijc8 added a commit to ijc8/faust that referenced this pull request Jul 20, 2023
Emscripten default stack size was reduced from 5Mb to 64Kb, causing
problems when compiling some programs with faustwasm.

See:
- emscripten-core/emscripten@157fcd4
- grame-cncm/faustwasm#3
- grame-cncm/faustide#72
ijc8 added a commit to ijc8/faust that referenced this pull request Jul 20, 2023
Emscripten default stack size was reduced from 5Mb to 64Kb, causing
problems when compiling some programs with faustwasm.

See:
- emscripten-core/emscripten@157fcd4
- grame-cncm/faustwasm#3
- grame-cncm/faustide#72
@sletz

sletz commented Jul 21, 2023

Copy link
Copy Markdown
Member

Are conflicts difficult to solve ?

@sletz
sletz merged commit 5d1c540 into grame-cncm:master Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants