letz at grame.fr
Tue Jun 24 07:20:38 PDT 2014
We have ported our audio C++ code (audio nodes generated using the Faust audio DSP language : http://faust.grame.fr) as JS nodes in the Web Audio API using emscripten. We get very high CPU load on Intel processors, as soon at the computation produced denormal floats numbers.
When the same code runs in a C++ context, we typically solve the problem by adding "flush denormal to zero" kind of macro before the audio computation, since audio code can perfectly live without following strict IEEE754 compatibility. This is a very common solution that is used everywhere when developing native audio code.
The problem has been seen on all recent browsers we tested : Firefox, Chrome and WebKit on OSX. It can be tested on the following page with contains a physical model of a piano string, compiled in asm.js using emscripten, and run as a Web Audio API ScriptProcessorNode. If you hit the "gate" button a sound is played. After some seconds when the notes become idle again, the CPU load raises to 100% (seen in activity monitor on OSX).
We started a bug report on Firefox which causes a lot of feedback: https://bugzilla.mozilla.org/show_bug.cgi?id=1027624
More information about the es-discuss