Calling JUCE code from Web Audio API

We’re trying to incorporate Web Audio compatibility with our Effects library, for which JUCE is a dependency.

What is the best approach for extending these effects (which all inherit from a base class) in such a way that they can be wrapped into a Web Audio node?

Any guidance would be appreciated. Thank you.

1 Like

I am not a PRO so I don’t know the details.
But I like the ease of the web and am very interested in that.

I’ll throw some ideas out there.

  • Audio Worklet
    The process function of the Web Audio API’s AudioWorkletNode is very similar to JUCE’s processBlock.

A simple implementation could be done. However, I don’t think it’s the best way to incorporate compatibility. Besides, UI implementation needs to be considered separately.

  • WebAssembly
    It is a mechanism to execute C++ in a browser.
    I think it is very hard to implement, but I think it can maintain high compatibility. (I don’t know the details. Sorry)

Isn’t audioworklet requires secured connection?

I’ve asked a while about HTTPS which might be related -

AudioWorklet can only be used in safe contexts.
Since localhost is considered a safe contexts, AudioWorklet can be used.

Unless there is a special reason (e.g. library restrictions), it is not necessary to use https.

I was surprised!
It seems to be possible to exchange WASM (WebAssenbly) using the MessagePort in AudioWorklet.

source:

very nice example:

Is everything working well also on Safari?

Yes, safari is supported.
To check browser support, “Can I use” is widely known.

But there seems to be a known bug.

So if it’s not working in Safari, and it’s Apple, so there’s no ETA.
Also, as Safari is tightly coupled with the OS, meaning that I guess when it’ll be available it’ll be the minimum deployment target for it…

I’m sorry. I was mistaken. As far as I know, AudioWorklet works fine in Safari.

But if a bug does occur, which it most likely will…

Thanks, this is interesting.

What exactly is the bug?