vosk-browser icon indicating copy to clipboard operation
vosk-browser copied to clipboard

Google STT extention using VOSK

Open imanallahverdi opened this issue 5 months ago • 9 comments

I am building a Google extension to convert speech to text (STT). According to the research I have done, I should have the web assembly file (WASM). But I couldn't find it anywhere. Is the path I am taking correct or is this file not needed and am I taking the wrong path?

imanallahverdi avatar Jul 22 '25 14:07 imanallahverdi

Are you trying to build from source or just importing the package?

Yes, you'll need WASM. But if you are importing it should already be included. I can't remember if it is inlined into the bundle or a separate file, but there was no extra step for me besides just importing vosk-web and calling its APIs.

If you are building from source, then that's a little different.

If you're hitting a problem, maybe useful to elaborate on what isn't working.

erikh2000 avatar Jul 22 '25 17:07 erikh2000

Hi Erik, I want to create a Speech-to-text extension that includes the Vosk model and works completely offline. As I understand it, I need manifest.json and vosk.js files, the Vosk model, the Vosk.wasm file, and a JavaScript file. This extension is not going to connect to a server using an API and receive services, and I want everything to be inside itself and work completely offline. I would appreciate if you have any experience and could help me.

Are you trying to build from source or just importing the package?

Yes, you'll need WASM. But if you are importing it should already be included. I can't remember if it is inlined into the bundle or a separate file, but there was no extra step for me besides just importing vosk-web and calling its APIs.

If you are building from source, then that's a little different.

If you're hitting a problem, maybe useful to elaborate on what isn't working.

imanallahverdi avatar Jul 22 '25 18:07 imanallahverdi

It should be possible, but what is the obstacle you are stuck on?

erikh2000 avatar Jul 22 '25 23:07 erikh2000

It should be possible, but what is the obstacle you are stuck on?

As I said, I need the web assembly (WASM) file, which I can't find anywhere. I also want to use the vosk-wasm-builder (https://github.com/users/ccoreilly/packages/container/vosk-wasm-builder/72625911?tag=0.0.7), but it still won't create the file.

imanallahverdi avatar Jul 23 '25 05:07 imanallahverdi

I probably can't help you with the WASM file, due to time constraints, business travel, being away from computer

But are you sure you need the WASM file? What happens if you just import "vosk-web" in your project source and call the APIs?

That is all I do. Although the code does need to be able to fetch models from a web-served location as well.

Calling out that I'm not a maintainer to avoid misunderstanding.

erikh2000 avatar Jul 23 '25 16:07 erikh2000

Also, I can't confirm myself now, but often the WASM file is in-lined into the JS file by the bundler. If you find the "vosk-web" folder under node_modules, check the entrypoint in package.json (index.js or something), then open the entrypoint source and search for WASM code, you can learn if the WASM is inlined.

If it is inlined, you'd likely need to modify the build process to get a separate WASM file.

erikh2000 avatar Jul 23 '25 17:07 erikh2000

chrome-extension.zip

Also, I can't confirm myself now, but often the WASM file is in-lined into the JS file by the bundler. If you find the "vosk-web" folder under node_modules, check the entrypoint in package.json (index.js or something), then open the entrypoint source and search for WASM code, you can learn if the WASM is inlined.

If it is inlined, you'd likely need to modify the build process to get a separate WASM file.

this package is all thing that i have plus a model.tar.gz file that is vosk small model. You have given me a lot of guidance so far and I told Chat GPT about your guidance regarding the web assembly file and he checked that this operation is done inside the package.json file. So far I have reached this package and I have this error in Chrome.

Image

imanallahverdi avatar Jul 24 '25 07:07 imanallahverdi

Ah, I'm ignorant here - no experience developing extensions. It looks maybe like a permissions issue with the browser in executing WASM. But I have little insight.

erikh2000 avatar Jul 24 '25 13:07 erikh2000

Ah, I'm ignorant here - no experience developing extensions. It looks maybe like a permissions issue with the browser in executing WASM. But I have little insight.

Thank you for your kindness Erik

imanallahverdi avatar Jul 24 '25 15:07 imanallahverdi