The WebAudio API does provide a ScriptProcessorNode for JS processing, but it appears to suffer from the problems I described. The spec seems to warn against using this for realtime processing, fwiw.
The WebAudio API does provide a ScriptProcessorNode for JS processing, but it appears to suffer from the problems I described. The spec seems to warn against using this for realtime processing, fwiw.
Yup. That is being worked on by W3C and the WebAudio committee as we speak. WebWorker based JS processing is something being considered.
https://github.com/WebAudio/web-audio-api/issues/113
http://lists.w3.org/Archives/Public/public-audio/2013OctDec/...
I am expecting this to be resolved in a few months. (hopefylly?)
If the threading issues are resolved, then real time audio rendering doesn't take that much processing power and can be easily done in JS.
Infact if there is nothing else contending for the EventLoop (like in this example of WavPot) the ScriptProcessorNode is able to meet the real-time guarantees pretty well, while still doing decent processing.
Also going forward, with Technologies like SIMD.js and asm.js more can be done within a single onprocess callback.
The WebWorker proposal is interesting. If the worker has its own heap and realtime scheduling with a correctly configured GC, it would be a big improvement.
Getting the different implementations to work consistently enough will be challenging, though. Meeting realtime deadlines is difficult enough when working in C with a known OS and audio stack.
https://github.com/w3c/web-platform-tests/tree/master/webaud...