We all have music libraries stored/scattered across our laptops, desktops and handhelds. The question is, how do we unify this? Is there any way we can setup our own streaming solution to access this huge pile of data anytime, anywhere from any device? Yes you can set up your own On Demand streaming service using the magic of mukt and muft (Free & Open Source) software.
Here is a guide to help you setup your own On Demand Streaming System. We will be doing this using a nifty platform called Ampache – the Apache Amplifier.
Ampache has the ability to allow multiple users access the data, create sessions and personalized playlists. According to the website - Ampache is a web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any Internet enabled device.
This means, once set up, you can stream to any device -- Android phones, tablets, netbook and of course laptops & desktops -- which can connect to your network.
All you need is a PC running a GNU/Linux operating system. In this guide we are using Ubuntu, you can use any Linux distro of your choice.
You will need a working AMP (Apache, MySQL, PHP) setup. In Ubuntu, install the three software packages using Synaptic. If you are the adventurous type, you may also install the components individually and go about configuring each manually. This is a fun learning process, but only if you want to get your hands really dirty! You may also want to install the MySQL GUI Tools in case any problems arise and you need to do some under-the-hood fiddling.
Installing Ampache is a breeze. This can be done in mainly two ways:
1. Download the Ampache tarball (the tar.gz file) from the Ampache website – Create a folder called 'ampache' in /var/www and extract the tarball into it.
2. Go to System > Administration > Synaptic Package Manager and Search for Ampache and install it. Once that is done, copy all ampache files from the /usr/share/ampache directory to /var/www. This can be done using the following:
Open the terminal (Applications > Accessories > Terminal)
At the prompt, type the following commands:
sudo cp -R /usr/share/ampache/* ampache
That completes the first part of the installation of ampache. Now we move onto setting up the server. We begin this by accessing it.
Getting your hands wet
We now launch our favorite browser and navigate to http://localhost/ampache to access the server. This will load the first time install screen as under:
Hit the “Start Configuration” Button to begin the install process.
The next screen (above) is where we will fill in the configuration information. Fill it up as under:
Desired Database Name: ampache
MySQL Hostname: localhost
MySQL Administrative Username: root
MySQL Administrative Password: (enter password, if any, here)
That’s it. Now hit “Insert Database” to continue. At the next screen(above), it will ask for more details and will generate a CFG file which you have to place in the ampache/config directory and then click “Check Config” link. Once both the [ERROR] fields are [OK], you can move on to the next screen for setting up the administrator account (below).
Enter the details and proceed to “Create Account”. That’s It! Now, you’re greeted with the Ampache Login Page:
For the first time, login with the Administrator username and password as setup in the previous screen. You will now be greeted with the Ampache Home Page.
You can add users, music, etc. from this page. Let’s go about adding some music so that we can test the setup. In the menu, select the fifth tab and choose “Add Catalog”. This will bring up the following screen:
Enter a Catalog Name and the path to the local directory where you have all your music. You can even link one Ampache server to another one using this same page by selecting Catalog Type as Remote and entering the URL of the remote Ampache Server.
For our purpose, we will stick to the local type. If you want M3U playlists to imported directly, check the option “Build Playlists from M3U files”. And if you want to show Album Art select “Gather Album Art”. Once the path is entered and the Add Catalog button is pushed, Ampache will begin to scan and catalog files. That will happen like below:
Once the cataloging is finished, you can go to the Home tab in the Menu to Browse Tracks, Albums, Genres, Artists, etc. For demonstration purposes, we will Browse Album and Add a track from that album to our Now Playing Playlist (the one on the right). The screen is as below:
We can add a song by clicking the green ‘+’ on the left most side of the track. That will add the track to the Now Playing playlist. Once our track is added, we can begin playing by hitting the Play button (the first tab in the Now Playing Playlist pane).
This will generate a streaming playlist file which you can load into your favorite media player to start playing! If you want to play within Ampache, select “Flash Player” in the Search Box to enable playing through an in-built flash player. Note that if you have FLAC/APE files, Ampache will Catalog them, but they will play only in your media player and NOT on the in-built Flash Player.
There! It's playing. Now that we know our setup works, its time to go live! We will add more users so that other people can login and listen to On Demand tracks, albums, genres and artists and also Radio Stations :D.
You can also rate the tracks, edit their Metadata and do all the tinkering you want. Once the system is used for a while, the homepage will also show recently played tracks. You also have options to generate random playlists.
The next step now is to add users so that the music can be accessed by other people on the network.
Here is how we will go about adding a User:
Go back to the fifth tab (Admin) in the menu and select “Add User”. This brings up the screen above. Fill in the credentials and set the Access Level and voila! You have set up a new user!
In case you would want the users themselves to register, just modify the a line in the config file. You will find the config file under /var/www/ampache/config/ampache.cfg.php .
Open it in gedit (in superuser mode) as follows:
sudo gedit ampache.cfg.php
Once opened, look for the following line:
;allow_public_registration = "false"
Here, remove the semicolon at the beginning and make it “true”.
Now, people can access the server over the local network by opening the browser and typing the following in their address bar: http://<server's IP>/ampache, and they can also register and login themselves since we have enabled public registration. If we had not done that, users would have to be added manually by the Administrator.
In order to make the server accessible over the Internet, all you need is to get yourself a domain name and a live IP Address. You can bind these to the PC that has the Ampache server and you're all set. The procedure is beyond the scope of this article. Of course, make sure you don't violate copyright laws if you are planning on broadcasting over the Internet.
That’s all that there is to it. Now the beauty of On Demand Streaming has been unleashed all using Open Source Software. Hurray! So now, all I will do now is grab a cup of fresh hot coffee, pick up my Nokia N900, link up to my home network, fire up Mozilla, connect to my Ampache server, select that new Taylor Swift album and relax in an easy chair as the sound of networked multimedia soothes my soul!
Feel free to tweet-in lines of comment, feedback, doubts, issues, bouquets and brickbats to me at http://www.twitter.com/smmankad . (@smmankad)