Pipewire and copying audio to two outputs

#Pipewire is a nice replacement for #Pulseaudio, even if it still lacks some features and tooling. I switched to pipewire a couple of weeks ago and it solved many small papercuts that pulseaudio had for me, like USB audio being broken after it was disconnected once.

Sometimes I want audio from a single source (e.g. a stream played by firefox) to go to multiple sinks: two headphones for example or speakers and headphones.

While probably not ideal, the following works for me very well. 1. Use pw-top to get the device names 2. Run pw-loopback --capture alsa_output.pci-0000_00_1f.3.analog-stereo --playback alsa_output.usb-headset-00.analog-stereo

This duplicates the output that is being sent to my regular speakers and mirrors it to my usb headset, so whenever I leave the room, I can just put on my headset and can continue to hear whatever is being played.