Raspberry Pi MPD streaming using PulseAudio

I have a Raspberry Pi as a music player using MPD. This is a local solution only, all the music files must be on the Pi SD card.

One of my original aims for this project was to have multiple players throughout the house, keeping the music updated on all players would be a pain. A centrally stored solution would be much better. Also I would like to be able to play the same song in multiple rooms in the house.

The plan was to have a number of Pis in various rooms connected to amplifiers and speakers. They would be network connected via WiFi or cable. Music would then be streamed to them.

Luckily I have an old laptop that is always on as my MythTv. This is running Fedora, is networked and has a large disk. This is an ideal place to store all the music and act as a music server. It is actually already all there as MythTv has a music player.

On the server I have MPD and PulseAudio installed. Setup MPD to use an audio output of pulse with a rtp sink, this will stream the audio using PulseAudio over the rtp protocol. This will ensure that all players are in sync. Add this to the mpd.conf on the server.

audio_output {
 type "pulse"
 name "Lounge"
 sink "rtp"
}

On the Raspberry Pi player MPD is no longer needed. Configure PulseAudio to receive from rtp. PulseAudio will need to be started in service mode rather than user mode. Here are some links of how it is all done.

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=25684&p=241289
http://www.hackerposse.com/~rozzin/journal//whole-home-pulseaudio.html
http://fruit.je/mpd-rtp

On the server change the following the /etc/pulse/default.pa

load-module module-null-sink sink_name=rtp format=s16be channels=2
load-module module-rtp-send source=rtp.monitor

This sends rtp to pulseaudio’s default multicast address, 224.0.0.56

On the player edit /etc/pulse/system.pa.

load-module module-rtp-recv

This was all very good but I found the rtp flooded my wireless network. During search to find a solution it looks like it is a long standing PulseAudio issue.

https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/411688

There were some workarounds but this was getting too complicated.
On to a different way of doing this.

Advertisements

One thought on “Raspberry Pi MPD streaming using PulseAudio

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s