10

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.

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

4 Answers 4

9
  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 !!
1
  • Worked for me - works with the new tunnel sink module too and with just the sink's host IP address without needing to specify the exact sink (I use only one on this Raspberry Pi connected to my stereo, so no need for that) : 'pactl load-module module-tunnel-sink-new server=[2001:470:ca90:4:ba27:ebff:fee2:ada9]' - thanks ! Nov 12, 2015 at 0:07
5

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.

3
+50

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.

4
  • 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, 2012 at 7:06
  • @Christian: good it helped. I have given up on Avahi for the time being.
    – Takkat
    Jun 26, 2012 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, 2012 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, 2012 at 7:11
1

You could try pulseaudio -k, which kills the pulseaudio service (it seems to start up again automatically). This has brought things back for me before.

The other thing which sometimes helps is unticking and then reticking the boxes in Pulseaudio Preferences (a.k.a. paprefs). Checkboxes are Make discoverable PulseAudio network sound devices available locally in Network Access, and Enable network access to local sound devices in Network Server. Obviously this probably only works for the one you're using.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .