Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of XMLHttpRequest() in piper.js #6

Open
guest271314 opened this issue Jul 13, 2024 · 8 comments
Open

Get rid of XMLHttpRequest() in piper.js #6

guest271314 opened this issue Jul 13, 2024 · 8 comments

Comments

@guest271314
Copy link

I've bundled onyx-runtimewe.js and piper.js, created a couple standalone versions for the browser, now I'm working on running the code in node, deno, bun, txiki.js. piper.js has multiple occurrences of XMLHttpRequest(). Get rid of them.

@guest271314
Copy link
Author

@k9p5 What is the source code of piper.js?

@guest271314
Copy link
Author

XMLHttpRequest() usage is not the only issue with piper.js.

There's also references to location.pathname that don't exist in a node environment.

We're going to need the source code for piper.js to proceed, compile to an actual .wasm file.

@k9p5
Copy link
Contributor

k9p5 commented Jul 13, 2024

Piper.js is the javascript emscripten output

@guest271314
Copy link
Author

Yes. What are the build steps is the question?

I think I found the origin of the build steps and your code here rhasspy/piper#352 (comment), then following links here ken107/piper-browser-extension#2 (comment), and here rhasspy/piper#504 (comment).

It would be very helpful to publish the source of your code, including the specific Emscripten build steps you used, and where you got the steps from here, so we don't have to search through issues, discussions, blame.

I'm getting all sorts of errors trying to reproduce the steps, for the purpose of compiling for 'shell' environment, so we don't get window and location.pathname references in the output.

@k9p5
Copy link
Contributor

k9p5 commented Jul 13, 2024

Here they are: https://github.com/diffusion-studio/piper-wasm

@guest271314
Copy link
Author

Those build steps throw errors here

fatal: could not create leading directories of '/wasm/modules/emsdk': Permission denied
./build.sh: line 4: cd: /wasm/modules/emsdk: No such file or directory
./build.sh: line 5: ./emsdk: No such file or directory
./build.sh: line 6: ./emsdk: No such file or directory
./build.sh: line 7: ./emsdk_env.sh: No such file or directory
sed: can't read ./upstream/emscripten/cache/sysroot/include/wchar.h: No such file or directory
fatal: could not create leading directories of '/wasm/modules/espeak-ng': Permission denied
./build.sh: line 13: cd: /wasm/modules/espeak-ng: No such file or directory
./build.sh: line 14: ./autogen.sh: No such file or directory
./build.sh: line 15: ./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
fatal: could not create leading directories of '/wasm/modules/piper-phonemize': Permission denied
./build.sh: line 20: cd: /wasm/modules/piper-phonemize: No such file or directory
./build.sh: line 21: emmake: command not found
./build.sh: line 22: emmake: command not found
sed: can't read /wasm/modules/piper-phonemize/build/e/src/espeak_ng_external-build/CMakeFiles/Makefile2: No such file or directory
sed: can't read /wasm/modules/piper-phonemize/build/e/src/espeak_ng_external/src/speechPlayer/src/speechWaveGenerator.cpp: No such file or directory
./build.sh: line 25: emmake: command not found

@guest271314
Copy link
Author

I think I've manually gotten rid of XMLHttpRequest() in piper.js. Now the issue is onyxruntime-web and onyxruntime-node

bun install onxyruntime-node 
bun build node_modules/onnxruntime-node/dist/index.js --outfile=ort-bundle.js
error: Uncaught (in promise) Error: no available backend found. ERR: [wasm] NotSupported: Classic workers are not supported., [cpu] Error: previous call to 'initWasm()' failed.
    at Jr (file:///home/user/vits-web-extension/onyx-runtimeweb.js:357:1724)

@guest271314
Copy link
Author

This is going to take some work. I'm in to onyxruntime-web and onyxruntime-node now.

node --experimental-default-type=module index.js

Error: no available backend found. ERR: [wasm] TypeError: Worker is not a constructor, [cpu] Error: previous call to 'initWasm()' failed.
    at Jr (file:///home/user/vits-web-extension/onyx-runtimeweb.js:357:1724)
    at async u.create (file:///home/user/vits-web-extension/onyx-runtimeweb.js:357:17987)
    at async tts (file:///home/user/vits-web-extension/index.js:103:19)
    at async file:///home/user/vits-web-extension/index.js:195:18

Node.js v23.0.0-nightly2024070366b76e24e2

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

No branches or pull requests

2 participants