From 58ddbf4a3d0d20fd3236f4944311502d752d7922 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Fri, 1 Dec 2023 10:53:34 -0800 Subject: [PATCH] fix(deck): Restore audio changes on main, this is in lieu of steamdeck-dsp which will remain on :testing for now. --- .../usr/etc/pipewire/99-input-denoising.conf | 71 +++++++++++++++++++ .../bluetooth.lua.d/60-bluez-jupiter.lua | 25 +++++++ .../main.lua.d/60-alsa-acp5x-config.lua | 48 +++++++++++++ .../main.lua.d/60-alsa-card0-config.lua | 25 +++++++ .../60-alsa-ps-controller-config.lua | 21 ++++++ 5 files changed, 190 insertions(+) create mode 100644 system_files/deck/shared/usr/etc/pipewire/99-input-denoising.conf create mode 100644 system_files/deck/shared/usr/etc/wireplumber/bluetooth.lua.d/60-bluez-jupiter.lua create mode 100644 system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-acp5x-config.lua create mode 100644 system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-card0-config.lua create mode 100644 system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-ps-controller-config.lua diff --git a/system_files/deck/shared/usr/etc/pipewire/99-input-denoising.conf b/system_files/deck/shared/usr/etc/pipewire/99-input-denoising.conf new file mode 100644 index 0000000000..d0061e2960 --- /dev/null +++ b/system_files/deck/shared/usr/etc/pipewire/99-input-denoising.conf @@ -0,0 +1,71 @@ +context.modules = [ +{ name = libpipewire-module-filter-chain + args = { + node.description = "Noise Canceling source" + media.name = "Noise Canceling source" + filter.graph = { + nodes = [ + { + type = ladspa + name = rnnoise + plugin = /usr/lib64/ladspa/librnnoise_ladspa.so + label = noise_suppressor_stereo + control = { + "VAD Threshold (%)" = 23.0 + "VAD Grace Period (ms)" = 200 + } + } + { + type = ladspa + name = equaliser + plugin = /usr/lib64/ladspa/caps.so + label = Eq10X2 + control = { + "31 Hz" 0 + "63 Hz" 0 + "125 Hz" 0 + "250 Hz" 0 + "500 Hz" 0 + "1 kHz" 0 + "2 kHz" 0 + "4 kHz" 0 + "8 kHz" -3 + "16 kHz" -3 + } + } + { + type = ladspa + name = compressor + plugin = /usr/lib64/ladspa/caps.so + label = CompressX2 + control = { + "measure" 1 + "mode" 1 + "threshold" 0.5 + "strength" 0.25 + "attack" 0.75 + "release" 0.5 + "gain (dB)" 12 + } + } + ] + links = [ + { output = "rnnoise:Output (L)" input = "equaliser:in.l" } + { output = "rnnoise:Output (R)" input = "equaliser:in.r" } + { output = "equaliser:out.l" input = "compressor:in.l" } + { output = "equaliser:out.r" input = "compressor:in.r" } + ] + } + capture.props = { + node.name = "capture.rnnoise_source" + node.passive = true + audio.rate = 48000 + } + playback.props = { + node.name = "rnnoise_source" + media.class = Audio/Source + audio.rate = 48000 + } + } +} +] diff --git a/system_files/deck/shared/usr/etc/wireplumber/bluetooth.lua.d/60-bluez-jupiter.lua b/system_files/deck/shared/usr/etc/wireplumber/bluetooth.lua.d/60-bluez-jupiter.lua new file mode 100644 index 0000000000..b1e81200bf --- /dev/null +++ b/system_files/deck/shared/usr/etc/wireplumber/bluetooth.lua.d/60-bluez-jupiter.lua @@ -0,0 +1,25 @@ +bluez_monitor.properties = { + -- we only want these audio profiles: + -- 0000110a-0000-1000-8000-00805f9b34fb Audio Source + -- 0000110b-0000-1000-8000-00805f9b34fb Audio Sink + -- 0000110d-0000-1000-8000-00805f9b34fb Advanced Audio Distribution + ["bluez5.roles"] = "[ a2dp_sink a2dp_source ]", + + -- And only this one headset related profile: + -- 00001112-0000-1000-8000-00805f9b34fb Headset + -- disabled: 00001108-0000-1000-8000-00805f9b34fb hsp_hs + -- disabled: 0000111e-0000-1000-8000-00805f9b34fb hfp_hs + -- disabled: 0000111f-0000-1000-8000-00805f9b34fb hfp_ag + -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + -- NOTE: check hfphsp-backend below as that also affects hs/hf profiles + -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + ["bluez5.headset-roles"] = "[ hsp_ag ]", + + -- HFP/HSP backend (default: native). + -- Available values: any, none, hsphfpd, ofono, native + -- setting this to "none" disables all headset roles + ["bluez5.hfphsp-backend"] = "none", + + -- Disable dummy AVRCP player + ["bluez5.dummy-avrcp-player"] = false +} diff --git a/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-acp5x-config.lua b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-acp5x-config.lua new file mode 100644 index 0000000000..c710c9bf4e --- /dev/null +++ b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-acp5x-config.lua @@ -0,0 +1,48 @@ +--ACP5X card hardware never hibernates, so remove the pops and lags. + +table.insert (alsa_monitor.rules, { + matches = { + { + -- Matches all sources from card acp5x + { "node.name", "matches", "alsa_input.*" }, + { "alsa.card_name", "matches", "acp5x" }, + }, + + { + -- Matches all sources from card acp6x + { "node.name", "matches", "alsa_input.*" }, + { "alsa.card_name", "matches", "acp6x" }, + }, + + { + -- Matches all sources from SOF drivers + { "node.name", "matches", "alsa_input.*" }, + { "alsa.card_name", "matches", "sof-nau8821-max" }, + }, + + { + -- Matches all sinks from card acp5x + { "node.name", "matches", "alsa_output.*" }, + { "alsa.card_name", "matches", "acp5x" }, + }, + + { + -- Matches all sinks from card acp6x + { "node.name", "matches", "alsa_output.*" }, + { "alsa.card_name", "matches", "acp6x" }, + }, + + { + -- Matches all sinks from card acp6x + { "node.name", "matches", "alsa_output.*" }, + { "alsa.card_name", "matches", "sof-nau8821-max" }, + }, + + + }, + apply_properties = { + ["session.suspend-timeout-seconds"] = 0, + ["api.alsa.headroom"] = 1024, + + } +}) diff --git a/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-card0-config.lua b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-card0-config.lua new file mode 100644 index 0000000000..6a887c98fe --- /dev/null +++ b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-card0-config.lua @@ -0,0 +1,25 @@ +-- HDMI output is always plugged in card 0 (HD_Audio Generic) +-- We always give higher priority to nodes from that card +-- Disable suspend timeout for HDMI to remove audio delay after idle + +table.insert (alsa_monitor.rules, { + matches = { + { + -- Matches all sources from card HD-Audio Generic + { "node.name", "matches", "alsa_input.*" }, + { "alsa.card_name", "matches", "HD-Audio Generic" }, + }, + { + -- Matches all sinks from card HD-Audio Generic + { "node.name", "matches", "alsa_output.*" }, + { "alsa.card_name", "matches", "HD-Audio Generic" }, + }, + }, + apply_properties = { + ["priority.driver"] = 900, + ["priority.session"] = 900, + ["api.alsa.period-size"] = 256, + ["api.alsa.headroom"] = 1024, + ["session.suspend-timeout-seconds"] = 0 + } +}) diff --git a/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-ps-controller-config.lua b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-ps-controller-config.lua new file mode 100644 index 0000000000..6ae8fae001 --- /dev/null +++ b/system_files/deck/shared/usr/etc/wireplumber/main.lua.d/60-alsa-ps-controller-config.lua @@ -0,0 +1,21 @@ +-- PS4/PS5 Controller output is always referenced as Wireless Controller +-- We always give the lowest priority to nodes from that card + +table.insert (alsa_monitor.rules, { + matches = { + { + -- Matches all sources from card Controller + { "node.name", "matches", "alsa_input.*" }, + { "alsa.card_name", "matches", "Wireless Controller" }, + }, + { + -- Matches all sinks from card Wireless Controller + { "node.name", "matches", "alsa_output.*" }, + { "alsa.card_name", "matches", "Wireless Controller" }, + }, + }, + apply_properties = { + ["priority.driver"] = 99, + ["priority.session"] = 99, + } +})