Web-audio-api: AudioWorkletProcessor : How to load external WASM related files

Created on 18 Jan 2018  路  1Comment  路  Source: WebAudio/web-audio-api

Hi there,

I am having trouble loading WASM related urls into my browser from inside my AudioWorkletProcessor. js file.

I have been working with the AudioWorkletProcessor and started by getting WASM working in the main webapp thread. I then got an example of a javascript AudioWorkletProcessor working :
https://github.com/madChopsCoderAu/WASMAudio/blob/master/webApp/AudioProcessor.js

I then wanted to inject WASM into the AudioWorkletProcessor module at this point :
https://github.com/madChopsCoderAu/WASMAudio/blob/cc26b1f0c617d196ef4f1c61572c8fd2c3937e94/webApp/AudioProcessor.js#L28

However I have not found a way to load any sort of file containing either WASM nor js into my AudioWorkletProcessor module.

I was hoping that I would be able to load an emscripten generated js file which loads my WASM file appropriately.

I gave up on that and am now looking for a way to actually load anything ! But can't work it out. Is the sourcing of urls forbidden ? Do we need to paste WASM data directly into the AudioWorkletProcessor js module ?

I have tried to find all sorts of javascript style file loading mechanisms, but can't from inside the WorkletProcessor.

When I look at how faust has done it, I notice strings of WASM in their js files ... this approach (whilst it may work) does seem a little cumbersome for nice system design!
https://github.com/grame-cncm/faust/blob/2f6e1c1d26b58c563c701cf0d488b4e6db21ba66/architecture/webaudio/webaudio-workletprocessor-poly-standalone-wrapper.js#L9

thanks
Matt

>All comments

Is the WebAudio spec wrong? (Using WASM with AudioWorklets is outside the scope of the spec.)

If it's a general usage issue, you should ask on other forums like stack overflow.

Was this page helpful?
0 / 5 - 0 ratings