How do I forward sound from one computer to another over the Lan?

Solution 1:

The least complicated method to send audio from one Pulse Audio server to another over the LAN is to use the RTP/Multicast feature that you are able to set up using paprefs Install paprefs.

On the sender:

paprefs screenshot showing "enable multicast/rtp sender" checked and "send audio from local speakers" selected

Choose your local soundcard or choose a separate device you can select as audio output from Audio Preferences.

On the receiver:

paprefs screenshot showing "enable multicast/rtp receiver" checked

By doing so audio will be sent from the sender to the receiver via your LAN.

Solution 2:

The below example shows how to create a pulseaudio TCP tunnel to forward sound from computer alpha to computer beta. In my case, both computers are running Ubuntu 14.04.

On alpha (the source computer) append the following lines to /etc/pulse/default.pa:

.fail
load-module  module-tunnel-sink  sink_name=beta  server=tcp:IP_ADDRESS_OF_BETA:4713
.nofail

(Choose any unique value for sink_name. I arbitrarily chose to use the value beta.)

On beta (the destination computer) append the following line to /etc/pulse/default.pa:

load-module  module-native-protocol-tcp  auth-ip-acl=127.0.0.1;LAN_NAME

In the above, LAN_NAME and IP_ADDRESS_OF_BETA will be specific to your computers and your LAN. For example, they might be:

LAN_NAME            =  192.168.1.0/24
IP_ADDRESS_OF_BETA  =  192.168.1.10

After making the above changes, restart pulseaudio, first on beta, then on alpha. The order matters. I restart pulseaudio with pulseaudio --kill. I run pulseaudio --kill as my pesonal UID (not as root), as pulseaudio is already running as my personal UID.

If everything worked successfully, you should now see the tunnel on the Output Devices tab of pavucontrol on alpha. When an audio source is playing, you should be able to route the source to the tunnel on the Playback tab of pavucontrol on alpha.

As long as the tunnel is intact, you should also be able to see the tunnel on the Playback tab of pavucontrol on beta. If the tunnel disappears, restart pulseaudio, first on beta, then on alpha. The tunnel is only created when pulseaudio starts on alpha.

Note 1: This example assumes pulseaudio is running on both alpha and beta. As of 2016, pulseaudio runs by default on Ubuntu, and has for years.

Note 2: This example does not use Avahi Zero-configuration networking. Avahi may be enabled by default on Ubuntu, but I have disabled Avahi on my systems. On my LAN, beta (the destination computer) always has the same IP address, and I know that address.

Note 3: The above auth-ip-acl grants access to any device on the LAN. Pulseaudio also supports other (more secure) authentication methods. I use auth-ip-acl to simplify configuration.

More information can be found at the following pages:

https://raspberrypi.stackexchange.com/questions/8621/how-to-set-up-a-pulseaudio-sink https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/#index2h2 https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index14h3