Share Audio Over LAN

Vocabulary

Sink: Audio Output

Source: Audio Input

Process Overview

To stream audio from PulseAudio to another device in a LAN network we will create a TCP server and multiple clients that will connect to that server.

The server is the device that will receive all the audio coming from the clients (sink) or input audio such as microphones (sources).

1. Install the necessary dependencies

First, we will have to install two packages required for this process:

# Pulseaudio
pulseaudio

#Pipewire
pipewire
pipewire-pulse

2. Create the PulseAudio server

To create the audio server we will use the native protocol TCP module for opening our device IP with a specific port.

# CLIENT_IP=ip;ip2;ip3;ip4/subnet

# Create server
pactl load-module module-native-protocol-tcp \\
	port=SERVER_PORT auth-ip-acl=CLIENT_IP

The auth-ip-acl argument is needed here just for security reasons. Our server will only accept the IP we will define there. We can also define our local network using our ip range

3. Connect a client to the PulseAudio server

To be able to connect to our server we will only have to define the server IP with the port we defined earlier.

// Connect to server
PULSE_SERVER=tcp:SERVER_IP:SERVER_PORT pactl info

// Create Sink
pactl load-module module-tunnel-sink server=tcp:SERVER_IP:SERVER_PORT

After that, we will create a sink to forward audio from the client to the server.

Possible issues

Can’t connect to my server

If you can’t connect to the server check that you defined correctly the client IP that is allowed to connect to or that your local network IP range is written correctly.