Do you ever feel tethered to your computer because you're wearing headphones, and you can't go away from it because you can't use your speakers for whatever reason? This is for you.
I often found myself in this situation. Sometimes I'm listening to podcasts, and I want to get up from my desk and grab something from other room, but the speakers aren't loud enough. Sometimes people around are sleeping and I don't want to wake them up, but I also can't carry my laptop with me just because I like the track I just found on YouTube.
One of ZeroPhone plans is enabling hands-free applications, using audio for things like notifications (of course, only the most important ones, and the ones you want to hear.) Naturally, I'll be using it a lot - I'm the "headphones" kind of person, and I know there are plenty of ZeroPhone notifications I'll want to hear about immediately when they happen. Now, what if I want to listen to a podcast, should I unplug headphones from my ZeroPhone and not hear the notifications? The most obvious idea is using the ZeroPhone as an audio receiver, and stream audio from my laptop to ZeroPhone, so that notifications could be overlayed, and I wouldn't find myself re-plugging the headphones all the time.
So, the setup is like this: I want to stream all audio from my Windows laptop to my ZeroPhone, which sits in my pocket, receives the audio stream and plays it back to my headphones. If my laptop ran Linux, I could just use pulseaudio network streaming capabilities and be done with it. As it's Windows, though, I needed to find something that would work on Windows and would be more user-friendly than using a long command-line copy-pasted from Stackoverflow.
I found TuneBlade, which is not open-source, but is free when used with an open-source receiver - just stellar! I'll think about buying their Pro version just to support the developers, at least, when I'm less broke.
Then, I've searched for receiver software that would be easy to set up, and I found Shairport Sync - it's claimed to work for the "receiver" part, and it's open-source, so supported by the free version of TuneBlade! I also found an up-to-date tutorial on compiling Shairport Sync (pro tip: when looking up tutorials in Google, limit search results to "during the last year" to get rid of outdated tutorials). Unfortunately, shairport-sync is not available in Raspbian repos, even though their GitHub claims it's available in Debian. Nevertheless, following the tutorial, compiling it was straightforward:
sudo apt-get update sudo apt-get upgrade sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman git clone https://github.com/mikebrady/shairport-sync.git cd shairport-sync autoreconf -i -f ./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata make
You should be able to just copy-paste these lines in the terminal, follow the instructions and be done with it. It feels awesome - compiling stuff on my ZeroPhone and understanding that it's all happening in my pocket.
The last line is:
sudo make install
However, I would rather build a package. There's a "checkinstall" software which would do that for me, too!
sudo apt-get install checkinstall checkinstall
Checkinstall can ask all kinds of questions, but in this case, git repository of Shairport Sync already contained all the metadata necessary for building a Debian package, so it picked that up and made a nice .deb package called shairport-sync_3.0-1_armhf.deb . Let's install it:
sudo dpkg -i shairport-sync_3.0-1_armhf.deb sudo groupadd shairport-sync #For some reason, the package creates the group, but not the user
If required, you can also edit Shairport-Sync settings (such as the Airplay receiver name and password, at the very least) in config file, which, when compiling from source, seems to be put into /usr/local/etc/shairport-sync.conf .
Last steps - enabling it to run on system boot (or not):
systemctl enable shairport-sync
Now, the only thing remaining is to create an app it, so that you can control the Airplay receiver from the GUI - start, stop, restart, as well as change the name and the password. I've seen a mention of Shairplay getting a DBus interface some time in the future, but, if I recall correctly, that is not a priority - so editing the config file & calling systemctl commands will have to do. I'll look into it over the weekend - this will be a good reason for me to convert the small systemctl module I wrote into a full-blown Python library!