Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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 http://ubuntu.stackexchange.com/questions/4848/how-to-clone-audio-output.

share|improve this answer
1  
Interesting! I tried this and it worked. The only problem is that there seems to be some network/processor lag time that causes the music to speed up and slow down. Very strange. Any suggestions? –  HughH Oct 5 '10 at 15:38
    
Well, the first step would be to determine whether the lag is caused by a network issue or by local processing. Check your round-trip time by pinging the server from each client. If your RTT is more than 90 ms or so, that's a problem. RTT for a local ping on my network is about 4-16ms under very light network usage. I'm not sure of the load an RTP multicast puts on the network, but it shouldn't be anything 100MBit Ethernet can't handle. –  koanhead Oct 7 '10 at 18:46
    
If the RTT seems adequately low, then you might look into what else the network interfaces involved are doing. If the lag is similar among many clients, then perhaps the server is handling too many simultaneous connections. If you are multicasting to three clients with eighteen tabs open in two browsers, seeding six torrents and handling six ssh -X sessions, that might slow your server down a little bit ;) –  koanhead Oct 7 '10 at 18:49
    
Use System Monitor to watch what your network is doing. It's not ideal because it doesn't separate by interface and the measurement axis is weird (mine tops out at 2 KiByte/sec for gigabit Ethernet!) so you might want a more detailed monitoring solution like ntop or wireshark. –  koanhead Oct 7 '10 at 18:57
    
If the network appears unclogged, then the problem must be in local processing: either the server is overwhelmed with downloading, decompressing and rebroadcasting while performing other tasks, or the clients are having similar problems. I don't know how powerful the computers involved are, but once again, System Monitor is your friend. Another more flexible utility for process and load monitoring is top. –  koanhead Oct 7 '10 at 19:00

I've been looking into this too. I want to broadcast my Pandora, MP3s, or whatever from one source to various netbooks and things connected to receivers throughout my house. I haven't found the silver bullet yet, but here are some of my pursuits.

VLC seems to be able to do it as long as you can capture the "audio out," but that's dependent on your sound card.

Airfoil is an inexpensive commercial product which claims to be able to broadcast to various OSes, including Ubuntu. However, I don't think you can broadcast from Ubuntu. Broadcasting seems unstable from Win 7.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.