What is Kosters Shairport-Sync Implementation

As a musiclover, I love to be able to listen to my music anywhere. Therefor I have uploaded all my music onto a Synology-NAS (www.synology.com). I can now listen to it from any PC, my phone and tablet.

However, when in my home, I was looking for a nice multi-room audiosystem. These do exist but are usually quite expensive. As my iPhone supports Airplay, I started looking for the possibilities of using Airplay in my house. I stumbled upon Shairport-Sync by Mike Brady (https://github.com/mikebrady/shairport-sync/)

I was looking for a simple way to get it running on a raspberry.

Kosters Shairport-Sync Implementation is a combination of a Raspberry (3) image with a separate tool to simplify configuration of the raspberry. 

No programming-knowledge is needed to get your Airplay configured!

On the page ‘How is it made?’ you can see what is done.

On the page ‘Getting this running myself’ you can find what you need.

 

Many thanks to:

  • Mike Brady (Shairport-Sync, https://github.com/mikebrady/shairport-sync/)
  • IQaudIO (nice basic Shairport-sync Image, http://iqaudio.co.uk/)
  • PureBasic (fast and multi-OS compiler, http://www.purebasic.com/)

How it’s Made

To get Kosters Shairport-Sync Implementation I have used the following:

Hardware:

  • Raspberry Pi 3 B Starterkit (https://www.sossolutions.nl/starterkit3bc-compleet)   (about 58 euro at the time of writing)
  • Behringer UCA 202 Soundcard (https://www.bax-shop.nl/externe-audio-interface/behringer-uca-202-usb-geluidskaart?gclid=CjwKEAjwutXIBRDV7-SDvdiNsUoSJACIlTqlOT9Xsdn_RSRH-XZfrDbUwIPPu_8-EZcwRDPnG7bJzxoCNw3w_wcB)  (About 27 euro at the time of writing)

Software:

  • IQaudIO Shairport-Sync Image (http://www.iqaudio.com/downloads/IQ_ShairPortSync.img.zip)  (free, thanks guys!)
  • Win32DiskImager (http://www.raspberry-projects.com/pi/pi-operating-systems/win32diskimager) (free, thanks guys!)

First I assembled the Raspberry (put the Raspberry in it’s case and close the case) and connected the USB-Audiocard.

Then I wrote the image to the SD-card using Win32Diskimager.

After booting, I changed the rights on the following files to enable the user ‘pi’ to write to these files:

  • /etc/wpa_supplicant/wpa_supplicant.conf
  • /etc/shairport-sync.conf

I created a LSB-enabled bootscript that does the following:

  • Check if there is a file reboot.cmd -> If there is, reboot the raspberry with the ‘sudo reboot’ command.
  • Check if there is a file wifiscan.cmd -> If there is, scan for wifi-networks using the ‘sudo iwlist wlan0 scan’ and output the info to a file wifi.list

After that I have installed an FTP-server on the raspberry and made it listen to port 35643 (randomly chosen). The password for the user pi was changed to a long password to prevent evil takeover of your home-speakers 😉

 

After that I have created a small program using PureBasic that does the following:

 

  1. Get the IP-address(es) of the computer it is running on and scan the network using the first 3 characters of the IP-Address (so IP-address 192.168.178.30 would result in a scan of all IP-addresses from 192.168.178.1 to 192.168.178.254)
  2. If port 35643 is open (and connected within 100ms) open a FTP-connection to the raspberry and download the files /etc/shairport-sync.conf and /etc/wpa_supplicant/wpa_supplicant.conf
  3. Read the data (Airport-name and Wifi-Networkinformation) from these files and show on the screen

The screen can look like this:

The connected KSSI-nodes can now be reconfigured quite simply;

  1. Click on the node
  2. Change the PlayerName (into e.g. Toilet)
  3. If you want to connect it to Wifi, click ‘Scan’ and (after scanning) select the correct Wifi-network and enter the Wifi Password
  4. Click ‘Save settings’

The program will now log into the raspberry and change the configuration and reboot the device. The new settings apply.

Get this running myself

What do you have to do to get KSSI running for yourself?

  1. Buy a Raspberry PI 3 with power-supply, SD-card (min. 8 Gb.), and optionally a case.
  2. Buy an USB-audiocard to ensure good quality audio-card (I used Behringer, but IQaudIO is one of the other good options.
  3. Download the image for the KSSI-node from here
  4. Unzip the image and write to the SD-image (e.g. using Win32Imager)
  5. Put the Raspberry and USB-card together and insert the SD-card. This is now called a KSSI-node.
  6. Connect the KSSI-node using a networkcable to your local LAN-network
  7. Connect the Soundcard to your audio-system using the necessary cables (usually using RCA / Tulp)
  8. Power up the KSSI-node.

You should be able to see an Airplay-device with it’s default name.

  1. Download the KSSI commander from here
  2. Run the KSSI commander and wait until scanning of the network is completed. Your KSSI-node should be visible in the list.
  3. Click the KSSI-node you wish to configure. The details should appear below the list.
  4. Enter a name (like Livingroom, Kitchen, etc.) in the Playername field.
  5. If you want to connect using Wifi, click the Scan-button and wait for the wifiscan to complete.
  6. Select the correct Wifi-network and enter the Wifi-password in the Wifi-Password-field.
  7. Click on Save Settings and wait for the KSSI-node to reboot (takes up to 35 seconds)
  8. You should be able to disconnect the LAN-cable now and the KSSI-node will connect to Wifi at reboot. If that does not work, you have probably entered the wrong password.
  9. Enjoy streaming music!

Contact

If you have any questions, please do not hesitate to e-mail me at

kssi (@) kosternet.nl