-
Notifications
You must be signed in to change notification settings - Fork 2
/
audio-conf
42 lines (35 loc) · 1.67 KB
/
audio-conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash
# 2022-04-01 11:44:22 UTC
# Load the TCP module to allow other local users to use audio devices
# Change the default sampling rate to 48KHz
# Enable more allowed sampling rates
# https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PulseAudio#module-native-protocol-tcp
# "auth-ip-acl=127.0.0.1;192.168.1.0/24;::1" https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/847#note_828707
# "listen=127.0.0.1;192.168.0.100;::1" https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2259
#
# 2022-04-04 11:44:29 UTC
# + module-x11-bell : /usr/share/sounds/freedesktop/stereo/bell.oga in sound-theme-freedesktop
# 2022-12-22 10:27:26 UTC
# + module-combine-sink : output to all enabled devices simultaneously (that's an output virtual "combined" device)
# 2022-12-30 09:29:33 UTC
# - module-combine-sink : wireplumber makes it default all the time and that fucks up volume management
declare -A opts
opts[module-native-protocol-tcp]="listen=127.0.0.1"
opts[module-combine-sink]="sink_name=CombinedVirtual"
for i in module-native-protocol-tcp module-x11-bell; do # module-combine-sink
if [ -z "`pactl list modules | grep $i`" ]; then
echo -n "Loading $i ... "
pactl load-module $i ${opts[$i]} && echo OK
else
echo "$i is already loaded"
fi
done
# https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire
# Get settings: `pw-metadata -n settings`
if ! which pw-metadata &> /dev/null; then
echo "Error: 'pw-metadata' is missing, please install pipewire-utils"
exit 1
fi
echo "Setting extra options ... "
pw-metadata -n settings 0 clock.rate 48000
pw-metadata -n settings 0 clock.allowed-rates '[ 48000, 96000, 44100 ]'