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.

I'm using the PulseAudio feature of network sound devices (not Multicast/RTP) to play sound from my netbook on the audio equipment connected to the HTPC when at home. This creates a virtual sound device that I can then use instead of the physical built-in one. Most of the time this works just fine. Sometimes however, the virtual sound device just doesn't appear. Disconnecting from and reconnecting to the network helps sometimes but not always and it's annoying and potentially bad for existing TCP connections.

So my question basically is: Is there some way to tell PulseAudio "Hey, just look again if you really can't find a network sound device."?


Edit: Unloading and reloading the module-zeroconf-discover with pacmd does not help either and it doesn't appear to be an avahi problem per se since avahi-browse -t --all | grep PulseAudio shows lots of right-looking stuff, even when the devices aren't listed in pavucontrol or pacmd list-sinks.


Edit 2: I'm using Ubuntu 12.04 on both boxes for all the difference it might make.

share|improve this question

migrated from unix.stackexchange.com Jun 15 '12 at 11:35

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

    
If you're missing any information to provide helpful comments or even an answer, please tell me so. –  Christian Jun 24 '12 at 19:24

3 Answers 3

up vote 2 down vote accepted

A simple sudo service avahi-daemon restart does the trick, even though avahi-browse sees the devices before that avahi restart. Thanks to Takkat for pointing me in the right direction.

share|improve this answer

This answer is untested so it might not work, but it may lead you to the right direction.

I can confirm unresolved issues with an Avahi service that sometimes is unable to connect to a PulseAudio server. We may succeed reconnecting by either restarting the network, or the pulseaudio server but alas this does not always work.

To overcome this issue we may try to establish a network audio stream using the native TCP protocol to stream directly to the IP rather than using an Avahi name resolution.

To do so we can tunnel a remote sink by loading the module-tunnel-sink on the receiver side. On the sender we have to enable the native TCP protocol by loading module-native-protocol-tcp.

See also this question for terminology and how to define the PULSE_SERVER variable:

How to automatically set PulseAudio default sink to remote server at boot - Ubuntu 9.04

It is a rather old question for Ubuntu 9.04 but to my knwoledge terminology and procedures have not changed much since then.

Please also follow the PulseAudio Wiki on network connections.

share|improve this answer
    
Thanks for the one link. The solution there actually works in my case, too: sudo service avahi-daemon restart I didn't expect that because avahi-browse sees the devices even before the restart but I guess the restart triggers the callback to be called again which is all that is needed. –  Christian Jun 26 '12 at 7:06
    
@Christian: good it helped. I have given up on Avahi for the time being. –  Takkat Jun 26 '12 at 7:09
    
I'm not sure if I understood your proposition though. Can I use the DNS name resolution or do I have to know the IP? I'd rather not use fixed IPs although you might say in case of the HTPC this is an ok thing to do. –  Christian Jun 26 '12 at 7:09
1  
Yeah, I can understand why. I just wrote my own reply though because for people who stumble on this question because they have the same problem it seems like the simplest solution. –  Christian Jun 26 '12 at 7:11
  1. On the "Sink" PC (On whose speaker you wanna play the sound) open the PulseAudio command shell by going into Terminal and issuing the following command.

    $ pacmd

    You will see a Python-like shell with the following welcome message.

    Welcome to PulseAudio! Use "help" for usage information. >>>
  2. List the devices that can play the sound on the PC by the command in the PulseAudio shell.
    >>> list-sinks
    Now you'll see a detailed list of all the sound sinks.
  3. Just note down the complete name of the sink of your choice. It would appear as an attribute of the sound card. For example in my case it is:

    1 sink(s) available. index: 0 name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
    ...

The string of my interest is just "alsa_output.pci-0000_00_1b.0.analog-stereo"

  1. Now Go onto the Source PC (i.e. origin of the audio multimedia streams), open up the terminal and issue the following command

    $ pactl load-module module-tunnel-sink "server=192.168.1.105 sink=alsa_output.pci-0000_00_1b.0.analog-stereo sink_name=home_theater"

    Here 192.168.1.105 is the IP address of the sink PC, "alsa_output.pci-0000_00_1b.0.analog-stereo" is the string you just copied from sink's terminal and "home_theater" is just a fancy name to call this virtual sound output device on your computer.

  2. Finally select this virtual sound device by :
    $ pacmd set-default-sink home_theater

    Wallah !!
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.