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



Question:

I have two computers. Computer A is running Ubuntu 11.10 with Gnome Clasic. Computer B is running Mythbuntu 11.10. Computer B has a sweet digital audio sound system.

I want to play music from Banshee on Computer A, but have the sound output sent over the LAN and come out on computer B's speakers.

I found this question which indicated I should use something called "paprefs" to acheive this. So, I installed paprefs and then in the "Network Server" dialog, I selected these settings:

paprefs

And then... I have no idea what is supposed to happen. I checked the paprefs home page, and all they say under Documentation is "There is not much to say. Just run paprefs and see for yourself."

I don't see anything happening or any way I'm supposed to make the connection from Computer A to Computer B.

How is this supposed to work? Can someone provide clear instructions on what one does to actually make the connection?

Ideally, the hope is that I can have a set up that allows me to always play certain applications, like Banshee, over the LAN using Computer B's sound system. In other words, once set up, it is the default, and does not have to be manually reconnected every time.


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

See this guide for another simple method which allows you to select from the servers' sound cards on the client.


Solution:3

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »