dagn tech tips: scream audio, systemd and gnome-terminal

haskal what

i'm not sure that i talked about vfio at all except maybe sometime on masto but basically the current configuration of my desktop is vfio for reasons. it's pretty nice anyway

one of the fucky things that can happen when you use two computers is you can end up in a situation where you have a microphone on one computer but need audio out on the other one, particularly if you're in a call and playing a game. one solution to this is just join the call twice, on both the computers, one for audio out and one for audio in. this kind of sucks though. turns out there's a better way!

scream is a network audio driver meant for vfio windows. especially in combination with looking glass, though it can work on its own too. vfio is also not a strict requirement, but i'm not sure that people usually want to be doing network audio on bare metal windows. basically it takes your desktop audio and spams it out as PCM on the network where it can be picked up by any other device using a magic multicast address. using multicast means it's effectively plug and play, without any configuration needed. i installed the driver and the receiver and immediately started getting audio, which was nice

to install the receiver on linux, you can use the official github releases, or get it from the AUR. then run: scream -o pulse (assuming you have pulseaudio or pipewire)

to make this better you can also set up a user unit in systemd: ~/.config/systemd/user/scream.service

Description=Scream network audio receiver

ExecStart=scream -o pulse


and make it start and stop automatically depending on whether the computer (for me, a laptop) is on the home network (with the desktop on it): /etc/NetworkManager/dispatcher.d/99-scream-service


if [[ "$1" =~ ^(enp|eno|eth) ]] && [[ "$2" == "up" ]]; then
    systemctl -M <you>@.host --user start scream
    systemctl -M <you>@.host --user stop scream

adjust the script accordingly. here i just check if it's an ethernet device, because for my use cases ethernet means home network. you may want more advanced checks though

this also took me a while to figure out, but you can see here the canonical way to control a user instance of systemd from the root user -- because networkmanager invokes your script as root by default (actually the way i found out is systemd tells you what the syntax is when you try to use -H instead of -M). you use -M <your username>@.host, and that connects to the systemd user bus for that user, assuming you have permissions

in the process i also discovered another fun thing which is that the systemd help outputs actually contain clickable links, which you can click in GNOME terminal (try it!). running systemctl --help and if you ctrl-click the man page link at the bottom, it actually opens GNOME Help with that man page. pretty neat imo

escape codes to achieve this are basically \x1b]8;;<url>\x07. for example

printf "\x1b]8;;https://awoo.systems\x07meow meow meow\x1b]8;;\x07\n"

in case you weren't familiar, GNOME terminal and most modern terminals support bold, italic, and underlined text as well as 24 bit color, color emojis, and different cursor shapes (block, caret, and underline -- which i set up to indicate vim editing modes). so there's a surprising amount of rich text capability which is why I like GNOME terminal (and Konsole though I use that less -- and I'm not sure if it supports links, though it has the other stuff) over many other terminals

anyway that's all i have. try scream if you need windows audio shipped to a linux device. the latency is plenty good enough for gaming (on gigabit ethernet)