June 10, 2016

How to Stream Audio from Your Linux PC to Android

soundwire_crop.png

SoundWire
Learn how to stream audio from Linux to Android with SoundWire.

I listen to music all the time while working at my PC (which is much of the day). Sometimes I’m pretty much tethered to the desk for long stretches, and sometimes I wander about the office (aka house) for new ideas or just to change my perspective. When I decide to step away, I like to take my music with me. How do I do that? Sure, I could turn the music up to eleven, but the cats (and my wife) aren’t too keen on hearing Devin Townsend Project at near blistering levels. And, sometimes I’m the only one in the mood for classical music.

To avoid the issue of too much music for the average ears, I stream what I’m listening to from my Linux PC to my Android device. How do I do that?

SoundWire.

soundwire_a.png

SoundWire
Figure 1: The SoundWire Server GUI in action.

This is a simple-to-use app duo, installed on both your PC and your Android device, that allows you to stream whatever you’re listening to so that you can take your audio with you...as long as you remain on the same wireless network.

Before you get too thrilled about this, there is one caveat to the system. You must not mute the volume of your PC; otherwise, the sound streaming to your Android device will also mute. Other than that, the SoundWire system works great.

Let’s get it installed and working.

Installations Abound

I’ll be demonstrating the installation on Ubuntu GNOME 16.04. The first thing you must do is install the SoundWire Server on your PC. Download the tar file from the SoundWire Server page (and make sure you get the server from that page). You’ll notice there are both 64- and 32-bit versions of the server. Download the correct file for your system architecture.

soundwire_b.png

SoundWire
Figure 2: The SoundWire Android app.

Before the SoundWire Server will run, you must install PulseAudio Volume Controller. This can be done with a single command: sudo apt-get install pavucontrol. The SoundWire Server also requires portaudio, but most likely your system already has libportaudio2 installed. If you issue the command sudo apt-get install libportaudio2, it will either install the app (if it’s missing) or report to you that it is already installed.

Now let’s take a look at the downloaded SoundWire Server package. If you’ve downloaded the file into the ~/Downloads directory, open up your file manager and navigate to that folder. Locate the SoundWire_Server_linuxXX.tar.gz file (Where XX is either 64 or 32), right-click it, and select Extract here. This will create a new folder, SoundWireServer. Change into that folder, and you’ll see a number of files, ready to serve.

NOTE: If you don’t want to use the file manager to extract the folder, you can always open a terminal window, change into the ~/Downloads directory with the command cd ~/Downloads, and issue the command tar xvzf SoundWire_Server_linuxXX.tar.gz (Again, where XX is either 64 or 32).

To start the server, you can either double-click the SoundWireServer file (depending upon which file manager you are using) or work with the command line. To run the app with the command line, do the following:

  1. Open a terminal window

  2. Change into SoundWireServer folder with the command cd ~/Downloads/SoundWireServer

  3. Issue the command ./SoundWireServer

The GUI tool will open, ready to serve up your sound. Before you issue that command, however, let’s install the Android app.

The first thing you must know is that there are two versions of the app: Free and Paid. The free version will identify itself every 45 minutes (interrupting your music). To bypass that, you must purchase the Paid version, which will set you back $3.99.

To install the SoundWire Android app (we’ll install the Free version so you can find out if it’s an app you want to eventually pay for), follow these steps:

  1. Open up the Google Play Store on your Android device

  2. Search for soundwire

  3. Locate and tap the Free version by GeorgieLabs

  4. Tap Install

  5. Read the permissions listing

  6. If the permissions listing is acceptable, tap Accept

  7. Allow the installation to complete

Once the installation is complete, you’ll find the launcher for SoundWire in either your App Drawer or your home screen (or both). Tap the launcher to start up the app.

Connecting Android to PC

The first thing you must do is start up the SoundWire Server. On your Linux PC, go back to the ~/Downloads/SoundWireServer directory (from the command line) and then issue the command ./SoundWireServer. The GUI will start up (Figure 1 above) and display the IP address to be used for connection.

Once the GUI is running, and you have your IP address, open up the SoundWire app on your Android device. When the app opens (Figure 2), enter the IP address of your Linux PC and then tap the square button in the center of the app.

The app will connect to the server and you can then start playing music from any app on your Linux PC. The sound should automatically start playing through both your PC and your Android device. The SoundWire Server GUI should display the word “Connected” to indicate your Android device has connected to the server.

soundwire_c.png

SoundWire
Figure 3: Selecting the right capture from device in the PulseAudio Volume Control app.

If you find the GUI claims the Android device is connected, but you’re not hearing any sound on your mobile device, go back to the SoundWire Server GUI and click on the Open PulseAudio Volume Control button. In this new window (Figure 3), go to the Recording tab and make sure Monitor of Built-In Audio Analog Stereo is selected from the Alsa Capture from drop-down. Once that is selected, the sound should start spilling from your Android device.

soundwire_d.png

SoundWire
Figure 4: Setting the buffer size for less latency.

Do note that there is a lag (latency) in the sound between the PC and the Android device. You can shrink the latency by opening up Settings (in the Android app) and changing the latency to a lower buffer size (Figure 4). The larger the buffer size, the smoother the audio. The smaller the buffer size, the lower the latency. The default is 128k (which gives a smooth sound with some latency).

Unfortunately, you cannot achieve zero latency with SoundWire...but you can come close.

A Great Solution

If you’re looking for one of the easiest Linux to Android audio streaming solutions, you cannot go wrong with SoundWire. Both the Server and App are reliable, quick to set up, and will function with any audio playback application. Give SoundWire a try and see if it doesn’t help you untether yourself from your desktop audio.

Learn more: 

To learn more, check out the "Introduction to Linux" course from The Linux Foundation. This free self-paced course will provide you with a good working knowledge of Linux using both the graphical interface and command line.

Click Here!