Airplay receiver with Orange Pi. How to make your HiFi sound system wireless.

  • Device that connects to the WiFi and works with an Airplay
  • It produce acceptable sound quality
  • Budget less then 100 Euro (preferably much less)
  • Ready to use high-quality receiver for 400–800 Euro like Denon DRA or some Yamaha. Cons: Huge and expencive.
  • Denon DN-200WS — 100Euro for the professional Airplay receiver, not bad.
  • Apple TV for 70 Euro for used 3rd gen. Cons: build in low quality sound and no options to improve it.
  • Apple Mac mini 2007 for 55–70 Euro. Pros: there is usb so a lot of external sound cards could be plugged in, native Airplay and Spotify support. Cons: 10 years old, max supported OS is 10.7.5 (currently it’s 5 generations old, modern Spotify OSX client requires 10.9+).
  • Raspberry PI for 30Euro + external sound card powered by LibreELEC https://libreelec.tv/downloads_new/
  • Orange PI for 13 Euro (official Aliexpress). Same as above but 2.5 times cheaper.
Orange PI Lite

Orange PI

There is ton of versions of the Orange PI and this is important to keep in mind when you look for the OS for it. I’ve got an Orange PI Lite (see full specs here), mostly this is the same as Raspberry PI 3.

  • it has less RAM (512MB vs 1GB)
  • it has more powerful CPU (it can play 4k video stream, Raspberry PI plays only 1080p@30fps)
  • it has build in WiFi
  • is does not have Ethernet
  • it needs more power (at least 1.5A, otherwise in my case WiFi didn't work). Works good with an iPad 2.1A power supply.

Burn an image to the Micro SD card on the OSX

I tried wrong Raspbian (for Orange PI Zero), correct Raspbian (for Orange PI Lite) and Armbian. Only the last one worked correctly.

  1. Download an image https://www.armbian.com/orange-pi-lite/
# file name in my case:
# Armbian_5.35_Orangepilite_Ubuntu_xenial_default_3.4.113_desktop.7z
brew install p7zip xz
7za e Armbian_5.35_Orangepilite_*.7z
$ diskutil list
...
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *31.0 GB disk2
1: Linux 30.7 GB disk2s1
$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
sudo dd if=Armbian_5.35_Orangepilite_Ubuntu*.img of=/dev/disk2 bs=1m

Orange PI setup

  1. Connect Orange PI to the internet via USB to Ethernet adapter and wait a bit. Username and password are:
apt-get update
apt-get upgrade
# fix locale first
apt-get install --reinstall language-pack-en -y
locale-gen
echo "LC_ALL=C" >> /etc/environment
dpkg-reconfigure locales
# enable swap file (disabled by default)
sudo swapoff -a
sudo rm /var/swap
# choose location and size for the swap file, say 512Mb on SD card:
sudo dd if=/dev/zero bs=1M count=512 of=/var/swap
sudo chmod 0600 /var/swap
sudo /sbin/mkswap /var/swap
sudo nano /etc/sysctl.conf
# change here vm.swappiness=0 to vm.swappiness=32 and save
h3consumption -m 1000
h3consumption -p
#Active settings:
#cpu 1008 mhz allowed, 1200 mhz possible, 4 cores active
# install avahi daemon
apt-get install avahi-daemon
# now log try to SSH it on your laptop:
ssh root@orangepilite.local
# change `orangepilite` to something else (if you want) in following files:
# /etc/hostname
# /etc/hosts
$ root@orangepilite:~# nmcli dev wifi
SSID MODE CHAN RATE SIGNAL BARS SECURITY
MacNetwork Infra 7 54 Mbit/s 67 *** WPA2evdoty Infra 12 54 Mbit/s 50 ** WPA1 WPA2SN_103_3 Infra 11 54 Mbit/s 49 ** WPA2
nmcli device wifi connect "MacNetwork" password "mypassword"
root@orangepilite:~# nmcli device status
DEVICE TYPE STATE CONNECTION
wlan0 wifi connected MacNetwork
lo loopback unmanaged --
# check syslog
tail -f /var/log/syslog
# there will be a message that audio device was connected
# add your user to `audio` just in case
sudo adduser root audio
# check if your sound card is available
root@orangepilite:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 []
...
card 1: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
...
card 2: S2 [Sound Blaster Play! 2], device 0: USB Audio [USB Audio]
defaults.pcm.card 2
defaults.ctl.card 2
pcm.!default {
type plug
slave.pcm {
type dmix
ipc_key 1024
slave {
pcm "hw:2"
# rate 48000 # this line is only needed for USB DACs which only support 48khz
period_time 0
period_size 1920
buffer_size 19200
}
}
}
ctl.!default {
type hw
card 2
}
reboot# let's see if it works, you should hear a noisy sound
speaker-test
alsamixer
# use arrows to change volume and ESC to exit
# save settings
alsactl store
add-apt-repository ppa:dantheperson/shairplay-sync
apt-get update
apt-get upgrade
apt-get install shairport-sync
reboot
# remove installed version
apt-get remove shairport-sync
apt-get install build-essential git xmltoman autoconf automake libtool libdaemon-dev libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-devgit clone https://github.com/mikebrady/shairport-sync.git --depth 1cd shairport-sync
autoreconf -i -f
  • with-alsa — use ALSA (Advanced Linux Sound Architecture). Alternative is PulseAudio, but ALSA is closer to the hardware and it’s beeing used in all examples I’ve found.
  • with-avahi — use Avahi networking service (software that helps to publish and discover services in local services you use it every time you deal with .local domains)
  • with-ssl=openssl — use OpenSSL
  • with-systemd — support for Shairport Sync to be launched on boot
  • with-metadata — no idea, just found it here
./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata
checkinstall
This package will be built according to these values:0 -  Maintainer: [ root@orangepilite ]
1 - Summary: [ AirTunes emulator. Multi-Room with Audio Synchronisation ]
2 - Name: [ shairport-sync ]
3 - Version: [ 3.1.7 ]
4 - Release: [ 1%{?dist} ]
Enter a number to change any of them or press ENTER to continue: 4Enter new release number:
>> 1
Done. The new package has been installed and saved to
/root/shairport-sync/shairport-sync_3.1.7-1_armhf.deb
You can remove it from your system anytime using:
dpkg -r shairport-sync
systemctl enable shairport-sync
service shairport-sync start

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yury Kozyrev

Yury Kozyrev

Former Yandex Software Engineer, passionate Engineering Manager in Berlin