3D sound engine for a super realistic sound sources localization

Started by
3 comments, last by achandak 9 years, 2 months ago

Hey Guys !

I am writing a 3D sound engine on top of the XAudio2 sound API with conjunction with the X3DAudio API.

- A restriction for the system is that users must use the software with headphones.

I managed to create 3D sound sources in virtual space, by going through the How to: Integrate X3DAudio with XAudio2 msdn guide and the provided XAudio2 sample supplied with the June 2010 DirectX SDK / Microsoft Windows SDK (I think).

Problem is, that there isn't much correlation between the real physical ears sensetivity and the acheived sound result, you can't determine the object's depth and orientation in space as if it were there physically.

Now, I am not a sound engineer, nor an expert in this feild, I want to acheive a Binaural sound effect so I think that the next step for me is to get deeper in the mathematics of the "Head-related transfer" function.

Any advice on how to acheive such a super realistic effect, the right and fast way ?

Advertisement
You need to implement a convolution filter, so you can convolve you audio with the HRTF.

Now as for what that actually means... is beyond me!

All I know is that convolution is very expensive in terms of performance / CPU time, and its use is still quite rare in most games.
New AMD GPUs (and the new consoles) contain a programmable audio DSP chip, which supposedly will make the use of expensive filters (like convolution) more common in upcoming games.

If you want binaural audio effects, you will either have to

1) write your own binaural sound processor. (which, yes, generally involves convolution :))

2) licensing a binaural engine from a 3rd party

X3DAudio doesn't do binaural audio processing--it just transforms x,y,z into speaker volumes (if you're doing surround sound over speakers).

If you really want to jump in with both feet and do 1, then you will need to find some dummy head HRTF data sets (there are a few around the 'net). Then you'll need to write filtering algorithms.
it's not rocket science, but does require a bit of specialized knowledge to get it right.

You may also want to look into OpenALSoft, which IIRC includes an HRTF implementation.

Brian Schmidt

Executive Director, GameSoundCon:

GameSoundCon 2016:September 27-28, Los Angeles, CA

Founder, Brian Schmidt Studios, LLC

Music Composition & Sound Design

Audio Technology Consultant

Maybe wait for Oculus Sound SDK?

bschmidt1962 has given a pretty good high level overview of how you might want to proceed.

X3DAudio does not do binaural rendering, it only performs audio panning. What your next steps are probably depends on your end goals for the 3D sound engine. If you are purely looking at it from academic/learning point of view, below are some tips.

  • Download an HRTF database (http://interface.cipic.ucdavis.edu/sound/hrtf.html). An HRTF gives you two impulse responses (one for left ear and one for right ear), for a given source direction (i.e. azimuth and elevation angle).
  • Write a simple convolution algorithm (http://www.music.miami.edu/programs/mue/Research/jvandekieft/jvchapter2.htm). You can use libraries like FFTW or Intel MKL for more efficient convolution.
  • For a given source direction, convolve the left-ear HRTF with the audio and this is your left channel audio, and convolve the right-ear HRTF with the audio and this is your right channel audio.
  • Voila, sound should appear to come from the given source direction. Congrats! you just wrote a basic 3D sound engine.

Below might be some issues with the above engine:

  • Performance. Your 3D sound engine may take a lot of CPU making it infeasible for practical applications.
  • Artifacts. If you sound source/listener moves or orientation of the listener changes, you will need to convolve audio with a new set of left-ear, right-ear HRTF. Some artifacts in audio may appear.
  • Tool Chain. If you are using a game engine (like Unity) or audio engine (like FMOD Studio), your 3D sound engine won't work with them. So, basically it may be very hard for you to use it with your existing tool chain.

So, you might want to consider using existing 3D sound engine. There are a few out there, IvicaKolic suggested that Oculus might be releasing theirs soon. But I will be a little shameless and recommend that you try Phonon 3D (http://phonon.impulsonic.com). If you are looking to use 3D sound engine in an application, it will save you a lot of time if you use an existing 3D sound engine.

Thanks,

Anish Chandak

http://gdc2015.impulsonic.com

This topic is closed to new replies.

Advertisement