SHAIRPORT ON ARCH LINUX ON RASPBERRY PI

I have a Raspberry Pi with Arch Linux installed and decided to take a crack at installing Shairport which is a service to use Airplay from iTunes for streaming radio from iTunes Radio or your iTunes library. It wasn’t as hard as I thought.

TO MAKE THIS EASY YOU CAN TRY TO DOWNLOAD AND INSTALL MY COMPILED SHAIRPORT PACKAGE. IT MAY OR MAY NOT WORK FOR YOU. IF NOT USE THE DIRECTIONS JUST BELOW.

Download it from here

Install it by typing (assuming you are in the directly the file is. If not, include the path before the filename).

pacman -U shairport-git-sysdcompat-20131111-1-armv6h.pkg.tar.xz

Again if it doesn’t work........start here.

First of all go here to the AUR and get it. Go to the right side of the page and download the tarball

All this assumes your user has sudo privileges. If not switch to the root user.

Put it in your home directory in a folder

cd /home/john (or whatever your home directory is)

mkdir shairport

move your file

sudo mv /home/john/Downloads/shairport-git-sysdcompat.tar.gz /home/john/shairport

cd /home/john/shairport

tar zxvf shairport-git-sysdcompat.tar.gz

Now make sure you have the dependencies installed.

sudo pacman -S avahi glibc libao openssl git

I snuck “git” in on you as it isn’t a dependency for shairport but you need it to get the makefile.

Now

cd shairport-git-sysdcompat

makepkg -s --as root

NOTE: if makepkg chokes you may need to install base-devel

pacman -S base-devel

After that completes.

pacman -U shairport-git-sysdcompat-20131111-1-armv6h.pkg.tar.xz

now enable avahi-daemon

systemctl enable avahi-daemon

then

reboot

After reboot log in and type

shairport -a ArchPi (with anything after the -a any name you want to give it.

It should respond with

“Listening for Connections”

Now go to your Mac, your iPhone, your iPad and select ArchPi as your streaming device. This will work but ONLY with the 3.5mm onboard audio jack on the Raspberry Pi. If you’re good with that, you are kinda sorta done, except for auto starting the app at boot.

If you’re not good with it and want to output sound to another device such as your USB DAC do this:

aplay -l


Screen Shot 2014-03-18 at 8.43.14 AM

My DAC is Card 1 so lets do this


shairport -a Airpi -o alsa -- -d hw:1,0

Screen Shot 2014-03-18 at 9.10.51 AM

Your music should output from your DAC now. View from iTunes.

Screen Shot 2014-03-18 at 3.20.37 PM

View from iPad:
IMG_0359


More later on the scripts file for auto starting........I also run squeezelite player and Logitech Media Server and I’m working through how to elegantly use both with the same DAC with minimal user intervention.

Here’s what I did to get both services running at once. Not very elegant but it does work. The only user intervention required is that the user change the switch for the input on the preamplifier. User friendly for non techie-types.

aplay -l

Screen Shot 2014-03-18 at 5.03.48 PM

Here is how it is done

I hooked up two DAC’s. A Nuforce UDAC2 SE, and a HiFimeDIY DAC. Both USB DAC’s. On the Raspberry Pi the upper USB port contains the powered USB Hub connection. Below it is the Nuforce Dac which is controlled by squeezelite (called from a script and initiated at boot from the crontab).

/usr/bin/squeezelite -o front:CARD=DAC,DEV=0 -n RaspArchPi -s 127.0.0.1 -m 80:1f:02:94:58:b1

A crontab entry was also created for shairport

@reboot shairport -a Airpi -o alsa -- -d hw:2,0
(notice the HiFimeDIY Dac is now card 2 so I made the change accordingly in this command)

Screen Shot 2014-03-18 at 5.11.06 PM

Shairport crashed on me or something happened so I made a file called /root/check_services and added this line.

shairport -a Airpi -o alsa -- -d hw:2,0

then

chmod 700 /root/check_services

Then added this to the crontab

*/5 * * * * /bin/bash /root/check_services

That checks the service every 5 minutes and restarts it if necessary.

Screen Shot 2014-03-19 at 9.14.27 PM
Now all the user need do is select between 2 and 3 on the preamplifier


IMG_0356

And here’s the Pi hooked to the NuForce UDAC. The HiFimeDIY DAC is out of sight in the mess of wires.

IMG_0358