AirPi – AirPlay audio with Raspberry

update here

Raspberry Pi Media Center book by Sam Nazarko is available at amazon.com and amazon.co.uk.

I always wanted to stream music from my music player using network to serve each room. With AirPlay, Apple gave me an easy way to achieve it, but requires more device from that company. An Airport Express costs 99$/€, and even if I love my iPhone and my MacBook, I will never pay for a an Airport or AppleTV device.

With RaspberryPi, the foundation gave me the solution ! Around 30$/€ and some recycled extras, and we are up to enjoy AirPlay Audio, open source and low-cost. It relies on shairport, and we’ll make it without pluging any keyboard, mouse or display.

If we need a Video support, just deal with RaspBMC. But if you only want an audio player, read the rest of the post ;)

Install Raspbian “wheezy”
Follow instructions given on the official raspberry website. Once you have your SD card ready, insert it in your Pi then plug Ethernet and Power cables in.

First boot and login
To log into your Pi with SSH, you need to know its IP adress.
If you have a decent DHCP/DNS server on your network, the Pi should have been registered on your DNS, so try ping raspberrypi from your computer command-line.

If it doesn’t work, you may try to log into your router to see DHCP leases/allocations.
You can also try all IPs of your network range, or use a network scanner like Fing (iOS) or Scapy (python).

 

When you have your Pi’s IP, you can login using SSH :
On Windows, you will need to download and install Putty.
On Linux/MacOS, open a terminal then type : ssh pi@raspberrypi (or replace raspberrypi with its IP)
When prompted, type the password raspberry

Right now, the first thing to do is to configure your raspbian :

pi@raspberrypi:~$ sudo raspi-config

I suggest to first update, then expand the filesystem, change the password, the locale and timezone. Keep SSH enabled and desktop start disabled. Finish and reboot when prompted.
It may take some time to expand the filesystem at reboot. Just wait few minutes then login using ssh again.

Gaining root access
root user is disabled for login, but you can become root if you are already logged to avoid multiple sudo

pi@raspberrypi:~$ sudo su
root@raspberrypi:/home/pi# cd
root@raspberrypi:~#

Upgrade Debian
At this step, it’s a good idea to upgrade pre-installed packages :

root@raspberrypi:~# aptitude update
root@raspberrypi:~# aptitude upgrade

Change audio output
To force audio output to stereo jack, a single line is required :

root@raspberrypi:~# amixer cset numid=3 1

Install shairport
Before download and compile shairport, we need to install prerequisites :

root@raspberrypi:~# aptitude install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils

Then download shairport sources and compile it :

root@raspberrypi:~# git clone https://github.com/albertz/shairport.git shairport
root@raspberrypi:~# cd shairport
root@raspberrypi:~/shairport# make

Finally, launch shairport foreground :

root@raspberrypi:~/shairport# ./shairport.pl -a AirPi

You can now use your iDevice to try AirPlay audio, don’t forget to plug an headphone or speakers into the 3.5mm stereo jack.

If you want or need your Pi load automatically shairport, follow next procedure :

root@raspberrypi:~/shairport# make install
root@raspberrypi:~/shairport# cp shairport.init.sample /etc/init.d/shairport
root@raspberrypi:~/shairport# cd /etc/init.d
root@raspberrypi:/etc/init.d# chmod a+x shairport
root@raspberrypi:/etc/init.d# update-rc.d shairport defaults

Before starting the daemon, we have to add the AP Name in the launch parameters. Edit the file using nano shairport then change the DAEMON_ARGS variable line so it looks like to :

DAEMON_ARGS="-w $PIDFILE -a AirPi"

Replace AirPi by whatever you want, save, quit and start the service to enjoy shairport in background and your AirPi :

root@raspberrypi:/etc/init.d# ./shairport start

To go more further, we can replace the Ethernet cord by a WIFI USB dongle, make a hole in a tupperware case for the power and audio cord, then place the Pi inside to get a bathroom-ready AirPi ;)

You may notice some glitchy noise. This is due to the analog output, which is not a real DAC, but a simple PWM generator. A USB sound card will give you a better audio quality.

110 thoughts on “AirPi – AirPlay audio with Raspberry

  1. Thanks! Everything worked ok until I did the part on making it a daeamon. I can’t start the service because it says buffer value must be > 30 and < 512? Where can I set that value?

    • No idea about what happened for you.
      If you succeed to launch a process foreground, you may have altered the init script.

    • I got that error when I mistakenly launched “./shairport” instead of “./shairport.pl”, so check your postfixes :)

  2. Fantastic article – thanks for putting this together! No installation problems whatsoever. I now have an airplay-enabled car :)

  3. After playing 2-4 min, im starting to get cropping sound with underuns. Its kinda useless now. Any way to fix? I have tryed two times on fresh rasbian install.

    • I think the most reasonable things to do is to wait at least the GM release of iOS6 ! But thanks for the recommandation. I will update when iOS6 will be release.

    • And in more detail, here’s how to switch to the hendrikw82 version of shairport, handling the perl-net-sdp stuff.

      sudo su
      cd /etc/init.d
      ./shairport stop
      cd
      mv shairport shairport_old
      aptitude install libmodule-build-perl
      git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp
      cd perl-net-sdp
      perl Build.PL
      ./Build
      ./Build test
      ./Build install
      cd
      git clone https://github.com/hendrikw82/shairport.git shairport
      # and the rest is repeating the install instructions from the original post
      cd shairport
      ./shairport.pl -a AirPi
      # check it works then Ctrl-C
      make install
      cp shairport.init.sample /etc/init.d/shairport
      cd /etc/init.d
      chmod a+x shairport
      update-rc.d shairport defaults
      nano shairport
      # edit DAEMON_ARGS line: eg DAEMON_ARGS=”-w $PIDFILE -a AirPi”
      ./shairport start

  4. Thanks for the tutorial – as Adam states – You will need to use the revised version of shairport for ios6 – but it seems a lot less buggy that the initial RaspBMC version I use to run, its just replaced one of my Apple Expresses :)

    Cheers

  5. Thanks for the tutorial – a real godsend! I am having one problem though and its driving me insane…

    I can see my Pi via Airplay from any of my iOS devices. So, in that respect I know it is installed and receiving audio, as it was sending to the analogue output as per your instructions above. I also have an external USB device setup, and I know this is working OK because if I type “aplay [soundfile]” it plays with no problems. However when I send audio from my Mac to the Pi via AirFoil, I get nothing. Its almost as if the audio is internally routing to the onboard soundcard or something.

    Any ideas? I’ve a feeling it is easily solved by my fairly limited Linux knowledge is making this rather hard…

    many thanks!

    • Did you try to plug an headphone or speakers on the Pi jack ?

      Another thing, when launching shairport foreground, it may give you some log to explain the problem. I don’t have a usb sound card to try it…

    • I started something playing via AirPi and plugged the same lead into the headphone socket. No joy. Given it did work before, I’m assuming that output is now disabled… but still nothing is coming from the USB soundcard.

      The weird thing is that if I just do a simple “airplay [file]” then it *does* play from the USB soundcard. So by default (unless I’m presuming something wrongly here) audio is going to the USB device…

      I’m stumped. How can I launch Shairport in the foreground? That might at least give me some more info to go on…

    • My apologies!

      Ran it, and get the following:

      “avahi daemon terminated or ‘avahi-publish-service’ binary not found at ./shairport.pl line 236, line 23.”

    • Really weird, as avahi is used for the discovery protocol (Bonjour), so you should not be able to see your Pi with the iPhone Music player. Check you have it with sudo aptitude install avahi-utils.

  6. Anyone tried connecting to gtihub.com today?

    My connection keeps timing out and I’m unable to clone shairport. Tried hendrikw82 with same result

    Any ideas?

  7. Hey, thanks for the excelent tip!
    Do you have any idea on how to get it running on XBian? …using hdmi audio.

    • Would it not be the same process? I guess it depends if you mean “running in XBMC on Xbian” or just “running on the Xbian distro itself”…

    • to use hdmi audio output :
      amixer cset numid=3 2

      but XBian may suffer the same issue than RaspBMC and openELEC, on the sound driver.

  8. Having problems installing, which seem to be based around the e2fslibs package – when I run the aptitude upgrade, it has problems installing this package, and then the shairport installation fails because it “cannot create a file for the e2fslibs package.” Any ideas anyone?

    • certainly an issue with the package repository, try again later (sudo aptitude update && aptitude upgrade)

  9. Very nice tutorial! Thanks!
    Is it possible to send play/pause and forward/backward commands to the iOS Device?
    This would be very nice.

  10. This is exactly what I’m looking for – great stuff, thanks!

    My current situation is that I have audio working well via the headphone out into my hi-fi amp – but the sound quality is (as expected) noticeably worse than my current optical connection between my Airport Express and my Hi-fi DAC (Cambridge Audio DAC Magic) – so I’m looking to use USB audio from the Pi.

    I have tried AirPi with both the DAC Magic and a portable Ibasso D12 DAC/Amp combo and in both cases, I get no audio and the following error:


    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition ‘cards.BRCM bcm2835 AL.pcm.front.0:CARD=0′
    ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM front

    missing frame.
    bye!”

    Is there a further step to have it recognise these DACs? Any help appreciated.

    • according to the rasberrypi.org theres issues with Audio using USB not many devices recognized yet so as with most DAC hardware we will have to wait. for them to fix the USB issue

  11. Fantastic step by step instructions – worked first time, thank you. As a linux newbie, I’m totally reliant on this kind of stuff to get me started – otherwise I’d be lost. Alas, the stereo sound quality of the Pi is just too rubbish to be of use. Sure, USB sound cards might help, or I could take the digital audio from the HDMI port I guess. However, this all spoils the ‘everything in one small, cheap box’ promise of the Pi. For now, it’ll be relegated to me playing with linux rather than doing very much useful with it. Anyhow, thanks again for getting me this far and enabling me to make that decision!

  12. Awesome post! Thanks for writing this all up. It worked flawlessly for me. I also added the following line to the shairport script to have the output volume of the RaspberryPi set to the maximum (without clipping) upon starting the service:
    amixer set PCM 1dB
    amixer set PCM 1dB-

    The reason for the two commands is for some reason, “amixer set PCM 0dB” doesn’t have any affect on the volume (although amixer reports it’s set to 0dB gain).

    • Hi Arsham, thanks for the tip about the max volume control. As a complete newbie I could do with some step-by-step instructions though?

      I don’t know what / where the shairport script is or how to add those two lines to it. Sorry for asking such a basic question. Have searched for help but come up blank.

      As an aside, audio quality on the pi from the analogue audio jack is much improved – definitely usable now!

  13. very helpful article, unfortunately i made the recent raspian update (2012-09-18-wheezy-raspbian) after that shairport didnt work anymore. I re-did all your steps but when i try to start shairport via ./shairport.pl -a AirPi i get the following error:
    avahi daemon terminated or ‘avahi-publish-service’ binary not found at ./shairport.pl line 236, line 23.
    bash: DATA: Datei oder Verzeichnis nicht gefunden

    Any idea to solve the problem are appreciated.
    thx

  14. Same here! I guess it would be better to wait for the latest version of raspbmc and install shairport on top of it …

  15. Excellent Post. Audio worked fine. No issue. No distortion.
    But I don’t get video. When I play a movie, I get the audio via my RasPi but the video is still in my iPhone. How do I also stream the video to my RasPi?

    Venky

    2012-09-18-wheezy-raspbian
    sound over HDMI.

    • No luck so far. I am going to explore xmbc in RasPi.
      I guess shairport is based on AirPlay V1 (Audio Only). Video is supported only in AirPlay V2.

  16. To get the current release going just install cpanminus, configure cpan for “sudo” and install the Net::SDP package as a last additional requirement.

    # sudo apt-get install cpanminus
    # cpan

    when asked go for “sudo” and close the cpan shell with quit
    # sudo cpanm Net::SDP

    Now you are good for the shairport fork
    # git clone https://github.com/hendrikw82/shairport
    and continue like before

  17. By the way, I had one of these USB sound cards lying around:
    http://www.amazon.com/Behringer-UCA202-USB-Audio-Interface/dp/B000J0IIEQ

    And it worked with the RPi with very little effort, powered off the RPi and everything. Sounds pretty good testing through DJ headphones.

    I did edit one file to set the USB device as default:

    sudo nano /etc/asound.conf

    commented out whatever’s there, and added:

    #USB audio
    pcm.!default {
    type hw
    card CODEC
    device 0
    }
    ctl.!default {
    type hw
    card CODEC
    }

    CODEC is the name ALSA sees it as.

    Now I got a DIY airport express for only the low low price of an RPi + USB card + wifi dongle + Power adapter + case + lots of my time futzing around ;) But hey, it’s for fun.

    Hope this helps someone, as I think we’re all finding the analog audio out just plain sucks.

  18. If I were using a USB Wi-Fi dongle, could I theoretically create an ad-hoc network and use airplay over that, essentially eliminating the need for the router? I’m really new to linux so sorry if that’s a dumb question.

  19. “Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
    BEGIN failed–compilation aborted at ./shairport.pl line 48.”

    appears when I try to ./shairport.pl -a AirPi

    What am I missing?

  20. I have install the fix for ios 6(I think I installed it right with the git clone command)and I have installed hairtunes as it was saying it cant work with out it and I did the cpan command now it has an error saying:
    Audio StreampBUu6RCdyFv9r2r8nFfvHw==sh: 1: /root/shairport/hairtunes: Permission denied
    Use of uninitialized value $portdesc in pattern match (m//) at ./shairport.pl line 684.
    Use of uninitialized value $portdesc in concatenation (.) or string at ./shairport.pl line 684.
    avahi daemon terminated or ‘avahi-publish-service’ binary not found at ./shairport.pl line 237.

    Help me thanks.

    • Nevermind I did some random things and I got it to work. Sorry I cant tell you cause I cant remember.

  21. Great stuff! But I have a problem:
    after typing ./shairport.pl -a AirPi there comes: Can’t locate Net/SDP.pm in @NC (@INC contains etc/perl user/local…….) at ./shairport.pl line 48. BEGIN failed–compilation aborted at ./shairport.plline 48.
    Someone an idea??
    Thanks!

  22. I’m running into some problems:

    root@raspberrypi:~/shairport# ./shairport.pl -a AirPi
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = “UTF-8″,
    LANG = “en_GB.UTF-8″
    are supported and installed on your system.
    perl: warning: Falling back to the standard locale (“C”).
    Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
    BEGIN failed–compilation aborted at ./shairport.pl line 48.

  23. Thanks to you guys for helping with this! must say! It is much more stable than what i experience with raspbmc! So thumps up! and also thumbs up for you @Paul for

    cpan install Net::SDP

    I would not have guessed!

  24. I’ve had trouble with shairport crashing when I disconnect and the reconnect. I have found disabling ipv6 on osx sorted it out for me.

  25. So I get this error:
    root@XBian:~/shairport# ./shairport.pl -a AirPi
    Failed to create client object: Daemon not running
    avahi daemon terminated or ‘avahi-publish-service’ binary not found at ./shairport.pl line 237, line 23.

  26. I have tried everything but can’t get it to work. Continuously running into the ‘avahi-publish-service’ problem.

    Is there an easier way of doing this. I’m a Linux newbie and am not seeing the forest for the trees.

    Thanks

  27. Please tell which distro you are using when posting your issues.
    Did you double check prerequisites given in the article ?

    • I am using wheezy and I finally got it to work. I was apparently missing some packages.

      Thanks for all the instruction.

  28. Hi all
    Great post.
    I’ve installed latest wheezy (oct 18) and used the IOS6 fix.
    Everything worked out of the box from start.
    The only problem i have in this first test, is a loud ‘click’ when i switch music to the Pi
    first time. (Not so good for the loudspeakers at high volume)

    Anyone else seen this ?
    br,
    Peter C

  29. If you have issue with avahi service try this on arch:
    systemctl enable /usr/lib/systemd/system/avahi-daemon.service

  30. What if I want to do the opposite? Stream audio from the RaspberryPi to another Airplay receiver?

    I was thinking of using the command line mplayer on the RaspberryPi to play the file and send the audio to an airplay speaker. Maybe send it to another RaspberryPi with shairport on it or my Apple TV.

  31. Hi Trouch,

    Thanks so much for this, got my pi working perfectly.

    Just a tip for anyone looking for a cheep all-in-one USB speaker I have my pi working first time with a Altec Lansing Orbit USB iML237. It’s powered from the pi so no batteries or additional power sources and uses it own sound card so no pops like the built in card. It only cost me £20 from eBay and sounds amazing for the size. No drivers needed just plug in and boot pi that’s it! :-)

    Has anyone had any success with making their pi read only which would allow the power to be cut without a shutdown on a regular basis?

    Thanks,
    Dom

  32. Hi, I have managed to get it all running, however, it does not appear on my iPhone. Do you have any suggestions?

  33. Hi All,
    Having some issues with the audio via HDMI. I’ve set everything up correctly, and can see the device showing in iTunes, but when I redirect the audio to it, the amplifier that it’s connected to shows no audio. Well, it detects something, but just flashes then goes out, then flashes again and goes out.

    I’ve set amixer cset numid=3 2 to make sure the audio goes through the HDMI, but still nothing.

    It’s a Sony muteki amplifier that it’s connected to, and I can see the video on the TV perfectly.

    When I connect my laptop in via the same HDMI cable, the audio works perfectly.

    Any suggestions would be great!

    • Did you try with with the analog output (and a headset for instance) to check AirPi is correctly working ?

  34. I’m getting far too many overruns on both HDMI and with the headphone jack outputs.

    I’ve built both the versions of shairport mentioned in this article, yet the symptoms are still there.

    This is on the latest Raspbian running on a Model B using an RJ-45 connection.

    Any suggestions.

    Damian

  35. Hi, Thank you for a great tutorial. I have done all but cannot make work. Actually it all works fine, just no sound comes out from analog audio out nor HDMI. I have tried test audio (..front.wav) and that worked. My iPod touch lets me select AirPi, then I start play, it shows album cover in few seconds, the play icon on the iPod status bar shows fine but there so sound coming out from the RPi output. Could somebody help? I am new to Raspberry Pi.
    Thank you

    • how do you start airpi ?
      using the /etc/init.d startup script or using shairport directly from the command line ?
      By using shairport foreground on the command line, you may have some error display to understand what happen.

  36. Thanks for your reply trouch. It starts at boot from the /etc/init.d folder. I have stopped it and started manually from the command line: in shairport folder “./shairport.pl -a AirPi”, after few seconds it shows line “Established under name ‘xxxxxx@AirPi’” (where xxxxxx is a string of digits and letters) and stays there, no errors or other messages. AirPi is now available on iPod. Still no audio from outputs. I wonder if I need to add a user to a group/session as a warning “PulseAudio configured for per-user session” shows while booting up or halting.
    Thank you for your help.

  37. Hallo zusammen,

    vielen Dank für die super Anleitung, ich bin an dem Absturz bei iOS 6 Geräten fast verzweifelt.
    Mir als relativ unerfahrenen Nutzer ist es mit dieser Anleitung auf Anhieb gelungen auf einem Rechner den Dienst ganz normal zu starten und zu stoppen. Auf einem zweiten hatte ich eine alte Version von Shairport (die ohne iOS 6 UNterstützung installiert und bin gemäß dieser Anleitung vorgegangen. Wenn ich Shareport über /usr/local/bin/shairport.pl starte läuft es einwandfrei. Wenn ich versuche es über den Dienst zu starten /etc/init.d/shairport start läuft es nicht.
    Hatte mehrfach alles wieder deinstalliert und wieder installiert, aber ich finde den Fehler nicht und habe keine Ahnung wo ich suchen soll.
    /etc/init.d/shairport status
    liefert
    status: Unknown job: shairport
    Das bekomme ich aber auch auf dem Rechner angezeigt, bei dem es funzt.

    Der Rechner auf dem es funzt ist ein eeePC mit 12.10 32 bit
    Der Rechner auf dem es nicht funzt ein normaler Quadcore mit 12.10 und 64 Bit.

    Die /etc/init.d/shairport ist identisch, bis auf den Namen (-a XYZ)

    Kann mich einer in die richtige Richtung schubsen?
    Bin seit 2 Stunden am googeln und finde keinen Anhalt.

    Danke!!
    Daniel

  38. as soon as I try to launch shairport I get this error:

    Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
    BEGIN failed–compilation aborted at ./shairport.pl line 48.

  39. Newbie here, I’m following your instructions, but get the following error:

    shairport.git/info/refs not found – did you run git update-server info on the server..

    Tried for both ‘albertz’ and ‘hendrikw82′ .git URL

    A little help?

  40. I only get this message when I want to execute shairport:

    root@raspberrypi:/usr/local/bin# ./shairport.pl -a AirPi
    Can’t exec “avahi-publish-service”: No such file or directory at ./shairport.pl line 275.
    Can’t exec “dns-sd”: No such file or directory at ./shairport.pl line 280.
    Can’t exec “mDNSPublish”: No such file or directory at ./shairport.pl line 286.
    could not run avahi-publish-service nor dns-sd nor mDNSPublish at ./shairport.pl line 290.
    **************************************
    * IO::Socket::INET6 not present! *
    * Install this if iTunes won’t play. *
    **************************************
    what should I do now? Im running on a raspi..

  41. Great tutorial thanks!

    Just one question, when running as daemon, is any of the output shown when running in the foreground outputed to a log? If so, where is it?

  42. can’t get it to work – although shairport does seem to be running with an “Established under name ‘xxxxxxxxxxxxxxxxxxxxxx@Airpi.

    When doing the perl Build.pl command i get
    root@raspberrypi:/perl-net-sdp# perl Build.PL
    WARNING: the following files are missing in your kit:
    Makefile.PL
    META.yml
    Please inform the author.

    Created MYMETA.yml and MYMETA.json
    Creating new ‘Build’ script for ‘Net-SDP’ version ’0.07′

    Is this the reason why I can’t see Airpi -and any answers how I can make it work??

  43. as you were – one can ignore the error messages. It works on the ipad. I was trying to get it to work with Android’s airtwist – which doesn’t work.

  44. Great tutorial, thanks!

    All’s working fine until I quit Terminal on my Mac. As soon as I quit, AirPi closes and the music stops. I need to reopen Terminal and go through the startup process again.

    Shouldn’t the raspberrypi keep running in whatever state it was in regardless of whether Terminal is open or not.

    Also, I lose the command line when it starts. I’ve pasted below what happen inside Terminal once it starts. That just keeps writing lines about missing packets every minute or so.

    Any help greatly appreciated!

    —————————————-

    root@raspberrypi:~/shairport# ./shairport.pl -a AirPi
    Established under name ’7F827F25C26E@AirPi’
    Audio StreamkZTkqR01xYesa27Iyh+kQw==ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

    missing frame.
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 1 packets (port 53210)
    requesting resend on 9 packets (port 53210)

    • As I finished typing my last post it cut out again. This is what the final response was:

      ——

      missing frame.
      bye!

    • Sorted it out.

      I was starting the app with:

      ./shairport.pl -a AirPi

      rather than

      ./shairport start (as outlined in the instructions.)

      All’s working beautifully, thanks!

  45. Anyone have any luck getting video out? I understand the limitations of airplay v1 (audio only), but since they’re doing it in RaspMC (so I’ve heard) I assume it’s possible.

    Thanks for the instructions- works great using both analog and digital outputs.

  46. I get this error when trying to start the Airpi…
    Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
    BEGIN failed–compilation aborted at ./shairport.pl line 48.

    • Exactly

      root@raspberrypi:~/shairport# ./shairport.pl -a AirPi

      Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
      BEGIN failed–compilation aborted at ./shairport.pl line 48.

    • Solved Thx Paul

      Paul on 2 October 2012 at 19 h 28 min said:

      “If you get the error message “Can’t locate Net/SDP.pm in @inc” execute the following command as root and accept all defaults during configuration of cspan:

      cpan install Net::SDP

      Now it seems to work :)

  47. I know this isn’t in line with the intent of the original hack, but I have a windows box on my network near my media centre already, so I installed a virtual box with Ubuntu and followed the recipe. Worked perfectly first time.
    I just have a problem with the sound quality (remember I’m not using a raspberry yet)
    I have good network speeds even in the virtual box, and the sound coming through from the box (if I play an mp3 or something) is great, but streaming from my phone or ipad the quality is horrendous, I am new to this kind of stuff, I was just wondering if anyone can point me in a direction of where I can find come kind of tweakable values for the streaming quality or audio output quality for the stream specifically.
    I’ve ordered a Raspberry – and when it arrives, I want to set it up as an in-car system. but if possible, I’d like to keep my virtualbox setup for my living room.

    • If I run as root – sudo ./shairport/shairport.pl -a Air.Buntu
      The sound quality is a lot better – I’d be really interested to know what the difference is.
      And if it runs as a deamon / service at startup, the sound is bad again.
      Any ideas or suggestions?
      Steve

  48. AirPi is now running on Raspian “wheezy” powered Pi. Thank you for all the tips and comments – they were invaluable. There are still big pops on start up and between songs – but USB sound card is an easy fix. No project is ever really finished, so my next challenge is to get the audio to play via FM 100 MHz from GPIO pin 4 as I’ve seen with RadioPi. My car has no AUX jack, so I need to feed the radio receiver. Any hints on how to draw on the AirPi as the source rather than a .WAV file?

    • Hi,
      I’ve tried the radio thing and it didn’t seem to have good reception at all. I had a bit of trouble finding which pin to put the antenna wire on, the youtube video had it on pin 4 and the wiki had it on GPIO4 which I think is something like pin 16 (without pics) so I tried a few ways, with no real boost in signal. I still want to get it working tho, I think it’s a great idea.

  49. Works like a charm – Thanks for posting excellent instructions. Got it working precisely under one hour.

  50. I’m able to send audio out to HDMI port instead of stereo jack port.

    As root, issue mixer cset numid=3 2 (comment: 0=default, 1=stereo, 2=hdmi)
    At first it didn’t work a couple of times, I then issued this command:
    modprobe snd_bmc2835

    it then works for me.
    Hope it works for you too.

  51. I have AirPi running now for quite a while with good results. About 99.5% stable. I use a USB DAC (UD100 – excellent!) with a small Tripath amp and some small speakers. This is my bathroom stereo. So thanks for the instructions and all the updates!

    I would now like to light up a LED when Shairport is running (as a service) and another LED when Shairport receives a stream, i.e. when it is connected to a source.

    Has anyone tried this or worked on this? I have not yet had any experience with GPIO programming but I guess I should start with that!?

    Thanks

  52. Hello there, I have tried to follow these instructions as best as I can. I have been using the root user, I have made sure that my debian has been updated, I installed the prerequisiites and the shairport sources. (I did install them the wrong way round if that would make a difference) but when I try to launch Shairport I keep getting this error:

    Can’t locate Net/SDP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./shairport.pl line 48.
    BEGIN failed–compilation aborted at ./shairport.pl line 48.

    Please help me!

    Thanks

    • Try the following sequence:

      cd ~
      sudo apt-get install libmodule-build-perl
      sudo apt-get install libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl
      sudo apt-get install git-core
      git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp
      cd perl-net-sdp
      sudo perl Build.PL
      sudo ./Build
      sudo ./Build test
      sudo ./Build install
      cd
      sudo apt-get install avahi-utils
      git clone https://github.com/hendrikw82/shairport.git shairport
      # and the rest is repeating the install instructions from the trouch.com post
      cd shairport
      sudo make
      sudo ./shairport.pl -a AirPi
      # check if it works then Ctrl-C
      sudo make install
      sudo cp shairport.init.sample /etc/init.d/shairport
      cd /etc/init.d
      sudo chmod a+x shairport
      sudo update-rc.d shairport defaults
      sudo nano shairport
      # edit DAEMON_ARGS line: eg DAEMON_ARGS=”-w $PIDFILE -a AirPi”
      Ctrl-X, Y, Enter
      sudo ./shairport start