Demo: JUCE runs inside the browser via Emscripten and Javascript


#1

Hello everyone,

this weekend I had a few hours to spare and I wanted to see, if it's possible to get JUCE running inside the browser.
But have a look for yourself: Demo (~1MB javascript), source code and instructions on GitHub.

In case you haven't heard about it, there's a wonderful project called Emscripten that compiles C++ => LLVM IR => javascript. Using that and providing javascript specific implementations of a few JUCE-classes (mainly ComponentPeer) I was able to get a basic GUI application to compile and run.

This is by no means a complete port of the JUCE framework, but merely a proof of concept. That being said, the basics work surprisingly well. Drawing performance looks promising (even though, I've gone the easy route by using the LowLevelGraphicsSoftwareRenderer).

Getting Audio to work via the Web Audio API or via Emscriptens OpenAL wrapper seems entirely possible. OpenGL should also be doable.

let me hear, what you think
-- Benjamin


#2

Wow, I had been meaning to try that myself. Great work!


#3

Awesome! We saw a talk from the Emscripten guys at CppCon and I was pretty impressed by the hackery/cleverness to get this working. Really impressed you got it to work in a weekend.

Having JUCE apps running in a browser without all the difficult plugin downloads is a huge step forward!


#4

A few hours?!?! What the heck! Makes me think I should stop coding and crawl back into my guitar case.


#5

Please don't! Bear in mind, that JUCE already runs a lot of platforms, including Android. I was able to look up how it was done on other platforms. Also it's just slapped together. If one would do this propperly, I'd guess, that would take a little more time…


#6

Awesome! Thanks for sharing, Benjamin! I salute you, Sir.

Demonstrating Juce applications in the browser was my first thought when I discovered Emscripten a while back.


#7

Pull request and patches are always welcome :)


#8

FANTASTIC!  


#9

Very impressive! I'm guessing it can use the Web Audio API to process incoming audio?


#10

No, not yet. As I said, it's a proof of concept. Unfortunately, I don't have the time to pursue this endeavour further right now. But I'd love to! 


#11

Jules,
Any more thought given to this?


#12

Would love to spend more time playing with web stuff but just haven’t had the time - we’ll try to find a way to investigate further soon!


#13

Keep us posted. Perhaps Native Client would be an easier first step (NaCl).


#14

after beschulz pointed the way with his awesome Emscripten demo,
I would sooo love Juce to offer webassembly support out of the box.

What do you think, Jules & Team? Could it be fast enough for real-time audio synthesis?

for example, it’s incredible how fast this game loads and how smooth it runs, even on my phone.
Source hn