Stream audio over network with PulseAudio running on Raspberry Pi

Revision history
Tags: pulseaudio audio streaming raspberrypi


I am tired of plugging in the mini-jack to my laptop in order to listen to some music on my living room speakers. I want to be able to stream over my local 5GHz wifi network.

Server installation

The server can be any kind of box with pulseaudio installed. My server is now a Raspberry Pi connected with the mini-jack to my speakers.

Install some pre-reqs

# apt update
# apt install pulseaudio pulseaudio-module-zeroconf avahi-daemon

Define the pulseaudio service file to make it start on boot and log to the journal.

# tee /etc/systemd/system/pulseaudio.service
Description=PulseAudio system-wide server

ExecStart=/usr/bin/pulseaudio --daemonize --system --realtime --log-target=journal
ExecStop=/usr/bin/pulseaudio -k


Since I had some problems running pulseaudio on the Pi in user mode, I’m just going with --system mode, although the logs tells me it is not advised. This Pi is only used headlessly by me anyway.

Appending some lines to the pulseaudio system configuration file to enable network audio. Allow all IPv4 private internet addresses, and allowing link-local IPv6 addresses is vital if you’re on an IPv6-enabled network and Avahi is configured for it.

# tee -a /etc/pulse/
load-module module-native-protocol-tcp auth-ip-acl=;;;;fe80::/10
load-module module-zeroconf-publish

Start it right away, but also enable it to make it start on boot automatically.

# systemctl daemon-reload
# systemctl start pulseaudio.service
# systemctl enable pulseaudio.service

Check the logs for errors

# journalctl -u pulseaudio

If you need more verbosity in the logs, you can set log-level = debug in the pulseaudio daemon.conf.

Start Avahi to enable automatic service discovery

# systemctl start avahi-daemon.service
# systemctl enable avahi-daemon.service

Client setup

The below might be Arch Linux specific!

Start Avahi to enable automatic remote speaker discovery

# systemctl start avahi-daemon.service
# systemctl enable avahi-daemon.service

Restart the user service

$ systemctl --user restart pulseaudio.service

Some times I was experiencing choppy sound. I did the following to remedy this

# tee /etc/libao.conf

And whenever I’m getting choppy sound again, as I usually do for the initial song I play on SoundCloud, I restart the pulseaudio user service again and all is fine.

Now I’m able to use pavucontrol to select audio outputs for specific applications on my system.


If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.