PulseAudio

PulseAudio CLI
https://rastating.github.io/setting-default-audio-device-in-ubuntu-18-04/
https://wiki.archlinux.org/index.php/PulseAudio/Examples

pactl list short sinks
pactl list short sources
 
pactl set-sink-volume 35 17%
 
# restart
systemctl --user restart pulseaudio

Equalizer

# https://raw.githubusercontent.com/panticz/installit/master/install.pulseaudio-equalizer.sh
 
if [ "$(pulseaudio-equalizer status | grep "Equalizer status" | cut -d"[" -f2 | cut -d"]" -f1)" == "enabled" ]; then
    pulseaudio-equalizer disable
else
    pulseaudio-equalizer enable
fi
INPUT_INDEX=$(pacmd list-sink-inputs | grep index | cut -d":" -f2)
 
pactl load-module module-null-sink sink_name=steam
pactl move-sink-input ${INPUT_INDEX} steam
 
DEFAULT_OUTPUT=$(pacmd list-sinks | grep -A1 "* index" | grep -oP "<\K[^ >]+")
echo $DEFAULT_OUTPUT
 
pactl load-module module-combine-sink \
    sink_name=record-n-play slaves=$DEFAULT_OUTPUT \
    sink_properties=device.description="Record-and-Play"
 
parec --format=s16le -d record-n-play.monitor | \
    lame -r --quiet -q 3 --lowpass 17 --abr 192 - "temp.mp3" \
    > /dev/null &1>/dev/null
 
pacmd list-sinks | grep -A1 "* index" | grep -oP "<\K[^ >]+"

Switch audio output with CLI

pactl list short sinks
pacmd set-default-sink 6
pacmd set-default-sink alsa_output.pci-0000_00_03.0.hdmi-stereo
 
# get default
LANG=en pactl info | sed -En 's/Default Sink: (.*)/\1/p'
pacmd list-sinks | grep -e 'name:' -e index | paste - -

Switch to next output sink

#!/bin/bash
 
SINK_VOLUME=20%
EXCLUDE_SINK=hdmi
 
CURRENT_SINK=$(LANG=en pactl info | sed -En 's/Default Sink: (.*)/\1/p')
NEW_SINK=$(pactl list short sinks | cut -f 2 | egrep -v "${CURRENT_SINK}|${EXCLUDE_SINK}")
 
pacmd set-default-sink ${NEW_SINK}
pactl set-sink-volume ${NEW_SINK} ${SINK_VOLUME}
 
notify-send "set-default-sink" "${NEW_SINK}"

pulseaudio-switch.desktop

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/home/foo/bin/pulseaudio-switch.sh
Name=pulseaudio-switch
Icon=/usr/share/icons/Adwaita/scalable/devices/audio-headset-symbolic.svg

/etc/pulse/daemon.conf

default-sample-format = s24le
default-sample-rate = 48000

Restart

pulseaudio -k
pulseaudio --start

Links
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#No_sound_below_a_volume_cutoff_or_Clipping_on_a_particular_output_device