A music playback device based on a Raspberry Pi 3
Pulseaudio requires a special user called pulse
that is in the group audio
. Create them with the following commapnds
useradd --home-dir /var/run/pulse pulse
gpasswd -a pulse audio
Get root
with su
and password root
, then install a system update and the required packages:
pacman -Syu alsa-firmware alsa-lib alsa-utils avahi pulseaudio pulseaudio-zeroconf
/etc/pulse/system.pa
Append to the config file:
# Enable the native pulseaudio protocol, restrict to ip groups
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.2.0/24;10.0.0.0/23
# Publish the audio stream via zeroconf (so other pulseaudio instances can see it)
load-module module-zeroconf-publish
# Publish the first alsa card as "Stereoanlage"
load-module module-alsa-card device_id=0 sink_name="Stereoanlage"
/etc/systemd/system/pulseaudio.service
Create the file:
[Unit]
Description=pulseaudio System Service
[Service]
type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disallow-module-loading
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
This defines a new systemd service called pulseaudio
which will run pulseaudio
/boot/config.txt
Append to the file:
dtparam=audio=on
audio_pwm_mode=2
This change enables the audio DAC and provides an alsa soundcard.
systemctl --global disable pulseaudio.service pulseaudio.socket # disable all user pulse audio
systemctl enable pulseaudio # enable our systemwide pulse audio service
systemctl enable avahi-daemon # enable zeroconf discovery
reboot
After this, the pulseaudio sink is readily configured to be used with other pulseaudio installations
Use alsamixer
to adjust the volume for PCM audio
This runs the pulseaudio like in the service
/usr/bin/pulseaudio --system --disallow-exit --disallow-module-loading
This downloads a small example file (sounds like a coin in super mario world) and plays it via aplay
to test if the soundcard works:
curl -O https://mq32.de/public/mariocoin.wav
aplay mariocoin.wav