diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-10-24 17:29:51 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-10-24 17:34:06 +0300 |
commit | afb22397e1413c2c705ce32773ff0dbfb23e0231 (patch) | |
tree | 96b23fc721708607ace80d1315a5dfebf9973507 | |
parent | f0ba894f3f62150573062369f478629fa3b71602 (diff) | |
download | dotfiles-afb22397e1413c2c705ce32773ff0dbfb23e0231.tar.gz |
feat(pipewire): support multi-user audio over TCP
-rw-r--r-- | env/.config/sxhkd/sxhkdrc | 6 | ||||
-rw-r--r-- | pipewire/etc/pipewire/pipewire-pulse.conf | 151 |
2 files changed, 154 insertions, 3 deletions
diff --git a/env/.config/sxhkd/sxhkdrc b/env/.config/sxhkd/sxhkdrc index 878153b..8ed3c3f 100644 --- a/env/.config/sxhkd/sxhkdrc +++ b/env/.config/sxhkd/sxhkdrc @@ -1,11 +1,11 @@ XF86AudioMute - unset PULSE_SERVER && pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+2 dwmblocks + pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+2 dwmblocks XF86AudioRaiseVolume - unset PULSE_SERVER && pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+2 dwmblocks + pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+2 dwmblocks XF86AudioLowerVolume - unset PULSE_SERVER && pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+2 dwmblocks + pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+2 dwmblocks XF86AudioPlay mpc toggle diff --git a/pipewire/etc/pipewire/pipewire-pulse.conf b/pipewire/etc/pipewire/pipewire-pulse.conf new file mode 100644 index 0000000..17fcede --- /dev/null +++ b/pipewire/etc/pipewire/pipewire-pulse.conf @@ -0,0 +1,151 @@ +# PulseAudio config file for PipeWire version "0.3.56" # +# +# Copy and edit this file in /etc/pipewire for system-wide changes +# or in ~/.config/pipewire for local changes. +# +# It is also possible to place a file with an updated section in +# /etc/pipewire/pipewire-pulse.conf.d/ for system-wide changes or in +# ~/.config/pipewire/pipewire-pulse.conf.d/ for local changes. +# + +context.properties = { + ## Configure properties in the system. + #mem.warn-mlock = false + #mem.allow-mlock = true + #mem.mlock-all = false + #log.level = 2 + + #default.clock.quantum-limit = 8192 +} + +context.spa-libs = { + audio.convert.* = audioconvert/libspa-audioconvert + support.* = support/libspa-support +} + +context.modules = [ + { name = libpipewire-module-rt + args = { + nice.level = -11 + #rt.prio = 88 + #rt.time.soft = -1 + #rt.time.hard = -1 + } + flags = [ ifexists nofail ] + } + { name = libpipewire-module-protocol-native } + { name = libpipewire-module-client-node } + { name = libpipewire-module-adapter } + { name = libpipewire-module-metadata } + + { name = libpipewire-module-protocol-pulse + args = { + # contents of pulse.properties can also be placed here + # to have config per server. + } + } +] + +# Extra modules can be loaded here. Setup in default.pa can be moved here +context.exec = [ + { path = "pactl" args = "load-module module-always-sink" } + #{ path = "pactl" args = "load-module module-switch-on-connect" } + #{ path = "/usr/bin/sh" args = "~/.config/pipewire/default.pw" } +] + +stream.properties = { + #node.latency = 1024/48000 + #node.autoconnect = true + #resample.quality = 4 + #channelmix.normalize = false + #channelmix.mix-lfe = false + #channelmix.upmix = true + #channelmix.upmix-method = psd # none, simple + #channelmix.lfe-cutoff = 150 + #channelmix.fc-cutoff = 12000 + #channelmix.rear-delay = 12.0 + #channelmix.stereo-widen = 0.0 + #channelmix.hilbert-taps = 0 + #dither.noise = 0 +} + +pulse.properties = { + # the addresses this server listens on + server.address = [ + "unix:native" + + { + # Use TCP socket for multi-user audio + address = "tcp:4713" + # Important: permissions for clients + # If not allowed, remote clients might get "access denied" + # error when trying to e.g change volume + client.access = "allowed" + } + + #"unix:/tmp/something" # absolute paths may be used + #"tcp:4713" # IPv4 and IPv6 on all addresses + #"tcp:[::]:9999" # IPv6 on all addresses + #"tcp:127.0.0.1:8888" # IPv4 on a single address + ] + #pulse.min.req = 256/48000 # 5ms + #pulse.default.req = 960/48000 # 20 milliseconds + #pulse.min.frag = 256/48000 # 5ms + #pulse.default.frag = 96000/48000 # 2 seconds + #pulse.default.tlength = 96000/48000 # 2 seconds + #pulse.min.quantum = 256/48000 # 5ms + #pulse.default.format = F32 + #pulse.default.position = [ FL FR ] + # These overrides are only applied when running in a vm. + vm.overrides = { + pulse.min.quantum = 1024/48000 # 22ms + } +} + +# client/stream specific properties +pulse.rules = [ + { + matches = [ + { + # all keys must match the value. ~ starts regex. + #client.name = "Firefox" + #application.process.binary = "teams" + #application.name = "~speech-dispatcher.*" + } + ] + actions = { + update-props = { + #node.latency = 512/48000 + } + # Possible quirks:" + # force-s16-info forces sink and source info as S16 format + # remove-capture-dont-move removes the capture DONT_MOVE flag + #quirks = [ ] + } + } + { + # skype does not want to use devices that don't have an S16 sample format. + matches = [ + { application.process.binary = "teams" } + { application.process.binary = "teams-insiders" } + { application.process.binary = "skypeforlinux" } + ] + actions = { quirks = [ force-s16-info ] } + } + { + # firefox marks the capture streams as don't move and then they + # can't be moved with pavucontrol or other tools. + matches = [ { application.process.binary = "firefox" } ] + actions = { quirks = [ remove-capture-dont-move ] } + } + { + # speech dispatcher asks for too small latency and then underruns. + matches = [ { application.name = "~speech-dispatcher*" } ] + actions = { + update-props = { + pulse.min.req = 1024/48000 # 21ms + pulse.min.quantum = 1024/48000 # 21ms + } + } + } +] |