You could use mpd, pulseaudio and raop2 module, if necessary:
- mpd for managing playlists, library, etc (
sudo apt-get install mpd
)
- pulseaudio for managing audio outputs: raop for AirPlay, or any other output device such as analog jack, HDMI, http streaming service, etc (
sudo apt-get install pulseaudio
)
- raop2 module for pulseaudio if the original raop module built into pulseaudio doesn't work
I had to build pulseaudio from source in order to get an updated version of the RAOP module for pulseaudio.
Here's what I did to make it work (it may complain about missing packages, just sudo apt-get install
them):
Install MPD
sudo apt-get install mpd
Install PulseAudio
Choice A: you have an old AirPlay device, or you don't need UDP streaming.
It is easier but less compatible.
sudo apt-get install pulseaudio
Choice B: you want better compatibility, and support for both TCP and UDP streaming
Then you need raop2 module for pulseaudio, which means building PA from source.
Install git if you haven't already, and build pulseaudio (see official instructions):
sudo apt-get install git intltool autoconf build-essential
cd
git clone https://github.com/hfujita/pulseaudio-raop2
cd pulseaudio-raop2
./bootstrap.sh
make
sudo make install
On my setup, I had to symlink libpulse.so.0 manually:
cd ~/pulseaudio-raop2
sudo rm /usr/lib/arm-linux-gnueabi/libpulse.so.0
sudo ln -s `cd;pwd`/pulseaudio-raop2/src/.libs/libpulse.so.0 /usr/lib/arm-linux-gnueabi/libpulse.so.0
sudo chown root.root /usr/lib/arm-linux-gnueabi/libpulse.so.0.16.2
sudo chmod 744 /usr/lib/arm-linux-gnueabi/libpulse.so.0
or, to your preference:
cd ~/pulseaudio-raop2
sudo rm /usr/lib/arm-linux-gnueabi/libpulse.so.0.16.2
sudo mv pulseaudio-raop2/src/.libs/libpulse.so.0 /usr/lib/arm-linux-gnueabi/libpulse.so.0.16.2
sudo chown root.root /usr/lib/arm-linux-gnueabi/libpulse.so.0.16.2
sudo chmod 744 /usr/lib/arm-linux-gnueabi/libpulse.so.0.16.2
Configure everything
MPD initial setup
Now we need to setup MPD:
sudo vi /etc/mpd.conf
In that file, set the following:
music_directory "/path/to/your/music"
user "mpd"
bind_to_address "127.0.0.1"
bind_to_address "192.168.x.y"
bind_to_address "2a01:xzy....your IPv6 if you want"
We will need to edit the output, but we need the name of the pulseaudio sink first.
PulseAudio sinks
Avahi/zeroconf is nice to have because it will enable discovery of AirPlay devices (through zeroconf/mDNS/Bonjour):
sudo apt-get install avahi
Now we can start pulseaudio and try to load the RAOP modules:
pulseaudio --start --log-target=syslog -vvvv --log-level=debug
pacmd load-module module-raop-discover
pacmd list-sinks | grep name:
Here's the output on my setup:
name: <raop_output.Freebox-Player.local>
name: <raop_output.Freebox-Server.local>
name: <raop_output.Freebox-Player.local.2>
name: <raop_output.Freebox-Server.local.2>
You need then to edit /etc/mpd.conf
again and add the following outputs:
audio_output {
type "pulse"
name "Freebox Player"
sink "raop_output.Freebox-Player.local"
format "44100:24:1"
}
Add one of these blocks for every AirPlay device that you wish to stream music to.
PulseAudio configuration
The last part is to setup PA:
sudo vi /etc/pulse/client.conf
Uncomment autospawn = yes
, this will make pulseaudio start automatically when it is needed.
sudo vi /etc/pulse/default.pa
Add the following line at the bottom:
load-module module-raop-discover
This will make pulseaudio load the RAOP discover module when it is started.
Final step
It should be working now. Start MPD (stop it first if it's running):
sudo /etc/init.d/mpd start
Wait a little bit, it takes at least 10-15 seconds on my RasPI before the daemon can work properly.
Update your music library (and wait for it to finish):
sudo apt-get install mpc
mpc update
Enable outputs at will (the following will list the configured MPD outputs and enable the first one):
mpc outputs
mpc enable 1
Now use your favorite MPD client to play some music. I'm using ncmpcpp
on command-line, and MPDroid on my phone/tablet.
Troubleshooting
Start mpd in verbose, pulseaudio with maximum logging level, and monitor logs:
mpd --verbose
pulseaudio --start --log-target=syslog --log-level=debug -vvvv
tail -f /var/log/mpd/mpd.log
tail -f /var/log/syslog
Try to make pulseaudio work first. Just load pulseaudio, load the RAOP discover module, list the sinks, setup the default sink and try to play something:
paplay /usr/share/sounds/alsa/Front_Center.wav
Once you have pulseaudio working, try and make MPD work with it.