
I love to listen to music on the road and at work, while accumulating a considerable collection of music in lossless on a home computer. I want to have access to music not only at home but also on a smartphone. Limited memory does not allow to fit all my collection, no matter what memory cards I expand on it. Yes, and I do not want the memory to spend on it, because there are still many things that I want to write down there. I used to try to collect everything that I want to listen to today, convert it into a compressed format (I think lossless on a mobile device is a surplus) and write it on a mobile device before going to work. But as always he did not have time, and often had to be content with the old hackneyed playlist. Then I had unlimited mobile Internet and I completely abandoned the “throwing over” of music, began to listen to the Internet radio station. We had to constantly jump between the stations, and these DJs are constantly wedged in. And then I got the idea to make my personal stream, with blackjack and ... all that follows.
It was decided to install mpd on the home server, on the smartphone an application for listening to Internet radio and the mpc client to select music on the fly. If it is interesting as, I ask under kat.
In this article I will describe how to do this on a server running Ubuntu and Android smartphones.
Immediately list the advantages:
- The entire music collection is available.
- Mobile device memory is free
- You can choose the optimal bitrate for your mobile device and do not need to convert anything
And disadvantages:
- Not everyone has unlimited 3G
- Delay of about 5 seconds when rewinding a track (due to buffer size)
- Not everyone has a home server.
The latter drawback can be disputed, since it is not necessary for this to have a PC server. All this can be deployed on a home access point with a connected USB HDD, for example on the TL-MR3020, DIR-320, TL-WR1043ND ... and so on, the list goes on and on, the main thing is having a USB port for connecting the HDD and supporting alternative firmware (OpenWRT , DD-WRT, firmware from Oleg, etc. By the way, you can also connect a USB audio card to the point and get a home media center). If there is interest, I can write a detailed how-to on settings, for example on OpenWRT.
Back to the main topic, let's proceed to setting up on Ubuntu Server 12.04.
MPD
Install the package
sudo apt-get install mpd mpc
Then you can install codecs if necessary.
Now configuration
sudo nano /etc/mpd.conf
I will list only the required parameters.
Now restart the daemon
sudo service mpd restart
Next, you need to update the music database, for this we will command in one of the terminals
sudo tail -f /var/log/mpd/mpd.log
to follow the update process, and in another
mpc update
Now we have a server ready to stream music to our mobile device. But I prefer not to keep open ports on the server (except for one), so I use OpenVPN.
VPN
Setting up a VPN is not necessary at all, it is a pleasant option that gives greater privacy. There are many articles on configuring a VPN server. I just want to say that there is a wonderful client for Android devices OpenVPN Settings (requires root, OpenVPN Installer, BusyBox, sometimes TUN.ko Installer). And for Android version> 4 there is an even more wonderful OpenVPN for Android client. All applications are available on Google Play. OpenVPN earned on all my devices, though not on some at once.
Android
Gently move on to the smartphone settings. We need a client for mpd and “internet radio” that can add a custom stream url to the playlist. All these applications are Google Play, there is a decent selection of both. I made a choice in favor of the MPDroid client, I liked the interface in it and XiiaLive ™ - Internet Radio. For the sake of choosing the first available with the ability to add a custom url stream.
It must be said that MPDroid allows itself to play stream streamed by mpd, but I was not satisfied with the stability (hang and crash) and the delay when switching tracks. In view of this, I opted for a third-party player application. Someone may not like the fact that they have to use two programs at the same time, but this suits me perfectly. Perhaps in the future, MPDroid will be improved and it will be possible to listen exclusively through it.
Setting up these applications is easy, for MPDroid, when you first start, select Default connection settengs, enter the server address in the Host, Port field by default. Check the contents of the library, set the track to play. Now we run XiiaLive, go to “favorites”, add a URL, enter http: \\ 10.0.0.1:8123, where 10.0.0.1 is the address of our server.

Enjoy listening, and stable connections.
')
PS You can also look in the direction of Google Play Music, they allow you to upload music to the cloud.