Pulseaudio device precedence and equalizer source volume adjustment

Hi, recently I have installed pulseaudio-equalizer-ladspa and as I encoutered some problems, I would like to have few questions about pulseaudio in general.

First things first, my setup is this: I have a laptop, almost always with connected headphones which is sometimes connected to external audio system (Denon) via HDMI and sometimes to monitor with builtin speakers.
I am able to send the sound to both headphones, notebook speakers, monitor speakers and external audio system. Manually but everything seems to work.

Problem 1: I would like to be able to set audio output precedence so that the correct output device is chosen automatically when connected. (1 external audio system, 2 headphones, 3 monitor, 4 notebook speaker. First connected item in this list is chosen)

Problem 2: When I turn on the equalizer and strenghten some frequency ranges, total volume is increased. I suspect that that is because the equalizer works in “absolute” numbers and not in “relative” - the final signal volume is not divided by average/max increase in all bands. This is not bad per se, but either in equalizer itself or in the next sink, there is a limit on the available volume levels and due to this, the sound cracks. This is especially annoying when I listen to youtube videos, because firefox creates new source every time new video is played. It is correctly connected to equalizer sink, but every time that happens it is created with 100% volume so I need to manually adjust volume to avoid the cracking noise.

According to materials I gone through both of my problems probably have easy solution with pulseaudio, however I found it harder than concrete slab and the documentation is sort of driving me totally crazy… General problem is that each page I found is some very specific problem solution and as a whole it just doesn’t fit together to create relevant mental model. Only helpful thing I was able to find and study was high level overview, but still, there is no connection to actual configuration which needs to be done.

Would it be possible for you to point me in the right direction?

Hi!

Regarding the volume, the equalizer volume is usually tied to the sink volume it is equalizing. You can set its volume with pacmd but it will probably set the volume of the sink also. What you can do is to lower the frequencies’ boost, maintaining the relative differences between frequencies. That’s my solution - observe as all my freq. levels are negative, so the sound doesn’t crack at 100%:

Screenshot_20220211_104046

Regarding precedence, first you need to make sure jack detection is working properly. If precedence isn’t working properly, jack detection probably doesn’t work as it should. My front headphone jack isn’t detected by pulseaudio, even when it is detected. To solve this problem (avoid setting it manually in pavucontrol every time) I wrote a script, put it in /usr/local/bin and set a shortcut for it. It works perfectly and it even has a notification:

[mochobb@mocho-desktop ~]$ cat /usr/local/bin/audio-sink-port-switch.sh 
#!/bin/bash
#
## Switch audio sink port between headphones and linout
#
## Author: LuĂ­s Coimbra
## Creation date: 2022-02-07
## Last modification: 2022-02-11
#
## Depends on: pulseaudio; libnotify
#
ActivePort=$(pacmd list-sinks | grep active)
Lineout=$(echo "$ActivePort" | grep analog-output-lineout)
if [ "${#Lineout}" -gt "0" ]; then
        pacmd set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-headphones
        pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo false
        pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 32768
        msg="Headphones: vol. 50%"
else
        pacmd set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-lineout
        pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo false
        pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 65536
        msg="Line Out: vol. 100%"
fi
notify-send -a "Audio output port" "$msg"

Maybe you could try a similar approach.

1 Like