Pipewire natively supports a filter to create a 7.1 virtual surround sound device that will work with any headphones or earphones. It's not well documented, so I decided to write a step-by-step guide for enabling it in Pop!
How it Works
Sound is distorted by your head and shoulders relative to your ears in slightly different ways based on the direction the sound is coming from. The distortion, which is known as HRIR (head-related impulse response), is how our brains are able to interpret sound spatially, despite ours ears only being capable of receiving stereo audio.
Pipewire is able to achieve a convincing 7.1 surround sound effect either by using either a SOFA (spatially oriented acoustic data) spatializer, or a HRTF (head-related transfer function) convolver to interpolate a replicated 7.1 HRIR input onto a 7.1 surround input, mimicking the natural process by which we hear sound spatially.
A replicated 7.1 HRIR input is created by placing microphones in the ears of an artificial dummy, and measuring the differences in sound it experienced while listening to a 7.1 surround sound system. Which is why we perceive surround sound in headphones.
SOFA takes this technology to the next level with a more advanced algorithm that can process many additional forms of data inputs to improve the surround sound effect.
Option 1: SOFA Spatializer
Step 1: Copy the following 7.1 SOFA spatializer filter-chain config locally. This creates a virtual output sink with 7.1 surround sound channels.
There's a slight audio latency increase from using virtual surround sound, depending on how fast the CPU is. It is a simple process though so the performance cost is slight.
Stereo audio sources should have the same sound before and after. Surround sound content will sound as they were intended to be heard, and it could help with dialogue in some movies being difficult to hear. Especially if you are able to configure the volume of the center speaker channel where dialogue is usually played.
Help
Any help with finding a way to automate this when plugging in headphones would be great.
Great guide, It's worth noting that you can also use SOFA filters too! HRTF is a very "Per-person" thing, Before downloading a filter, Highly reccomended to play the demo tracks first (may need to scroll right). IF none of them really do it for you, you can also try using SOFA filters instead, clubfritz is a very common sofa filter. though sadly I dont think there is a way to preview them before setting up a filter then swapping out the names