Mopidy Discourse

How to add AirPlay Receiver to Mopidy?

NOOB asking, so please be lenient towards me… TIA.

I’m running a Mopidy default installation on a FriendlyElec nanoPi M4 (Armbian 20.11.6 Buster with Linux 4.4.213-rk3399).

How can I add an AirPlay Receiver to Mopidy and its Iris WebUI? If I see it correctly, there is no official extension, instead it has to be done using Shairport Sync. But how?

If your answer is: „It can not be done (easily). You should simply install PiMusicbox“, then I have to reply: Well, I’m running other apps/services/servers on my nanoPi, so I can’t use a distribution disk image. The question then would be: How can I install PiMusicbox on the above mentioned nanoPi M4?

Just dug a bit deeper, and came across this article. So the trick is to connect Shairport to SnapCast Server, and enable SnapCast in Mopidy?

The article reads:

I use Snapcast server, where the content will be sent to a file using pipe, and I specify the pipe path as the target.

To avoid confusion: I want to play content from e.g. my iPhone or Mac to Mopidy. The nanoPi on which Mopidy runs is NOT serving SnapCast clients, but instead the other rooms are connected via Bluetooth (there are two BT5.0 USB Audio transmitters attached to the Pi, serving 4 BT receivers).

Anyone? Help would be much appreciated. ::

No. Mopidy provides audio data. Snapcast reads audio data. You can link them together via a couple of mechanisms as explained in the snapcast documentation but Mopidy has no idea it is connected to snapcast and there is no specific support in Mopidy for snapcast. Similarly, you can have snapcast take audio data from other programs, such as Shairport-Sync.

Mopidy does not have any mechanism to read audio data from random places. It definitely does not understand Apple’s Airplay protocol. You cannot do this.

Instead, you can send audio from your Apple thing to Shairport-Sync. Shairport-Sync can use your playback device to play that. I guess there is some way to configure Shairport-Sync to use the Bluetooth things you have but that’s an extra detail. Mopidy is not involved anywhere for this.

If you also wanted the separate ability to use Mopidy to play your Local files, Spotify, YouTube etc, instead of playing from Shairport-Sync, you can do that. This would be two entirely separate programs trying to play to your Bluetooth things, potentially at the same time. You should be able to configure an ALSA dmix plugin to allow two programs to use the audio device at the same time (no idea if Bluetooth audio devices are special cases). To avoid a garbled mess, you either need to manually make sure only one program is active at a time, or, you can use Shairport-sync’s run_this_before_play_begins and run_this_after_play_ends config settings to tell Mopidy to stop/stop using the playback device. e.g. run_this_before_play_begins = mpc stop.

Thanks, Nick! @kingosticks

I’m confused, because I came across the following screenshots (found here), which indicate that PiMusicbox – which, correct me if I’m wrong, is also made by you – has native built-in AirPlay support, allowing you to easily switch from e.g. listening to local files or web radio to AirPlay sources, all within the Mopidy Interface.

That’s exactly what I want, but I can’t simply use the PiMusicbox.dmg as I

a. use a nanoPi M4 instead of a Raspberry Pi
b. am running additional servers/services on that Pi


OK, re-read what you wrote above, and think I understood the principle.

So, what’s that AirPlay Streaming toggle switch in PiMusicbox exactly doing? When set to OFF disable Shairport Sync as source in ALSA dmix?

It controls if shairport-sync is running or not.