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

WebGL support #20

Open
Macoron opened this issue Apr 29, 2023 · 4 comments
Open

WebGL support #20

Macoron opened this issue Apr 29, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Macoron
Copy link
Owner

Macoron commented Apr 29, 2023

Whisper.cpp supports webasm and even has some online demos running into browser.

I didn't research that, but it seems that Unity support native C++ plugins for WebGL builds. So in theory, you can use cmake to compile whisper.cpp into .bc and embed it into web unity build.

Also Unity doesn't support microphone input for WebGL out of the box and you need third-party plugin to record anything.

@Macoron Macoron added the enhancement New feature or request label Apr 29, 2023
@Macoron
Copy link
Owner Author

Macoron commented Jun 25, 2023

Did some tests today. Here is rough list of tasks that need to be done:

  • Unity doesn't support C# multithreading. Whisper blocks main unity thread and app hangs until inference complete. The good news: Unity 2022.2+ supports C++ multithreading. If I add parallel job creation in whisper.cpp code - this should work.
  • Bump Unity project to 2022 LTS
  • Inference time is very slow comparing with official whisper.cpp demo. Unity transcribe "jfk.wav" for 15 seconds, while official demo works for 3 seconds. Researching this.
  • No microphone support. Need to look for some MIT license compatible microphone library for Unity.

If you want to play around with it, check webgl branch.

@Bodekaer
Copy link

Bodekaer commented May 12, 2024

Hi @Macoron, any updates on webgl support. Did you get it running?

@Macoron
Copy link
Owner Author

Macoron commented May 13, 2024

Not much, biggest blocker is that Unity doesn't support C# multithreading. But you can checkout webgl branch. It's a bit outdated, but still working.

@D4N005H
Copy link

D4N005H commented May 14, 2024

Not much, biggest blocker is that Unity doesn't support C# multithreading. But you can checkout webgl branch. It's a bit outdated, but still working.

Based on this source, Async/Await is possible for WebGL with this addon: https://github.com/Cysharp/UniTask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants