Introduction ¶
PulseAudio is a sound server, in my understanding. It runs on any Linux PC. Microphones, speakers, virtual devices - everything goes through PulseAudio and is controlled by it.
Task ¶
There’s a small server connected to a wall-mounted TV. I’m working on a PC with Manjaro and, to be honest, the headphones aren’t great. They’ll do for work, but I want to listen to music through the TV.
Sources ¶
- Arch Wiki PulseAudio Examples
- Joao Paulo Silva de Souza’s article on Medium
- A good answer on Unix Overflow
- And another one
Solution ¶
The traffic will be sent over TCP from the PC to the server (for simplicity, I’ll just refer to it as TV in the text, but it’s actually a server on Manjaro).
On both devices, we install the Zeroconf module so that the computers can find each other without issues.
|
|
Now, let’s take the cookie file from one and copy it to the other so they are the same. I found it in my home directory on the PC.
|
|
Now we configure:
- The TV will be the PulseAudio server, as it receives the audio stream.
- The PC will be the PulseAudio client, as it sends the stream.
On the TV, we run it as a regular user because there’s no need to start pulseaudio --kill/--start
as root.
|
|
On the PC, it’s almost the same.
|
|
That’s it. Now in pavucontrol, you can direct some application through the tunnel to the PC!
Bonus that doesn’t work ¶
What would be nice next? Right, something that won’t be useful but is interesting. I want both the PC and the TV to play the same stream.
On the PC, let’s check what outputs we have and get their names.
|
|
Here we can see that the first one seems to be the headphones, while the others have come through the network. The 2nd and 3rd are likely the rear and front outputs on the case, while the last one is definitely the HDMI from the computer - which is what we need. So we need to combine the 1st and 4th.
Still on the PC:
|
|
That’s it 😄 … Except it doesn’t work. I don’t know why. The device has been added, it can be selected, and there are no errors in the logs, but the sound only goes to the headphones and not to the TV. At the same time, when I simply select the TV, it works. So it seems this module cannot combine tunnel and simple devices. I decided to write this anyway; maybe it will be useful to someone.