1
0
Fork 0
knowledge-base/KB/Linux/Desktop/ArchLinux/Audio/EQ.md

151 lines
5.6 KiB
Markdown
Raw Normal View History

2022-09-04 12:54:22 +00:00
---
creation date: 2022-01-08
tags: [note,audio,pipewire,pulse,pulseaudio,linux,archlinux]
---
2023-11-23 13:37:11 +00:00
* See [[KB/Linux/Desktop/ArchLinux/Audio/pipewire.txt]] for packages
* See [[KB/Linux/Desktop/ArchLinux/Audio/pulseaudio.txt]] for packages
2022-09-04 12:54:22 +00:00
This document outlines how to get a decent audio setup utilizing a headphone EQ called _dsp_. It's targeted for Linux machines, but use [EqualizerAPO](https://equalizerapo.com/) to similarly use headphones EQ presets.
See `HiFi 24bit and 192kHz Music Downloads are Very Silly Indeed` why not more than 44.1 kHz is needed. The following will not enforce 44.1kHz though.
## Why?
A target curve T has been tested and be found most comfortable listening to. Try to get each Headphones with EQ settings near that curve T. [EQ presets for a lot of headphones](https://www.reddit.com/r/oratory1990/wiki/index/list_of_presets).
## How-to for Linux
Baseline for this is the [following website](https://forum.level1techs.com/t/improving-linux-audio-updated/134511).
### With PipeWire
2023-06-20 22:42:40 +00:00
Use `PulseEffects` (X.org) or `Easy Effects` (Wayland) presets for EQ settings and _enable auto-start_.
Make sure that `lsp-plugins` is installed for `EasyEffects`.
2022-09-04 12:54:22 +00:00
There are some very convenient settings you probably want to set.
2023-06-20 22:42:40 +00:00
* Handle suspend (globally in `/etc` or as drop-ins in `~/config/...`)
2022-09-04 12:54:22 +00:00
* In `/etc/pipewire/media-session.d/media-session.{conf|confpause}` comment out `suspend-node` to enable suspending feature
2023-06-20 22:42:40 +00:00
* In Wireplumber or `/etc/pipewire/media-session.d/alsa-monitor.conf` set a timeout so that your DAC/output device is able to always receive a signal if you like.
2022-09-04 12:54:22 +00:00
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
node.pause-on-idle = false
session.suspend-timeout-seconds = 0 # or any number as seconds
```
* If you like, set a default _sample rate_ in `/etc/pipewire/pipewire.conf`, e.g. for 44.1kHz
2023-03-29 16:16:29 +00:00
```shell
2023-06-20 22:42:40 +00:00
default.clock.rate = 44100
default.clock.allowed-rates = [ 44100 ]
2022-09-04 12:54:22 +00:00
```
2023-06-20 22:42:40 +00:00
* Use `systemctl --user restart wireplumber.service pipewire.service pipewire-pulse.service` to restart PipeWire
2022-09-04 12:54:22 +00:00
### With PulseAudio
* Allow direct communication to device for PulseAudio. Edit ALSA configuration `/etc/asound.conf`.
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
# Use PulseAudio plugin hw
pcm.!default {
type plug
slave.pcm hw
}
```
* (**OPTIONAL, DO IF YOU WANT A REMAPPED VERSION OF MAIN AUDIO DEVICE IN sink_name=**) Add some _default_ sink names (remap them) in PulseAudio `/etc/pulse/default.pa`. Use `pacmd list-sinks` and `pacmd list-sources` to list your devices and insert as _master_ below. Any user could use `sink_main` and `src_microphone` instead of the specific device as `sink_name=`. This is **OPTIONAL** if you use direct sink name in any user specific file later instead of "sink_main" and "src_microphone"
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
# create remapped sink/sources with proper names and description
# pacmd list-sinks
load-module module-remap-sink sink_name="sink_main" master="alsa_output.pci-0000_31_00.4.iec958-stereo" sink_properties=device.description="Toslink" remix=no
# pacmd list-sources
load-module module-remap-source source_name="src_microphone" master="alsa_input.usb-Samson_Technologies_Samson_Meteor_Mic-00.analog-stereo" source_properties=device.description="Microphone" remix=no
```
* Adapt `.config/pulse/daemon.conf`
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
flat-volumes = no
default-sample-channels = 2
default-channel-map = front-left,front-right
default-sample-format = s32ne
;default-sample-rate = 44100
;alternate-sample-rate = 44100
;resample-method = speex-float-10
enable-lfe-remixing = no
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 9
rlimit-rtprio = 9
```
#### EQ
Install [dsp](https://github.com/bmc0/dsp).
Create and adapt configuration for dsp. See example below. Use EQ presets for your headphones.
* Basic file structure
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
.config/ladspa_dsp
├── config_beyerdynamic_dt1990
└── eq
└── beyerdynamic_dt1990.conf
```
* The main configuration for an additional Pulse sink `.config/ladspa_dsp/config_beyerdynamic_dt1990`
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
LC_NUMERIC=C
effects_chain=@eq/beyerdynamic_dt1990.conf
```
* The EQ settings derived from the target curve found for your headphones, e.g. `.config/ladspa_dsp/eq/beyerdynamic_dt1990.conf`
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
# Beyerdynamic DT 1990
# preamp gain
gain -4.0
lowshelf 90 0.7q +4.0
eq 220 0.7q -3.4
...
```
* Add a new sink _based on above remapped sink_main_ for the EQ present in `.config/pulse/default.pa` (also some other reasonable default settings)
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
# load system defaults
.include /etc/pulse/default.pa
# unload the cork stuff
.nofail
unload-module module-role-cork
.fail
# unload the idle suspend stuff
.nofail
unload-module module-suspend-on-idle
.fail
# dsp EQ stuff for various headphones
.ifexists module-ladspa-sink.so
.nofail
load-module module-ladspa-sink sink_name=dsp_beyerdynamic_dt1990 sink_master="<MAIN SINK NAME> OR <sink_main from OPTIONAL STEP>" plugin=ladspa_dsp label=ladspa_dsp:beyerdynamic_dt1990 sink_properties=device.description="Beyerdynamic\ DT\ 1990\ Pro"
.fail
.endif
```
* Restart PulseAudio, so that the new sink appears. In your settings, select the newly added DSP sink as default one. Maybe restart device.
#### Linux troubleshooting
* Something weird going on? Delete anything **except for configuration files** in `.config/pulse/`.
* Restarting when changing anything in PulseAudio configuration is highly recommended as some applications might not be able to handle restarting audio system.