Mike Wilson's Blog


I was a MA/MST student at Stanford's Center for Computer Research in Music and Accoustics.

This is my weblog.

Click here for my main page.



2011-04-17

Denormalized numbers can cause a lot of performance problems in audio
signal processing applications.

These occur on some CPUs when floating-point numbers become very
small.  The CPU has a special mode for handling them that is not as
computationally efficient as for handling larger numbers, but
maintains accuracy for these very small numbers.

In audio applications we usually don't care about values that are
extremely small, since if we are translating them to sound they will
be inaudible (we hear loudness on a logarithmic scale).  There are a
lot of corners you can justifiably cut in audio processing if your
main goal is that things sound correct as opposed to an extremely
detailed and accurate model; look at things like mp3, waveguides, or
the types of filters that are used in audio.

I just spent a long time wrestling with denormals in some physical
models I was running through the dssi architecture file that I'm
writing for Faust.  I read a lot of forum threads and instructions
about setting compiler flags to tell SSE-enabled CPUs to flush
denormals to zero, but I was still getting unreasonably high CPU
usage once I stopped exciting the model.

What ended up working the best was adding a very small value to the
excitation signal I was sending through the physical model.  It was
small enough that it didn't cause any audible output, and dropped the
CPU usage from ~90% to ~3%.  A justifiable corner to cut.


email mwilson@alumni.caltech.edu
Disclaimer: the views herein are my own and do not represent the views of Stanford University. All material copyright Michael J. Wilson.