Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Audio: more headroom for emulated sound cards, only in virtual machines

Federico Pereira7e106a0726ad
diff --git a/tools/iso/mkdeb.sh b/tools/iso/mkdeb.sh
index 84f93d9..cdc9df4 100755
--- a/tools/iso/mkdeb.sh
+++ b/tools/iso/mkdeb.sh
@@ -72,6 +72,8 @@ install -m 644 assets/app-host.bundle.js "$L/assets/app-host.bundle.js"
install -m 755 tools/iso/rootfs/usr/lib/lordos/lordos-live-prep "$L/lordos-live-prep"
install -D -m 644 tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf "$PKG/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf"
install -D -m 644 tools/iso/rootfs/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf "$PKG/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf"
+# in a virtual machine only: more headroom for emulated sound cards (docs/SOUND.md, "Virtual machines")
+install -D -m 644 tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-vm-audio.conf "$PKG/etc/wireplumber/wireplumber.conf.d/lordos-vm-audio.conf"
# remote login (SSH) defaults, read only once openssh-server is installed (docs/REMOTE.md)
install -D -m 644 tools/iso/rootfs/etc/ssh/sshd_config.d/10-lordos.conf "$PKG/etc/ssh/sshd_config.d/10-lordos.conf"
# a process may only trace its own descendants: a restricted Linux app must not take over an
diff --git a/tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-vm-audio.conf b/tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-vm-audio.conf
new file mode 100644
index 0000000..8fdc082
--- /dev/null
+++ b/tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-vm-audio.conf
@@ -0,0 +1,30 @@
+# LordOS: more audio headroom in virtual machines (docs/SOUND.md, "Virtual machines").
+#
+# An emulated sound card is fed by the host's timers, and on a busy host those arrive late. Debian's
+# WirePlumber already gives VM cards 1024-frame periods and 2048 frames of headroom
+# (/usr/share/wireplumber/wireplumber.conf.d/alsa-vm.conf), and the output still ran dry: YouTube
+# in Chromium stuttered on VMware (pw-top: ERR on the ALSA sink kept growing). These outputs get
+# 8 periods of 1024 frames, 8192 frames (~170 ms at 48 kHz) of headroom and no timer-based
+# scheduling (the card's interrupts drive PipeWire). With it, ERR stayed at 0.
+#
+# Matches only when WirePlumber runs in a VM (cpu.vm.name is set, the same test alsa-vm.conf uses);
+# on real hardware it doesn't apply and the latency stays low. Its name sorts after alsa-vm.conf, so
+# its rule runs later and these values win.
+monitor.alsa.rules = [
+ {
+ matches = [
+ {
+ node.name = "~alsa_output.*"
+ cpu.vm.name = "~.*"
+ }
+ ]
+ actions = {
+ update-props = {
+ api.alsa.period-size = 1024
+ api.alsa.period-num = 8
+ api.alsa.headroom = 8192
+ api.alsa.disable-tsched = true
+ }
+ }
+ }
+]