Saturday, June 23

How to Enable Awesome HRTF Sound Effects in Linux Games

The latest version of OpenAL has a new feature that can enable some pretty neat sound effects for Linux games that use OpenAL. 

Amnesia: The Dark Descent is one such game for example and most of the Humble Bundle games use OpenAL.

This new feature is a filter that simulates Head-Related Transfer Function (HRTF) if a  pair of stereo headphone is in use. Some headphones has built in HRTF support but this filter will simulate HRTF effects in an ordinary stereo headphones as well.

What is HRTF?

Wikipedia describes it as:

A head-related transfer function (HRTF) is a response that characterizes how an ear receives a sound from a point in space; a pair of HRTFs for two ears can be used to synthesize a binaural sound that seems to come from a particular point in space. It is a transfer function, describing how a sound from a specific point will arrive at the ear (generally at the outer end of the auditory canal).

The HRTF can also be described as the modifications to a sound from a direction in free air to the sound as it arrives at the eardrum. These modifications include the shape of the listener's outer ear, the shape of the listener's head and body, the acoustical characteristics of the space in which the sound is played, and so on. All these characteristics will influence how (or whether) a listener can accurately tell what direction a sound is coming from.

OpenAL describes it as:

HRTF filters filters provide for better sound spatialization while using headphones. The default filter will only work when output is 44100hz stereo.

In simple terms, HRTF OepnAL filter will add an effect taking into consideration how the human ear perceives sound. With it enabled, you can distinctly hear if something is in front of you, behind you or from where the sound is coming.

Installing latest OpenAL files on Ubuntu 12.04

Ubuntu 12.04 ships with an older version of OpenAL that does not have support for HRTF. However, Ubuntu 12.10 has latest version of OpenAL, we will use these files.

Download libopenal-datalibopenal-dev and libopenal1 from the links below:
  • 32 bit
  • 64 bit (64 bit uses same libopenal-data file, download it from 32 bit link above)
Make sure all these files are in same folder and there are no other deb files in it. CD to the folder and run the following command:

sudo dpkg -i --force-all *.deb

Reboot your system after installation has finished.

Enabling HRTF Filter in Ubuntu 12.04

There are two ways using which you can enable HRTF filter in Ubuntu 12.04. The first method will apply it system wide.

Run the following command:

sudo gedit /etc/openal/alsoft.conf

Find the line #hrtf = false, uncomment it and change false to true. It should look like this now:

hrtf = true

Log out and come back for the settings to take effect.

If you don't like to change system files, create a new .alsoftrc  file in home folder by running command below:

gedit ~/.alsoftrc

Add the following line into it, save the file and re-login.

hrtf = true

This method will only enable HRTF filter for current user.

Testing HRTF effects in Amnesia: The Dark Descent

After enabling HRTF effects, I did notice a difference in game sound effects but I can't really say if it is huge effect as I only played the game for about 5-10 minutes after enabling HRTF. But results tend to vary and some users have noticed a big difference so its worth a try.

I also temporarily disabled music in Amnesia to better notice HRTF effects. You can also do the same by editing resources.cfg file in Amnesia game folder.

Change the following line:

<Directory Path="/music" AddSubDirs="true" />

to:

<Directory Path="/music_disabled" AddSubDirs="true" />

Revert to the original string to enable music again.

0 comments:

Post a Comment

Preload Image 1 Preload Image 2 Preload Image 3 Preload Image 4 Preload Image 5