My trusty laptop’s speakers gave up the ghost. I don’t like to sit around in headphones all the time, I don’t have any other speakers, and the replacements are still being manhandled by the postman.
I’d get used to the austerity if I hadn’t started missing calls from a friend. That’s unacceptable! But what am I supposed to do? Buy extra gadgets just to throw them away after a week? Nope, I’m not that kind of a person.
But hey – I have a Librem 5! It has a speaker. It’s open. I have control over it, and I’m a hacker too. So I should be able to come up with a hack to turn it into a speaker for my laptop, right?
Pulseaudio to the rescue. I look through the guide. There it is: forwarding audio over a network.
I diligently connect both my laptop and my phone to the same network. The guide doesn’t make it abundantly clear, but the phone needs to open its audio service to the external world using the paprefs tool.
Sadly, paprefs is not adapted to a phone screen size, so I spend a moment to check the IP address of the phone, and I log in remotely:
$ ssh firstname.lastname@example.org -X Last login: Fri Sep 24 14:22:44 2021 from 10.42.0.1 purism@pureos:~$ GDK_BACKEND=x11 paprefs
I check the boxes to enable access to sound devices:
I haven’t found any way to make it effective immediately, so I reboot the phone.
Finally, the phone is on again. I check its address again (it’s the same), and enter the magical formula on my laptop:
scp email@example.com:./.config/pulse/cookie /tmp/pulse-l5 pacmd load-module module-tunnel-sink server=10.42.0.185 cookie=/tmp/pulse-l5
I open pavucontrol to switch the default output device, and here we go! Now sounds from my laptop play on my phone.
A video of Big Buck Bunny playing on the laptop. The phone lies next to it, showing a volume meter which jumps according to the played sounds. A volume dial is tweaked on the laptop, and the volume dial on the phone moves in a corresponding fashion.
Keep in mind that it’s not very efficient. Your network will immediately get flooded with 200KiB/s of uncompressed sound, even if you’re not playing anything. Or at least mine did. It’s pretty bad over WiFi, so I connected my phone and my laptop directly over USB. It’s easy to set up with the Plasma network applet: configure a shared network on the laptop, and then connect the USB cable. The phone will take care of it automatically.
Purism believes building the Librem 5 is just one step on the road to launching a digital rights movement, where we—the-people stand up for our digital rights, where we place the control of your data and your family’s data back where it belongs: in your own hands.