Hi,

Using JavaScript (and more specifically asm.js) code in the context of 
ScriptProcessor nodes in the Web Audio API has shown a very problematic issue 
related to denormalized float numbers.

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 

Our understanding is that having the possibly to control "flush denormal to 
zero" operation is not a pure Web Audio API specification/implementation issue, 
but has to be treated at the JavaScript language level. We would be happy to 
get feedback on the subject.

Best Regards

Stéphane Letz
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to