This is a working Airplay 2 Speaker implementation largely inspired by airplay2-receiver
The goal is to have an Opinionated implementation, with only some features but working very well.
- Play AAC 44100Hz with Apple Music (buffered audio)
- Play/Pause/Stop/Seek
- Homekit pairing with iPhone Home App
- Sync with HomePod mini
- PTP supported
- Working on a Rasbperry 1
- Set Volume
- Support PulseAudio (and can select sink)
- P1 - Improve multi-room support (audio sync)
- P2 - Play ALAC
- P3 - Supports Spotify (RTP over UDP, type 96)
- P4 - NIC hardware timestamp (linux)
- Windows build
- Track information
- Screen, Video, ... (other Airplay Features)
- Airplay 1
- NTP
- The accuracy is around 1ms of offset between clocks.
- Need to sync during playing (add silence of skip frames)
- Clone the repository
git clone https://github.com/openairplay/goplay2.git
- Build goplay2
go build
You need to have portaudio-dev, pulseaudio and lib-fdk-aac and go runtime installed to build this program
sudo apt install golang-go libfdk-aac-dev
fdk-aac is not provided by default, you have to change your source.list (as root or using sudo)
echo "deb http://www.deb-multimedia.org buster main non-free" >> /etc/apt/sources.list
apt-get update -oAcquire::AllowInsecureRepositories=true
apt-get install deb-multimedia-keyring -y
apt-get install libfdk-aac-dev
You also need to install go from https://golang.org/dl/ as version 1.16 is not supplied by buster (they only support 1.11)
- Having xcode properly installed (clang needed)
brew install portaudio fdk-aac go
You can build the image to test Linux build and that the service run properly
- Build the image
docker build -t albanseurat/goplay2:latest .
- Run the container
docker run -p 7000:7000 -it albanseurat/goplay2:latest
- Docker build is intended to test building the program on Linux platform
- Bonjour/mDns implementation needs to be changed to allow exposing airplay service outside docker container
- goplay2 by default run only on the ipv4 interface (because this issue on ipv6 parsing)
- goplay2 should not be run as root to use pulseaudio server
- goplay2 need to have special privileges to open PTP port (319,320)
to allow goplay2 to open port below 1024 you need to run
setcap 'cap_net_bind_service=+ep' ./goplay2
nb: should be re-run every time you build goplay2
delay
(ms) is subtracted from the local "clock"
Ex: It takes around 60ms on my mac to launch the audio stream at the Anchor Time
i
(interface) used to listen (by default eth0)
n
(name) used as accessory name (Bonjour)
sink
(pulse audio sink name) to replace default sink
Example :
./goplay2 -sink alsa_output -i en0 -n aiwa
By AlbanSeurat