[webkit-dev] Using JavaScriptCore in an audio context

Stéphane Letz letz at grame.fr
Tue Sep 22 11:20:27 PDT 2015


> Doesn't matter what shape the code is. Parsing and compiling code requires memory allocation. JSC will parse and compile the code lazily, so we will continue to allocate memory after the code has already started executing. 

OK, but our code already has a similar issue when deployed in a WebAudio API ScriptProcessor node (and that should probably be similar when any kind on "dynamically created" ScriptProcessor is done). We hear a few audio glitches until the code is "warm" I guess (compiled with FTL maybe?). You can test here :

http://faust.grame.fr/webaudio/noise.html

http://faust.grame.fr/webaudio/harpe.html 

http://faust.grame.fr/webaudio/kisana.html

It seems FireFox for instance is more robust in this area: less audio glitches at the beginning.

So my understanding is that we would be in a very similar case if we directly use JavaScriptCore. Is there any safe way to be sure the JS code is actually compiled before executing it? By calling the "compute" code thousand of time outside the audio callback? Or is there any other more reliable trick to do that?

> 
> We don't usually make such predictions. It would be useful to know if this API would help your use case. 
> 
Yes this API is certainly helpful. 

Thanks.

Stephane 



More information about the webkit-dev mailing list