It’s working. I can play audio via Airplay from my computer on the Raspberry Pi and run Norns “Awake” at the same time, Norns Shield line out connected to my HIFI system, without glitch. Next, I’ll work on the Systemd part to have Shairport start automatically.
Installing Shairport Sync - Airplay for RPI - on Norns
Prerequisites:
sudo apt install autoconf automake libtool libdaemon-dev libpopt-dev libconfig-dev libsoxr-dev avahi-daemon libavahi-client-dev sox jackd2
Installing Alac (Apple codec):
git clone https://github.com/mikebrady/alac.git
cd alac
autoreconf -fi
./configure
make
sudo make install
Installing Shairport:
cd && git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa --with-jack --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --with-apple-alac
make
sudo make install
Optional - installing SPS-Alsa-explore:
git clone https://github.com/mikebrady/sps-alsa-explore.git
cd sps-alsa-explore
autoreconf -fi
./configure
make
(testing : ./sps-alsa-explore
should list your DAC)
Configuration:
sudo nano /etc/shairport-sync.conf
(Or use VsCode on your computer to edit this large file)
- Uncomment line 19 and set it to output_backend = “jack”
- Uncomment lines 146
- Uncomment line 147 and set it to
autoconnect-pattern = “system:playback_[12]“
- Uncomment line 154 and set it to
soxr_resample_quality = "medium"
(or high)
Loads of additional adjustments are possible in this file !
Testing:
Launch Shairport manually using shairport-sync -vu
and set the Airplay output to Norns on your computer.
Starting Airplay/Shairport-sync automatically on startup:
sudo systemctl enable shairport-sync
sudo nano /lib/systemd/system/shairport-sync.service
and modify the file so it reads:
[Unit]
Description=Shairport Sync - AirPlay Audio Receiver
Requires=mn_jackd.service
After=mn_jackd.service
Requires=avahi-daemon.service
After=avahi-daemon.service
Wants=network-online.target
After=network.target network-online.target
[Service]
ExecStart=/usr/local/bin/shairport-sync
User=we
[Install]
WantedBy=multi-user.target
Jackd and Shairport need to be run by the same user we and Shairport needs to start after jackd.
Improvements & tweaks:
Tested on a RPI3B and 3B+ I think the quality is fine. No big dropouts or glitch
- It would be nice to adjust the line level in the .conf file to match the specs of the WM8731 DAC. At first, I thought there was no sound, but it was actually very low on the Mac side.
- There’s probably a way to improve the latency; This can probably be tweaked in the .conf file of Shairport too, or in the configuration file of Jack. I’m no Linux expert…
- This resampling thing - done with Sox- Does Norns run at 48khz or can we avoid resampling 44k to 48k to save a bit of CPU ? Not sure about that.
- and this jack “realtime” warning…
Sidenotes:
I had to set line 154 of the .conf to soxr_resample_quality = "medium"
or high /// Setting it to “none“
would cause the following error *fatal error: The JACK server is running at the wrong sample rate (48000) for Shairport Sync. Must be 44100 Hz.
If it’s proven reliable, the following improvement would be awesome imo: Airplay as an audio source for sampling in Norns… - Perhaps as a mod ? - I guess it’s all a question of routing audio on the RPI, working with Jack etc. If somebody wants to add this possibility, that would be nice. There’s also a possibility to display the metadata on the screen, but that’s entering the Norns software territory…