Files
org-roam/20230523100635-pulse_audio_settings.org
2025-11-05 09:18:11 +01:00

51 lines
2.3 KiB
Org Mode

:PROPERTIES:
:ID: 18661cd7-f886-48b7-91e6-190ebe24a6df
:END:
#+title: pulse-audio-settings
#+filetags: :linux:pulse-audio:
* Binaural audio with OpenAL
For games using OpenAL, if you use headphones you may get much better positional audio using OpenAL's HRTF filters. To enable, run the following command:
#+begin_src bash
echo "hrtf = true" >> ~/.alsoftrc
#+end_src
Alternatively, install openal-hrtfAUR from the AUR, and edit the options in /etc/openal/alsoftrc.conf
For Source games, the ingame setting `dsp_slow_cpu` must be set to `1` to enable HRTF, otherwise the game will enable its own processing instead. You will also either need to set up Steam to use native runtime, or link its copy of openal.so to your own local copy. For completeness, also use the following options:
#+begin_src bash
dsp_slow_cpu 1 # Disable in-game spatialiazation
#+end_src
snd_spatialize_roundrobin 1 # Disable spatialization 1.0*100% of sounds
dsp_enhance_stereo 0 # Disable DSP sound effects. You may want to leave this on, if you find it does not interfere with your perception of the sound effects.
snd_pitchquality 1 # Use high quality sounds
* Tuning PulseAudio
If you are using PulseAudio, you may wish to tweak some default settings to make sure it is running optimally.
** Enabling realtime priority and negative nice level
Pulseaudio is built to be run with realtime priority, being an audio daemon. However, because of security risks of it locking up the system, it is scheduled as a regular thread by default. To adjust this, first make sure you are in the audio group. Then, uncomment and edit the following lines in /etc/pulse/daemon.conf:
/etc/pulse/daemon.conf
#+begin_src bash
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
#+end_src
and restart pulseaudio.
** Using higher quality remixing for better sound
PulseAudio on Arch uses speex-float-1 by default to remix channels, which is considered a 'medium-low' quality remixing. If your system can handle the extra load, you may benefit from setting it to one of the following instead:
#+begin_src bash
resample-method = speex-float-10
#+end_src
** Matching hardware buffers to Pulse's buffering
Matching the buffers can reduce stuttering and increase performance marginally. See here for more details.