3D sound

I’m currently working on three dimensional sound.

Have you ever noticed that we can figure out where sound comes from, even though we only have two ears? Sorting out left vs right is pretty easy, but how do we determine front/back and up/down? It turns out that the sound entering our ear canals follows multiple paths, bouncing off the structure of our ear and causing interference patterns. Sounds coming from different directions have different patterns and our brain picks up on that.

In 1994 a team from MIT set out to record these interference patterns, using a dummy head with dummy ears and two microphones. They placed the head in a recording studio and played audio samples from 710 different positions. The resulting recordings, when combined with some DSP magic, can be used to simulate sound coming from anywhere. This technique is known as Head-Related Transfer Function, or HRTF.

I’m trying to get this working on my Android through stereo headphones, but performance is a problem. The MIT data set was sampled at 44.1kHz, so it can only be used to transform audio sampled at that rate. Unfortunately my HTC Tattoo can’t do that in real-time. The current version of the software takes 5.9 seconds to transform a 1.1 second clip.

The bottleneck seems to be my Fast Fourier Transform code. After digging deeper I found that the Tattoo doesn’t have hardware floating point! Sheesh, it’s like living in 1995. Anyway, I’ll see if I can get it working with integer arithmetic and whether it’ll speed things up significantly.


2 Comments on “3D sound”

  1. Justin says:

    Hey! This sounds like pretty interesting stuff. I’m a student and working with a group and we are testing out some 3D audio on Android today. Was wondering if you could provide any insight into where roger started or what functions, packages we should look into for HRTFs

  2. mattkwan says:

    I don’t know what packages are available – I just used the MIT data and wrote custom software.

    My recommendation is to do the development on a PC. That way you can test the results without worrying about performance optimizations. In my case I chucked out the HRTF code eventually – I couldn’t reliably distinguish between front/back or up/down, so it wasn’t worth the CPU overhead. Left/right works fine, but you don’t need fancy transforms for that – left/right signal delay works fine.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s