Part 1. How to Listen to Apple Music by AirPlay on Raspberry Pi
Nothing is better than lying down on the sofa to the enjoy music from your stereo speaker via AirPlay. In order to use the AirPlay, you need to do a few settings.
Tools You Need
1. Raspberry Pi 2 or 3. If you haven't got one, you can buy one from the official website.
2. HDMI cable.
3. SD card with card reader.
4. A USB mouse and keyboard.
5. A 3.5 mm stereo audio cable and stereo speaker.
6. Wi-Fi USB adapter.
7. An iOS device or computer.
8. Power supply.
How to Set Up AirPlay
And then you can install the Raspberry Pi Software called Raspbian and set up the AirPlay.
Step 1. Download and unzip the the Raspbian package into the blank SD card on your computer.
Step 2. Connect all the accessories and devices to your Pi. For example, you can insert the SD card into your PI, connect an external display via HDMI cable and stereo via the audio cable and other tools.
Step 3. Power on your PI, you will see it boot from the SD card.
Step 4. Please select the menu "OpenELEC" and then click "Install". It takes a few minutes to complete the installation.
Step 5. When it is done, please go to "System" > "Settings" > "Services" > "AirPlay" to enable the option "Allow Kodi to receive AirPlay content".
Step 6. Finally, the Kodi player will show up on your Apple devices as an AirPlay compatible device, you can play Apple Music from your Mac devices and stream it to Pi via AirPlay.
Though it takes some steps to set up the AirPlay, it is a really awesome way if you have an iOS device or Mac computer to stream Apple Music files. And it is highly recommended for programmers.