Streaming any audio source from Ubuntu to Android

Wednesday, Jul 8, 2015

One of the advantages of treating my home PC as an always-on server, with its
own semi-static IP address, is that I can have access to my music from my
phone.

Having achieved this, with the help of Subsonic,
the next step was playing music through the speakers wired to
a Lepai amp. The simplest way was to get a bluetooth receiver
and pair it to the old Nexus One phone that I still have with its
original cradle. (I couldn’t connect the phone directly to the
amp, since the outlet is powered off from a wall switch, and
the phone would take too long to boot.)

The music that I could play was basically the library available
via UPNP/DLNA (using BubbleUPnP), and radio stations from the
phone’s TuneIn Radio app.

However, I’ve been listening to Spotify lately, and it runs extremely
poorly on the Nexus One. Enter today’s solution.

First step is to install the app that Spotify recently made available for Ubuntu,
and get it running properly. Next, install PulseDroid
on the NexusOne, downloading the apk file directly. (There’s also
Simple Protocol Player
available on Google Play, but I had good results with PulseDroid.)

Following the instructions on the Github repo, I had to find out the exact
name of the output card, with the intention of creating a PulseAudio monitor
that replicates the sound played through that card:

When Spotify plays music through that sound card, the audio goes to the
headphones and at the same time, to the recording device just created. Then it’s
just a matter of running PulseDroid on the phone, and pointing it to the
server’s IP and port.

Installing and running pavucontrol can help with seeing the devices and
the current sound level of audio being played through each one.

Update

I found another, more stable alternative:

Run BubbleUPNP on the Nexus One, which (when licensed) can be set
to run on boot and stay on while the phone is powered.