Ubuntu – How to rebroadcast an audio stream

soundstream

My wife and I both like to listen to the same online audio stream. That means we end up with multiple computers connecting to the same online stream at the same time. It would be helpful if I could save on internet bandwidth by connecting to the internet stream on one computer/server and "rebroadcasting" it so that it's available to other computers in my house.

Any suggestions?

Best Answer

Why not connect to the internet stream from one computer and then use PulseAudio to provide the audio to the network?

You'll need to install paprefs for this, on the "server" (the computer connecting to the internet stream) and on each "client" (computer receiving audio data from the server) you wish to use.

paprefs is a GUI program, but its options are a little opaque. The manpage is, as is too often the case, useless for figuring out the options. It does provide a Web address, http://0pointer.de/lennart/projects/paprefs/ , which has a link to "Documentation" but contains no actual documentation. I will attempt to walk you through the configuration process, but my setup is different from yours so I may err. Hopefully someone will see it and correct it if I do.

First, run paprefs on the server machine. Under "Network Access" tab, select:

"Enable network access to local sound devices" "Allow other machines on the LAN to discover local sound devices", and "Don't require authentication"

There are two more options on that tab regarding DLNA/UPnp media streaming. I don't know what that is so I have left it alone.

Under "Multicast/RTP" tab, select:

"Enable Multicast/RTP sender" and "Create separate audio device for Multicast/RTP" That should do it for the server.

For each client, run paprefs and:

Under "Network Access" tab, select:

"Make discoverable PulseAudio network sound devices available locally"

Under "Multicast/RTP" tab, select:

"Enable Multicast/RTP receiver"

This should suffice for client configuration.

When it's time to listen to your broadcast, connect the server to the internet stream in the usual way. Then open System→Preferences→Sound and select "RTP Multicast" from the "Output" tab.

After that, on each client, open System→Preferences→Sound and look in the "Input" tab. It should contain an entry for an RTP Multicast from (server's hostname). I am not sure of the exact wording as I am not in a position to test it right at the moment. In any case, select the multicast, adjust the volume, and you should be hearing the broadcast (and any other audio) coming from the server.

As far as I know, there is no way to bind particular applications to particular inputs/outputs. If anyone knows of such a way, I would very much like to know about it. I have a question on the subject at How to clone audio output?.