raspi-shairport

Preconfigured Airplay speaker (Shairport) – Downloadable Raspberry Pi image

Update 2013-08-31
New image available for download with updates of Shairport, raspi kernel and better startup/watchdog scripts.

This is a preconfigured Raspberry Pi Debian build with Shairport. – Thread on Raspberry Pi forums

Write the image to a SD card (4GB or larger), plug in speakers and network, and an AirPlay-capable player will show up on your network once you boot the Pi up.

Build instructions
Detailed build instructions can be found here

Latest version:
2013-08-31

Download:
Mirror 1

Release notes
2013-08-31 – Updated of Shairport, raspi kernel and better startup/watchdog scripts.
2013-04-21 – First release

Login

Username: pi
Password: raspberry

Misc
Tested with Airfoil (PC/Mac) and Honey Player (Android).
Additional testing welcome. (In particular actual iOS devices!)
More stable builds will be available shortly.

Old versions download:
2013-08-31 (Current version)
2013-04-21

38 thoughts on “Preconfigured Airplay speaker (Shairport) – Downloadable Raspberry Pi image

  1. Pingback: Raspberry Pi Shairport build instructions | Useful snippets

  2. Lawrence

    I built these following instructions elsewhere on the net but messed up the build when I tried to add a password and a USB soundcard.

    Found your image and downlaoding image now – Thanks 0- will save a bit of time!

    Is there instructions for adding a password and USB soundcard anywhere for this build?

    This is the soundcard – http://www.ebay.co.uk/itm/USB-External-3D-5-1-Channel-Audio-PC-Sound-Card-Adapter-/160612635510?pt=UK_Computing_ComputerComponents_SoundCards&hash=item2565425376

    Thanks.

    Reply
      1. Lawrence

        thanks,

        I’ve editied etc/init.d/shairplay to change the broadcast name using JOE – that works fine but struggling with the syntax for the password..

        I’ve seen that switches for starting shairplay include

        -p, –password=secret Sets password

        but not sure the format the line

        user/local/bin/shairport -d -a “$NAME”

        I’ve tried

        user/local/bin/shairport -d -p 1234 -a “$NAME”

        can you help?

        Thanks

        Reply
        1. Phillip

          Hi.
          Any progress on setting the password? I think I have to add a line in /etc/defaults/shairport were I changed AP_NAME – but I don’t know the syntax…
          Thanks for any hints
          Phil

          Reply
  3. Transient Gadfly

    Hey, I’m trying to connect to my shairport pi via airfoil on Mac (tried 10.6.8 and 10.7.2)–in both instances Airfoil fails to connect and responds “could not parse response from remote server”. I’ve run shairport from the command line on the pi with “-vvvv” and I get the following output:

    Listening for connections.
    Established under name '4E502B554875@Shairport on jen'
    received request: OPTIONS * RTSP/1.0
    User-Agent: Airfoil/4.7.5 (Macintosh; N; Intel)
    CSeq: 1
    DACP-ID: 5B555495C449D615
    Apple-Challenge: 1a9jyDbkBBxncxsxohipvw
    Client-Instance: 8F2E848E0541200D
    Active-Remote: 3449327014
    sending response: RTSP/1.0 200 OK
    Apple-Response: rljNiXC1X86wKmTrpMVvU6k2JTW7MrJxf86tgoB18yISDcYF2utKKwEU3rE6tk5+BnV/Odz3bmxxzqQhXyOnnbV8h4neLsIO7EX4CHvWu21hR55SBks/qmf9jKqVRxyUQvShr8xs5c0E+4kwZbuPr0lPIGA2CdmdtpKVr2Lj20yGf9HPFK95o+7MUkMkKu08VcqyI/p0/Xb8d+J+8BIebYStGsANxO/VQnsAWnM0Bwm5QojE6blTYL143VqzbF0t0RdQoAz3Uf212mUleX+PQFKibvENv324fZytaIeC2VoLhw0Uyc6+dV6P1IOLh+hRzDHqkIfslwFnvo3j6fNC5g
    CSeq: 1
    Audio-Jack-Status: connected; type=analog
    Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER
    received request: ANNOUNCE rtsp://192.168.0.3/3452057820 RTSP/1.0
    Client-computer-name: moss
    Client-instance-identifier: E063AC4C-78DD-4AC4-9CCD-96907D9A2D27
    Active-Remote: 3449327014
    DACP-ID: 5B555495C449D615
    User-Agent: Airfoil/4.7.5 (Macintosh; N; Intel)
    Client-Instance: 8F2E848E0541200D
    Content-Type: application/sdp
    Content-Length: 571
    CSeq: 1
    sending response: RTSP/1.0 200 OK
    CSeq: 1
    Audio-Jack-Status: connected; type=analog
    received request: TEARDOWN rtsp://192.168.0.3/3452057820 RTSP/1.0
    User-Agent: Airfoil/4.7.5 (Macintosh; N; Intel)
    CSeq: 1
    DACP-ID: 5B555495C449D615
    Client-Instance: 8F2E848E0541200D
    Active-Remote: 3449327014
    sending response: RTSP/1.0 400 Error
    CSeq: 1
    Audio-Jack-Status: connected; type=analog
    RTSP connection closed

    Any insight as to what might be wrong here? Thanks.

    Reply
    1. Stanislav Khromov Post author

      Hey Transient,

      There seems to be a bug report regarding this on the Shairport issue tracker. You can find the issue here:
      github.com/abrasive/shairport/issues/213 Issues have been removed from the GitHub project.

      This image is running the latest 1.0-dev version of Shairport. (As of today)

      Reply
    2. Juan Diego

      I’m getting this same error on Airfoil for Mac (2.7.x). In addition, right before the Pi prompts the login/password dialogue I get a [FAIL] message startpar: service(s) returned failure: avahi-fix.sh … failed!. Everything works like a charm with iTunes for Mac or the stock Music app for iOS.

      (If someone is having problems with the audio output I suggest trying no to use HDMI for audio output (just connect your headphones/speakers). Otherwise run amixer cset numid=3
      where n is 0=auto, 1=headphones/speakers, 2=hdmi)

      Reply
      1. Stanislav Khromov Post author

        Hey Juan,

        Is this with the downloaded image without modifications?
        Avahi-daemon failing is usually a sign of network connectivity issues (for example Wi-fi that hasn’t connected yet.)

        You might have some luck checking for possible causes to the error in:
        /var/log/messages

        What is the issue with HDMI audio out?

        Reply
        1. Juan Diego

          Yeah, my downloaded file is exactly from this link: https://snippets.khromov.se/files/shairport-configured-latest.tar.gz

          And I obtain local IP before that message of avahi-fix.sh failed. Once in the command line, to ping/curl google.com, for example, works OK. I’m gonna check /var/log/messages anyway. That avahi thing can cause some kind of future error? Cause right now I get nice sound and all but the Pi keeps displaying packet-related errors only while playing music I send from my iPod or Mac.

          And about HDMI, the first time I tried to use Shairport I got no sound at all (neither using the aplay command). That was because the Pi generally does not output sound via HDMI so I tried Shairport without the HDMI plugged in and everything worked fine. Then I fixed the issue by presetting the audio output to sound card which ends at the 3.5mm audio jack. I ran amixer cset numid=3 1 on CLI.

          Reply
          1. Stanislav Khromov Post author

            The file avahi-fix.sh is no longer needed, it was used temporarily to fix an issue with avahi-daemon not starting on .local domain networks. Read more here:
            http://rubenlaguna.com/wp/2007/08/19/avahi-and-local-domain-troubleshooting/

            It was later resolved by changing the avahi-daemon startup config (search for avahi):
            https://snippets.khromov.se/raspberry-pi-shairport-build-instructions/

            Avahi is a fickle service, it seems prone to not start up properly on certain network configurations.

            You need it to run Shairport though. (Shairport will not start if avahi is not running.)

            Regarding the packet errors, don’t worry – the packets will be resent. As long as the sound doesn’t skip you are fine!

            Reply
  4. Josh

    If I unplug the pi, and plug it back in, it completely stops working. I have tried everything I can think of. I then must reformat the sd card to get it working again. I would love to be able to unplug the pi and move it to a different speaker without having to reformat the card every time or plugging in a screen and keyboard. Any Ideas??

    thanks,

    -Josh

    Reply
  5. Benny Kjølhede

    Hej Guys. I can´t get my image on to my sd card useing disktools on my mac. It says all kinds of errors. Do you have any ideas what might be wrong ? And is there a other way i can copy the image over ?

    Reply
  6. Marc

    Hi Stan or any other expert,

    Thanks for this work, it has been very useful … so far.

    I’m trying to change the name of the Airplay network. The off-the-shelf one is “AirPi” when using your preconfigured image. I would like to change to something like “Living Room”.

    I’ve checked the shairport file in /etc/init.d/ however there are no mention of “AirPi” :(

    Can you help?

    thanks
    marc

    Reply
  7. Thomas Pujolle

    Hey there,

    I believe you want to edit the shairport file, which is here:

    /etc/init.d/shairport

    You ‘ll be able to find the name of the speakers there :)

    Now that I’m here, maybe of you can help me! I’m trying to get the most out of my RPi, mainly some high quality music! I’ve set everything so far, and I think it could be much better!

    I’m using Spotify (Deezer, Grooveshark like) to play music, and even though the sound quality is perfect using a jack on my speakers, some frequencies don’t seem this smooth as I listen to what I play.

    Has anyone figured out how to improve this quality? I’m not using the “ready to go” image, I’ve setup everything myself. Do you think using the OS image would work better?

    Thanks guys :)

    Reply
    1. Stanislav Khromov Post author

      Hi Thomas,

      You can improve the audio quality by using a USB DAC instead of the built-in raspi output.

      This article is a good starting point: http://www.raspyfi.com/the-right-usb-dac-for-your-raspberry-pi/

      As for improving the quality on your existing setup, the only thing I can suggest is running rpi-update. This will update the kernel, and sometimes that results in improved audio quality.

      You can get rpi-update here: https://github.com/Hexxeh/rpi-update

      Cheers!

      Reply
    2. Marc

      Thanks Thomas

      Actually within /etc/init.d/shairport the name is set as
      NAME=My Shairport

      although the one shown on my iphone and ipad is “AirPi”

      I would like to change AirPi into “Living Room” for instance … but seems shairport is not the right place?

      anyone can help? thanks
      marc

      Reply
      1. Marc

        Actually, I found the solution!

        In the case of using the ready to go image the file to edit in order to change the Airplay network name is

        /etc/default/shairport

        and NOT

        /etc/init.d/shairport

        Reply
        1. Marco Buongiovanni

          Ciao, io ho localizzato il file corretto /etc/default/shairport ma io non sono in grado di modificarlo perché il sistema mi dica che non ho le autorizzazioni e non sono il proprietario del file.
          Ho provato a cambiare i permessi con chmod comando ma ho avuto lo stesso messaggio.

          Suggerimenti?
          Marco

          Reply
        2. Marco Buongiovanni

          Hi, I have localized the correct file /etc/default/shairport but I’m not able to modify it because system tell me I haven’t permissions and I’m not the proprietary of the file.
          I tryed to change permissions with chmod command but I got the same message.

          Suggestions?
          Marco

          Reply
          1. Stanislav Khromov Post author

            Hey Marco,

            You need to be root to change configuration scripts.

            Run this command before editing

            sudo su
            
            Reply
  8. Thomas Pujolle

    Hi again,

    Has anyone of you encountered some stability issue with the image? When I’m on SSH it appears that the connection gets randomly cut (host is down, I can read). It happens very often, with no particular reason.

    Anyone?

    Reply
    1. Stanislav Khromov Post author

      Hi Thomas,

      That usually happens when there is insufficient power supply to the Pi. The image is configured to use stock 700mhz, with no overclock.

      • Did you overclock the Pi after installing the image?
      • Do you have adequate power supply?

      Here is a great post on Raspi power supply issues:
      http://forum.stmlabs.com/showthread.php?tid=3918

      Reply
  9. jnew

    I am having a problem when I try to run shairport over wifi. Everything loads properly and “AirPi” shows up on my phone. I connect and push play and it works great. It plays without problems for 30-45 seconds and then stops. It will usually cut in and out a little and then eventually crash. If I unhook the wifi dongle and use a LAN connection, I can play music all day without problems. I tried doing the load from Raspbian on my own and had this problem. In researching the issue I found your load and tried it. It worked like a charm but I still have the wifi issue.

    I am currently testing the setup and the pi is about 2 feet away from my wireless router. The link quality on the pi says perfect (100).

    I bought the pi as a set with the wifi dongle and it looks pretty cheap, but it worked out of the box. I am wondering if I should try another wifi dongle but before I do, I would like your advice.

    Thanks in advance!

    Reply
  10. Dan Henderson

    Hi there,

    Thanks for this. I tried it and it works straight away with my Galaxy S4 on 4.3, Galaxy Note 10.1 on 4.2 and IPhone4s on IOS7. There is a few seconds lag in between pause, volume change commands and the output changing, but I’m guessing that’s just how it is?

    The one thing I wanted to ask though, is that the playback is a bit glitchy on my devices so it crackles a bit and sometimes goes intermittent. I’ve updated using apt-get update and upgrade and also rpi-update. Is there anything else I should do? My wifi is a fair speed and there’s not alot connected to it.

    Thanks for any help, and thanks for building this!

    Dan

    Reply
    1. Stanislav Khromov Post author

      Hi Dan,

      Happy that most of it is working for you.

      Is there any particular device you are having an issue with? I know that I started having some issues with iOS 7 devices, but the android ones work great. Is that also the case for you?

      Reply
      1. Dan Henderson

        Hi,

        I’ve just done some more testing (on both my rpis to check) and the android devices have a longer lag between playing and skipping tracks etc (the iphone seems to be pretty fast now!)

        But both have the same problem with a slight crackling all through playback, almost like the noise you get when you pull selotape(!) but quieter and intermittent.

        I’m using a usb soundcard (fairly cheap one) so it might be that, although I’ve had good sound out of it before. I can’t think what else to do to try and sort it out. Any thoughts would be much appreciated!

        Hope it doesn;t sound like a complaint though…this is awesome!

        Thanks,

        Dan

        Reply
        1. Dan Henderson

          Just to say I’ve switched to wired internet to make sure the wifi isn;t the culprit but same thing.

          Reply
        2. Stanislav Khromov Post author

          Did you try the built-in audio jack?

          I actually compared the built-in jack with a cheapo USB sound card and the built-in one sounded better.

          Another option you could try is compiling a later version of Shairport, as per these instructions:

          https://snippets.khromov.se/raspberry-pi-shairport-build-instructions/

          During the git clone, check out the “master” branch instead of “1.0-dev”, the master one seems newer.

          So you would do it like this:

          git clone -b master git://github.com/abrasive/shairport.git
          

          Hope that helps.

          Reply
  11. Alessandro

    Hello,
    I installed shairport following all the procedures of your site and it works well. But I would like to start shairport by the demon (/etc/init.d/shairport) using the default file /etc/default/shairport with a name that includes spaces such as:
    “Air Pi of Alexander”
    I have tried in various ways, but I could not, can you tell me how I can do and give me a solution.
    Thank you.

    Reply
  12. NPLDK

    Hi

    My pi is working perfect using airplay using shairport

    I have one question

    How can i get a 5vdc signal when using airplay
    High when playing music on airplay
    Low when not playing music on airplay

    Best regards
    NPL

    Reply
  13. Carlo

    Hi,
    very great tutorial…
    I have two questions:
    1) It seems that it is not working with Android phones (Andorid > 4.2) is it possible ?
    2) If i want to execute some actions (execute a bash script) when a device connects/disconnects where do I have modify your scripts ?
    Thank you!
    Carlo.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.