AirPlay support in HiFiStreamer

Making Mopidy and Shairport-Sync live together

Posted by Oren Sokoler on July 31, 2025 · 2 mins read

It has been a long time since my last post here, more than two years. A lot has happend since than and I hope to post more here on HiFiStreamer and streaming digital audio in general. For this post I would like to talk about Mopidy and AirPlay and how I made them work together.

Most of my music listening is done via TIDAL, but as you may know TIDAL does not have all the music material you may want - sometimes I find myself listening to Apple Music and finding there staff that does not exist in TIDAL. I had to find a way to stream music from Apple devices to HiFiStreamer.

Shairport-Sync allows you to do exactly that it is an open source AirPlay implementation. The only issue I has with integrating Shairport-Sync into HiFiStreamer was that it shares the same ALSA audio device with Mopidy and they both can play music at the same time. I wanted a system that will play only from a single source no matter which one I choose or want to listen to. For example if I am now listening to an album from TIDAL and I want to switch to an album from Apple Music I want the switch to be flawless.

Here is how I did this:

  1. Both Shairport-Sync and Mopidy uses ALSA as their output device so I had to change my ALSA configuration to use a direct mix plugin (dmix). For this ofcousre I made sure that the dmix plugin does not mess with the audio data and is bitperfet.
  2. Synchronize Shairport-Sync and Mopidy so that when one of them start to play the other one stops. For this I wrote a special daemon - shairmopd - that monitors both players and multiplexes them.

You can find the latest version in the Download page - enjoy !!!