6

i have no speakers in my PC(Cent-OS 5.5) but there is a stereo speaker connected to the computer next to my Computer(Cent-OS 5.5). Both computers are networked. Is there any way to pipe my system sounds to that computer speaker ?

2

3 Answers 3

9

PulseAudio can be used over the network.

I usually suggest enabling automatic discovery using Avahi (unless you have a mortal fear of IP multicast) – the advantages are that you'll be able to use both local and networked audio devices, instead of having to hardcode one specific server. Even though this does not apply to @Bijoy's question, it might apply to many other readers.

Note regarding file paths:

  • Newer PulseAudio versions ≥ v2.99.1 put user configuration in ~/.config/pulse/default.pa and the auth cookie in ~/.config/pulse/cookie.

  • Older versions ≤ v2.98 use ~/.pulse/default.pa and ~/.pulse-cookie respectively. If you have such an older version, keep that in mind when reading instructions.

Method 1, automatic discovery using Avahi with any number of servers including local devices:

  1. On both computers, start the Avahi daemon.

  2. On computer B, enable incoming network access:

    • Via paprefsNetwork ServerEnable network access to local devices

    • Or, by editing ~/.config/pulse/default.pa:

      .include /etc/pulse/default.pa
      
      load-module module-native-protocol-tcp
      load-module module-zeroconf-publish
      

      Don't forget to restart pulseaudio to make it reread the configuration (or load both modules manually with pactl load-module).

  3. On computer A, enable discovery:

    • Via paprefsNetwork AccessMake discoverable PulseAudio devices available

    • Or, by editing ~/.config/pulse/default.pa:

      .include /etc/pulse/default.pa
      
      load-module module-zeroconf-discover
      

      Don't forget to restart pulseaudio to make it reread the configuration (or load the module manually with pactl load-module).

  4. On computer A, you should now see sound devices of B listed next to local devices (e.g. in pavucontrol or in GNOME's sound settings).

Method 2, manual configuration with one server:

  1. On computer B, enable incoming network access:

    • Via paprefsNetwork ServerEnable network access to local devices

    • Or, by editing ~/.config/pulse/default.pa:

      .include /etc/pulse/default.pa
      
      load-module module-native-protocol-tcp
      

      Don't forget to restart pulseaudio to make it reread the configuration (or load the module manually with pactl load-module).

  2. Copy ~/.config/pulse/cookie from computer B to computer A.

  3. On computer A, tell PulseAudio to use a remote server:

    • Edit ~/.profile or equivalent startup script to add:

      export PULSE_SERVER="tcp:computer-b-address"
      
      test "$DISPLAY" && pax11publish -e || true
      
    • Log out, log in again, and ensure that at least one of printenv PULSE_SERVER and pax11publish shows the address of computer B.

  4. On computer A, you should now see sound devices of B listed (e.g. in pavucontrol or in GNOME's sound settings).


Note about programs that don't support PulseAudio natively: Those which do not, can be configured to use a PulseAudio-ALSA compatibility layer via /etc/asound.conf. The following example is taken from the pulseaudio-alsa package in Arch Linux:

pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}
ctl.!default {
  type pulse
  fallback "sysdefault"
}
1
  • Just tested and it works as a charm. Streaming audio Ubuntu -> Gentoo.
    – iElectric
    Jan 30, 2013 at 20:52
1

Well... the first thing that came to my mind was a version of VNC that allows for sound. Not every install does. So, I cranked up a VNC comparison page.

Looking through it, there are a number of VNC based installs that not only work with Linux, but support sound. So right there, that's one way. You install the server on your computer, install the client on the computer with the speakers, enable multi-user sessions so you don't get disconnected, and you can pipe your sound to that computer.

Otherwise, you can try the Network Audio System which I got out of a similar question asked last year Play system sounds from one computer through another computer's speakers?

-3

I think is is better to set up samba shares for your whole music collection, then access it with your player of choice on the second machine. I am sure it will work better than VNC (I reckon VNC sound isn't stereo)

1
  • This answer doesn't address the question. What about streaming videos from within the browser and VoIP calls, for instance?
    – Marco
    Jun 5, 2012 at 16:27

You must log in to answer this question.

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