Audio workaround and fixes with PipeWire
jaymz665 did amazing work and shared it in the Matrix room to improve the stability and noise of SDM845 audio stack.
Changes
sudo rm -r /etc/wireplumber/main.lua.d
sudo nano /etc/wireplumber/wireplumber.conf.d/51-disable-suspension.conf
monitor.alsa.rules = [
{
matches = [
{
# Matches all sources
node.name = "~alsa_input.*"
},
{
# Matches all sinks
node.name = "~alsa_output.*"
}
]
actions = {
update-props = {
audio.format = "S16LE"
audio.rate = 48000
api.alsa.period-size = 4096
api.alsa.period-num = 6
api.alsa.headroom = 512,
# session.suspend-timeout-seconds = 0
# dither.method = "wannamaker3", # add dither of desired shape
# dither.noise = 2, # add additional bits of noise
}
}
}
]
sudo nano /usr/sbin/call_audio_idle_suspend_workaround
#!/bin/sh
# dbus-monitor is run as a child process to this script. Kill child process too when the script terminates.
trap 'pkill -9 -P $$ && exit 0' INT TERM
interface=org.freedesktop.ModemManager1.Call
member=StateChanged
dbus-monitor --system "type='signal',interface='$interface',member='$member'" |
while read -r line; do
state=$(echo "$line" | awk '/\<int32\>/ {print $2}')
if [ -n "$state" ]; then
# Call State is based on https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/ModemManager-Flags-and-Enumerations.html#MMCallState
if [ "$state" -eq '0' ] || [ "$state" -eq '3' ]; then
echo "Call Started"
alsaucm reload
pw-loopback &
# Unload module-suspend-on-idle when call begins
#pactl unload-module module-suspend-on-idle
fi
if [ "$state" -eq '7' ]; then
echo "Call Ended"
killall -9 pw-loopback &
# Reload module-suspend-on-idle after call ends
#pactl load-module module-suspend-on-idle
fi
fi
done &
wait
Edited by Dylan Van Assche