Linux: How To enable HRTF virtual 3D surround sound with PulseAudio

Frank Baier
2 min readOct 14, 2021
© Dan Farrell at unsplash.com

With a few changes at Linux (for me, it is elementary OS 6.0 [Ubuntu 20.04]) it is possible to enjoy head-related transfer function (HRTF) virtual 3D surround sound with PulseAudio.

Niels Ole Salscheider created a download package, which includes the HRIR listen data files, to use the virtual surround sound module with PulseAudio. You need to download the HRIR package hrir_listen.tar.gz and extract the data. This data was created with the KEMAR Dummy-Head microphone.

Each human being has a different experience at listen to sounds in the enviroment. If you have extracted the file, you find a folder demos inside of it. You have to listen with a media player and your headphone at the files and find the file, which fits for your head and your ears. Inside the folder hrirs are the files which fit at the demo files. You need to find the file inside with the exact same numbers inside this folder. This is the file, which is used by the pulseaudio module.

You need to edit the following PulseAudio file.

sudo nano /etc/pulse/default.pa

Almost at the end of the file, you need to add the following module.

load-module module-virtual-surround-sink

This module comes with more parameters to add and to enjoy a much better virtual 3D surround sound. These are my settings.

sink_name=HRTFsink_properties=device.description="Virtual Surround 5.1"format=float32lerate=48000channels=6channel_map=front-left,front-right,rear-left,rear-right,front-center,lfeuse_volume_sharing=yesforce_flat_volume=nohrir=path/to/impulse/response/hrir/file.wav

After you have edited the PulseAudio file, you have to stop and start PulseAudio.

pulseaudio --killpulseaudio --start

I recommend to install the PulseAudio Volume Control application, to switch between different audio sources.

sudo apt-get install pavucontrol

Inside the PulseAudio Volume Control application you should see a new interface with the name Virtual Surround Sound Sink Stream from Virtual Surround 5.1 which is using your default audio interface.

Enjoy your new virtual 3D 5.1 surround sound.

--

--