Csound Csound-dev Csound-tekno Search About

[Csnd-dev] AudioWorklet

Date2018-03-31 11:24
FromMichael Gogins
Subject[Csnd-dev] AudioWorklet
I see you have not touched your project on Csound as an AudioWorklet for a while. I also see that AudioWorklets are now on by default in Chrome 66. And I reviewed your discussion in the Web Audio issues.

What's the current status here? Is it now possible to transfer WASM into the audio rendering thread? Is anyone actively working on this?

Best, 
Mike

Date2018-03-31 18:36
FromSteven Yi
SubjectRe: [Csnd-dev] AudioWorklet
I haven't had a chance to resume work on this, but had planned to do
so in the next week.  I stopped at the time as AudioWorklet was
unstable (breaking with different canary releases) and MessagePort had
not been implemented. Since then, Spectre changes have also disabled
ShareArrayBuffer from most browsers, removing some design
possibilities.  It seems to me that things have stabilized now with
AudioWorklet.

Last I left it, I followed the work of the Faust folks and base64
encoded the .wasm file and embedded it into JS.  This large string
then gets decoded at runtime and set as the binary for the WASM module
loader.  This works and, I think, is still the technique being used by
Faust and by the WebAudioModules folks.  The script for that is at:

https://github.com/kunstmusik/csound-audioworklet/blob/master/convert.sh

(I think Hlodver may also be using this technique to create his single
.js Csound include. )

Checking the WASM loaded was about as far as I got. The worklet node
and other things for AudioWorklet remains empty and needs to be
implemented, and CsoundObj needs to be updated to make whether
AudioWorklet or ScriptProcessor node is used transparent.

On Sat, Mar 31, 2018 at 6:24 AM, Michael Gogins
 wrote:
> I see you have not touched your project on Csound as an AudioWorklet for a
> while. I also see that AudioWorklets are now on by default in Chrome 66. And
> I reviewed your discussion in the Web Audio issues.
>
> What's the current status here? Is it now possible to transfer WASM into the
> audio rendering thread? Is anyone actively working on this?
>
> Best,

Date2018-03-31 18:54
FromMichael Gogins
SubjectRe: [Csnd-dev] AudioWorklet
Thanks for the update. 

I am planning to do something this in the WebAssembly build of csound-extended. I suppose to expose the Csound API this way means treating all member methods as asynchronous and having them send messages over the port to the AudioWorkletProcessor that does the real work, at least when a return value is not needed.  That's simple enough. But this base64 stuff looks hackish.

Best, 
Mike

On Sat, Mar 31, 2018, 14:36 Steven Yi <stevenyi@gmail.com> wrote:
I haven't had a chance to resume work on this, but had planned to do
so in the next week.  I stopped at the time as AudioWorklet was
unstable (breaking with different canary releases) and MessagePort had
not been implemented. Since then, Spectre changes have also disabled
ShareArrayBuffer from most browsers, removing some design
possibilities.  It seems to me that things have stabilized now with
AudioWorklet.

Last I left it, I followed the work of the Faust folks and base64
encoded the .wasm file and embedded it into JS.  This large string
then gets decoded at runtime and set as the binary for the WASM module
loader.  This works and, I think, is still the technique being used by
Faust and by the WebAudioModules folks.  The script for that is at:

https://github.com/kunstmusik/csound-audioworklet/blob/master/convert.sh

(I think Hlodver may also be using this technique to create his single
.js Csound include. )

Checking the WASM loaded was about as far as I got. The worklet node
and other things for AudioWorklet remains empty and needs to be
implemented, and CsoundObj needs to be updated to make whether
AudioWorklet or ScriptProcessor node is used transparent.

On Sat, Mar 31, 2018 at 6:24 AM, Michael Gogins
<michael.gogins@gmail.com> wrote:
> I see you have not touched your project on Csound as an AudioWorklet for a
> while. I also see that AudioWorklets are now on by default in Chrome 66. And
> I reviewed your discussion in the Web Audio issues.
>
> What's the current status here? Is it now possible to transfer WASM into the
> audio rendering thread? Is anyone actively working on this?
>
> Best,
> Mike