Audio Streaming


Way 1 - PULSE_SERVER Variable

  • On the server (computer where the sound will come from, ip

    1. Install paprefs

      julio@acer ~> sudo pacman -S paprefs
    2. Open paprefs and, in Network Server, check:

      • Enable network access to local sound devices;
      • Allow other machines on the LAN to discover local sound devices;
      • Don't require authentication.
  • On the client (computer where the audio files are, ip

    Set the environment variable $PULSE_SERVER and play a music file:

    julio@hp ~> export PULSE_SERVER=
    julio@hp ~> mplayer music.flac

If everything went well, you should be hearing the music on the server computer.

Way 2 - MPD

Enable network access to the Pulseaudio server using paprefs or with the following command:

julio@acer ~> pactl load-module module-native-protocol-tcp auth-anonymous=1

Or, in a more secure way:

julio@acer ~> pactl load-module module-native-protocol-tcp auth-ip-acl=";"

Add a new output to the ~/.mpd/mpd.conf file:

audio_output {
    type    "pulse"
    name    "Acer - Pulseaudio"
    server  ""
    #sink   "remote_server_sink"

In the ncmpcpp menu 8, you can enable/disable this output.


PulseAudio only does multicast with RTP, which ended up dropping the home Wi-Fi.

julio@acer ~> pactl load-module module-rtp-recv

Controlling MPD with Android


Streaming via MPD

quality is for VBR (variable bitrate) and bitrate for CBR (constant bitrate)

MPD streaming http

In ~/.config/mpd.conf:

audio_output {
    type                "httpd"
    name                "My HTTP Stream"
    encoder             "vorbis"                # optional, vorbis or lame
    port                "8000"
    bind_to_address     ""               # optional, IPv4 or IPv6
    bitrate             "128"                   # do not define if quality is defined
    format              "44100:16:1"
    max_clients "0"                     # optional 0=no limit

Just open a player (it can be a browser) at and hit play.

MPD FIFO + netcat + VLC

In ~/.config/mpd.conf:

audio_output {
    type            "fifo"
    name            "FIFO2"
    path            "/tmp/mpd.fifo"
    format          "44100:16:2"

On the server:

nc -u 8765 < /tmp/mpd.fifo

On the client:

nc -u -l 8765 | ~/Applications/ --demux=rawaud --rawaud-channels 2 --rawaud-samplerate 44100 --audio-desync=250 -

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus