What is this?

This is an ongoing effort to make it possible to stream musics from PulseAudio to recent AirPlay-capable devices (e.g. Apple TV, AV receivers).

Apparently there are two versions in AirPlay protocol. The older version (version 1) only uses TCP for audio streaming. Version 1 is supported by PulseAudio, in a form of raop module. (RAOP stands for Remote Audio Output Protocol, a protocol underneath AirPlay.) However the newer version 2, which uses UDP as well, is not supported by PulseAudio (as of v4.0). Probably most AirPlay devices today support version 2, which makes it impossible for PulseAudio users to play their music over AirPlay.

Brief history

There have been a few efforts to address this issue. First Christophe Fergeau started a project to support raop2. Later Martin Blanchard continued to enhance Fergeau's work. My work is actually based on Blanchard's work, meaning that it is also based on Fergeau's efforts.

Here are the several differences from Blanchard's work.

Then recently Colin Leroy rebased my & Martin's latest patches on PulseAudio 5.0.

See the commit history for details.

Current status (as of 5/27/2016)

Known issues

As of 10/14/2013

Warnings

How to try

Since I'm using Ubuntu 16.04, I'll give you an instruction in Ubuntu. Should be similar in Debian or other Debian/Ubuntu-based distros. For other systems, please send me a patch for this page if you figure out how.

0. Prerequisites

Install some packages:

sudo apt-get install build-essential paprefs git pulseaudio-module-raop intltool libavahi-client-dev
sudo apt-get build-dep pulseaudio

(Thanks Stephan Henningsen for pointing out intltool and Denilson Figueiredo de Sá for pointing out libavahi-client-dev!)

1. Retrieving the code

$ git clone https://github.com/hfujita/pulseaudio-raop2.git

or

$ git clone git@github.com:hfujita/pulseaudio-raop2.git # if you have github account and registered your key

Note: tarball or zip won't work because PulseAudio build system relies on git revision information.

2. Building the software

As written in pulseaudio-raop2/README

$ cd pulseaudio-raop2
$ ./autogen.sh
$ CFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" ./configure  # See below
$ make

FYI, here is my command line for configure, taking some parameters from the Ubuntu PulseAudio package.

$ CFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" ./configure --prefix=$HOME --enable-x11 --disable-hal-compat

3. Before running the new PulseAudio

paprefs

PulseAudio should be configured so that it will discover AirPlay devices on the network.

$ paprefs &  # This is an X application

In the Network Access tab, turn on Make discoverable Apple AirTunes sound devices available locally, then close the application.

Firewall

If you are using personal firewall (e.g. ufw or iptables), it should allow UDP packets to come in and go out between the AirPlay device. I can hardly tell which port should be opened, as ports are dynamically chosen.

Disabling autospawn

In your environment, it is likely that PulseAudio is already running. First you need to stop it. However, by default PulseAudio re-spawns automatically even if you stop it manually.

$ echo "autospawn=no" >> ~/.pulse/client.conf

This will disable autorespawning (thanks to this page). You may later remove this directive if you lose interest in PulseAudio experiments and want to go back to the original configuration.

Then, finally we are ready to kill the existing PulseAudio daemon.

$ pulseaudio -k

Ubuntu desktop users will see that the sound icon on the status bar changes.

Configuration file for local devices (for PA 5.0 and later)

If you are currently using PA 4.0 or older version, you need to copy a configuration file in order to use local devices (internal speakers, headphones, HDMI, etc) other than AirPlay devices.

$ cp /usr/share/pulseaudio/alsa-mixer/profile-sets/extra-hdmi.conf \
   $PA_SRC_DIR/src/modules/alsa/mixer/profile-sets/

Replace $PA_SRC_DIR with your pulseaudio working directory -- a directory to which you cloned the tree.

(Thanks Colin Leroy for this tip!)

4. Launching the new PulseAudio

$ ./src/pulseaudio -n -F src/default.pa -p $(pwd)/src/ --log-time=1 -vvvv 2>&1 | tee pulse.log

Actually, options after -p $(pwd)/src/ are optional (logging purpose), but definitely helpful for troubleshooting.

In the sound setting dialog, you'll see your AirPlay device as an output device. Select your device and start your favorite music.

Have fun!

When you are done, press Ctrl+C to kill the program. If the program hangs up and doesn't accept Ctrl+C, do

$ pkill -KILL pulseaudio

(5. Relaunching the original PulseAudio daemon)

After you finish the experiment, you can launch the original PulseAudio daemon by

$ pulseaudio -D

6. Updating the source tree

To get the latest patches from my repository, run:

$ cd pulseaudio-raop2
$ git pull

Tested music players

Works well

Rough sound

Tested device

Please send me a report if you have any experience with your device. Both positive/negative results are welcome.

Contact information

Please post a new issue at github (probably a github account is required). You can also e-mail me at Hajime Fujita crisp.fujita@nifty.com but for general questions/bug reports/feature request etc. github is strongly encouraged because the discussion is open to public, and I tend to lose track of e-mails. Also, this topic (raop2 support) is discussed at PulseAudio Bug 42804.

Related information

Other implementations

Some other raop2 implementations which allegedly work. (I've not actually tested though.)

Protocol information