Code Monkey home page Code Monkey logo

Comments (23)

mayitayew avatar mayitayew commented on June 9, 2024 8

This fork of Lyra supports a WebAssembly build. Here is a demo of Lyra running on the web based on that.

from lyra.

sile avatar sile commented on June 9, 2024 4

Just FYI, but I released a WebAssembly build of Lyra: https://github.com/shiguredo/lyra-wasm
(Note that descriptions are written in Japanese)

During the development, it turned out Lyra can be built into WebAssembly without any patches.
Visit https://github.com/shiguredo/lyra-wasm/tree/develop/wasm for the detail.

Lastly, thank you for developing and publishing this great audio codec library!

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024 2

@josephrocca - Sure things. My rough idea is to use macro to exclude out all glog module and see if there is anything else would break the compilation. If you wanna work together, it will be fantastic. I have a workable bazel config for compiling everything to wasm target.

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024 2
#ifdef __EMSCRIPTEN__
#include <iostream>
#define LOG(STATUS) std::cout << STATUS << ": "
#define VLOG(STATUS) std::cout << STATUS << ": "
#define ERROR "error"
#define INFO "info"
#define WARNING "warning"
#define FATAL "fatal"
#endif

For MVP, I think we could add some code like this to replace log with plain cout.
I believe this will work and will test it out later today.

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024 2

@josephrocca - Humm, that's sound like a good way of workaround, I will try to implement it this weekend.

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024 2

Thanks for creating and sharing that @sile! I've linked to your repo from here: https://github.com/josephrocca/lyra-v2-soundstream-web That was my in-progress attempt to get LyraV2 working with TFjs-TFLite and ONNX Runtime Web, but looks like I can stop pushing on that now that you've released your Emscripten port! ❤️

from lyra.

mchinen avatar mchinen commented on June 9, 2024 2

This is very cool, thanks for sharing @sile. It's great to have a Lyra V2 wasm support with a demo.

from lyra.

aluebs avatar aluebs commented on June 9, 2024 1

That is a great idea!

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024 1

After brief research, I think the glog will block the wasm export.
Since glog does not support exporting for WASM target.

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024 1

@WenheLI @aluebs Is there any way I can help to get a proof-of-concept wasm build working? I unfortunately don't have much experience with Bazel since I come from the web side of things, but I'm happy to learn as much as is needed to help here. Given the aformentioned glog obstacle, can I ask what the high-level steps are likely to be to get a wasm build working?

from lyra.

aluebs avatar aluebs commented on June 9, 2024 1

Contributions are always welcomed. And having a wasm Lyra target would be fantastic! :)

from lyra.

aluebs avatar aluebs commented on June 9, 2024

Thank you @WenheLI for looking into it.
And hopefully we can find a workaround.

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024

@aluebs - Thanks. Just wondering if the glog / logging matters in production?
One simple workaround would be to use some macros to protect it (and even replace glog with some wasm compatible logging) while building for wasm.
And I think let the glog support wasm would be a quite large scope and may not be feasible.

from lyra.

aluebs avatar aluebs commented on June 9, 2024

The logging level for production is something that should be left to the owners of the project that integrates Lyra. But it would be fantastic to use macros to differentiate a wasm build (using compatible logging) from a non-wasm build (using glog).

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024

@WenheLI Sounds great! 🎉 Please do let me know how the test went and how I can be helpful here.

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024

I think we should still need to deal with glog since other deps are still using it which will block our compilation.

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024

@WenheLI Hmm. Is it possible/feasible with C++/Bazel to do a sort of "rewrite" of package resolution/import at the top level Bazel config file (for the wasm build) such that it all sub-packages and external packages see a fake/dummy version of glog which proxies all function calls to a no-op (at least for MVP)? In JS I'd just import a dummy module that uses a Proxy, but I have no idea if this sort of thing is possible with C++/Bazel.

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024

@WenheLI Any luck with this? If you don't have time, would you be able to share your changes in a github fork? I can pick up the reigns and see if I can make some progress :)

from lyra.

WenheLI avatar WenheLI commented on June 9, 2024

@josephrocca - Hi, Joe. Sorry it is kinda busy recently. I will definitely share a fork with you so that we could work together. Just give me a couple of days to organize the code!

from lyra.

josephrocca avatar josephrocca commented on June 9, 2024

@WenheLI No problem! :)

from lyra.

RavikumarTulugu avatar RavikumarTulugu commented on June 9, 2024

Hi, we are interested in trying this out, pls let me know if any thing is available to build up on. The issue is not updated since june. Thanks

from lyra.

mttjcksn avatar mttjcksn commented on June 9, 2024

Hi there, we are also interested in a wasm build, especially for the encoder part. Any update would be appreciated :)

from lyra.

aluebs avatar aluebs commented on June 9, 2024

This is amazing! Thank you, @mayitayew, for putting this together :)

from lyra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.