0
\$\begingroup\$

Given the following:

  • x, y, z of omnidirectional source source
  • x, y, z of center of listener's head
  • pitch, roll, yaw of head

What is a simple fuction that will return the decibel attenuation and the delay of the left and right ears' perception of this source?

\$\endgroup\$
1
  • 4
    \$\begingroup\$ Ooooooh psychoacoustics! Welcome to a ridiculously complicated field. It's faaaaar more complicated then you think. There are lots of additional effects caused by the shape of the ears, etc... \$\endgroup\$ Commented Oct 5, 2012 at 3:03

3 Answers 3

1
\$\begingroup\$

The accurate function is the "head related transfer function"

This varies between people. The data can be measured and turned into an impulse response. There are some archives of these. But that is not simple: if you use real data, it means you have a function with a large number of coefficients.

HRTF's have been approximated in software. E.g. video games which place sounds relative to the player, who is wearing headphones.

Wikipedia:

http://en.wikipedia.org/wiki/Head-related_transfer_function

Intro to HRTFs slides:

http://www.umiacs.umd.edu/~ramani/cmsc828d_audio/HRTF_INTRO.pdf

SLAB: NASA's Open Source Spatial Audio Renderer (claims to have a "listener HRTF (Head-Related Transfer Function) database"; maybe something can be borrowed from this):

http://ti.arc.nasa.gov/opensource/projects/slab-spatial-audio-renderer/

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the link to the SLAB spatial audio renderer! I'll just use that as my starting point rather than reinvent the wheel. \$\endgroup\$ Commented Oct 5, 2012 at 18:55
3
\$\begingroup\$

There is no simple function for the attenuation; like Scott says it's frequency dependent. One method the brain uses to detect the source's direction is the time difference between the arrival of the sound between both ears. Suppose the left ear receives the signal 0.1 ms earlier. Sound speed in air in 330 m/s, then 0.1 ms means the path from left ear to the source is 33 cm shorter than from right ear. But that doesn't give you enough information; you can find an infinite number of solutions in all directions and distances.

The root locus is a plane with equation

\$ \sqrt{(x-x_L)^2 + (y-y_L)^2 + (z-z_L)^2} + 0.33 m = \sqrt{(x-x_R)^2 + (y-y_R)^2 + (z-z_R)^2} \$

where \$ (x_L, y_L, z_L)\$ is the location of the left ear in space and \$ (x_R, y_R, z_R)\$ that of the right ear. So how come that we can estimate both direction and distance quite accurately? That's where the frequency as a function of direction comes in. It reduces the number of solutions, and you may have noticed that for even more accurate location of the source we will slightly turn our head. That gives us a new equation for new left and right ear and a new plane equation.

You may also have noticed that in general it's a lot harder to locate the source of a sine sound than that of a more complex sound, read: a wider spectrum. That's because if you only have 1 frequency that's the reference level for your ear, but there are no other frequencies to compare with. In the 90s of last century in the UK they experimented with a different siren sound for ambulances: the familiar sound was interleaved with short noise bursts, exactly because noise contains a wide range of frequencies, so their mutual levels give you lots more information. Or should, because I didn't hear about the experiment again, and I also never heard an ambulance making that sound. It might be useful, though, because when people in their car hear an ambulance, they begin to look around to find out which direction it's coming from.

Final note: if you want to create a good stereo sound it's not sufficient to play with left and right levels to place the sound in the room. A sound will be perceived much more left of center if the right channel has a 50 µs phase delay than if it's half a dB weaker.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The time difference is a stronger cue for frequencies below about 1 kHz Above this frequency, the auditory (hair cells) receptors are largely envelope detectors and lose phase information. \$\endgroup\$ Commented Oct 5, 2012 at 10:52
  • \$\begingroup\$ For localization in elevation, the relevant cues are frequency notches inserted into the spectrum by the external ear and ear canal. \$\endgroup\$ Commented Oct 5, 2012 at 11:01
1
\$\begingroup\$

Decibel attenuation is harder, but the interaural time difference is simply the difference in distance between the source and each ear divided by the speed of sound in air. Attenuation is a function of frequency, and plenty of other things, with the head posing a much more effective acoustic shadow at high frequency.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.