View on GitHub

Pulseaudio-raop2

Experimental RAOP2 (Apple AirPlay2) support for PulseAudio

Download this project as a .zip file Download this project as a tar.gz file

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.

See the commit history for details.

News

Main branch is now raop2-for-merge2 (1/28/2014)

I have switched to raop2-for-merge2 branch.

Main branch switched again (9/13/2013)

I have switched to raop2-for-merge1 branch. Patch sequence was rebased against the latest master of PulseAudio. This patch set corresponds to the patches which I submitted to pulseaudio-discuss mailing list.

Main branch switched (9/5/2013)

I have switched to raop2-for-merge branch. This branch provides both TCP and UDP protocol implementations.

If you clone the repository now, you will get the latest branch by default. If you already cloned my old v4.0+raop branch, the following commands should allow you to switch to the latest branch:

$ cd pulseaudio-raop2
$ git fetch origin
$ git checkout -b raop2-for-merge origin/raop2-for-merge

Current status (as of 10/14/2013)

Known issues

As of 10/14/2013

Warnings

How to try

Since I'm using Ubuntu 13.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
sudo apt-get build-dep pulseaudio

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

You should be in the raop2-for-merge2 branch.

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.

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 e-mail me at Hajime Fujita crisp.fujita@nifty.com, or you can post a new issue at github (probably a github account is required). Also, this topic (raop2 support) is actively discussed at PulseAudio Bug 42804.

Related information

Other implementations

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

Protocol information