
Making a networked Jukebox
Date: Saturday, July 31 @ 15:51:32 BST Topic: Linux, GNU, Open-source
Music Player Server Daemon
By Dave Holden - linuxcoaching.org
Many people w
ant an application that allows a computer to be connected to a Hi-FI stereo system to make a quality Jukebox.
Under GNU/Linux, the standard application that gets used is XMMS. Whilst this
is a robust proggie with lots of nice pretty skins and plug-ins, that is great for a desktop system, it can be a little awkward to use remotely on the network. You have firstly xhost + , then ssh into the re
mote machine, export the display to the system you are running from and start XMMS. There are other problems too. What happens when the remote system has not been left with X-windows running? well XMMS has
been set up to run with X and needs to be rconfigged for different outputs when X isnt active, you usually end up using mpg123 or similar app from the command line. If you have users that are not very good
with remote command line this is a real pain.
However there is a real saviour application available. MPD is a server daemon application that providea a mp3 or ogg jukebox that is easily ac
cessed remotely.
The MPD can be installed on an old system that has become too slow for todays desktop use. It will run quite happily on an 266Mhz pentium with 64Mb ram, the old AT bus Soundblaster
card and a H/D big enough to carry a collection of music, oh, and a network card of course. Mp3s and Oggs usually compress wav tracks down to between 2 and 5 Mb of disk space, so you can store around 1000 tr
acks on the old 4GB drive and still leave enough space for the GNU/Linux (300Mb or so if you dont install X). If you need more drive space for your collection, you can always mount it by NFS from a remote ma
chine on the network.
Ok, I've probably turned off the Hi-fi pureists already by mentioning compressed digital formats, well maybe they dont sound quite as good as vinyl, but just think ab
out the convenience and cost savings, (how much did that moving coil cartridge and preamp cost?). 16-bit digital from 128Kbps 44.1KHz samples do sound reasonable through a decent amplifier with nice speakers
, most folks cant tell the difference. Apart from the lack of crackles and perhaps a slightly higher noise floor from the equipment, the system wont wilt your ears.
Convinced, ok read on...
Firstly get your old PC installed with a minimum GNU/Linux system. Use your favorite distro, SuSE, RedHat, Debian.. any one will do. You dont need to install X or any window manager, just the b
asic console stuff. You will also need to install a compiler, GNU make, GCC, GCC-c++, glibc-devel, libstdc++-devel, libao, libao-devel, zlib and zlib-devel (also install the Ogg/Vorbis development tools if y
ou want to work with open audio compression formats). These all come as standard with most distros but do need to be installed as rpms (or pkgs with Debian) through the system configuration tool. What, youv
e never compiled anything? Dont be afaid, its really quite easy, just a few simple commands.
You will also need to set-up your old PC so it can talk to your Desktop workstation via the NIC
. SSH remote logins and FTP will also be required, and a File manager such as mc is probably a necessary convenience. You will also need access to the net from your Desktop Workstation (but if you are readin
g this....).
So, youve installed the box and got the NIC and the SoundCard set up, (good distros have tools for this) and can shell into it from your workstation. Good.
Y
ou will now need to go out onto the web and get the packages you need. Go to www.musicpd.org and download two packages. The first is the latest version of
MPD daemon. At the time of writing it was mpd-0.11.4.tar.gz. Also get the commander
software ncmpc (ncmpc-0.11.0.tar.gz). Have a look round at the other stuff of the site as there are also some gra
phical commander thingies you might like for your desktop workstation. You can download the stuff through your browser, and best of all they are all GNU Public License.
Interesting site eh!
Ok, now lets proceed...
FTP the packages onto the old PC. (I usually do a root SSH into the system and open mc and cd ftp:// back to my workstation to get the packages), and unpack them
(with tar -xzvf, or if your using mc hit the enter key on the tar.gz then F5 to copy the unpacked stuff). Maybe I shouldnt but I find it easiest to work as root when I am compiling stuff. I usually unpack t
he things I download into directories of the /root dir and work from there.
Shell into the dir where you unpacked the MPD. Check out the details supplied with the package, (cat README and
cat INSTALL) and then type ./configure. This starts the checking process to make sure you have all the necessary tools on the system to complete the compiling process. All being well the process shou
ld complete with no errors. If you do get an error it will inform you of which tool or library is missing. (You will have to install it and then repeat the configure process).
Ok, no error
s - type make, this starts the compiling of the package. It can take a while, especially on a slow system. Again, all going well, this process should exit with no errors. (If you do get errors you m
ay have missed a library or tool during installation, check carefully on the error listing and install whatever is required, then restart the make process).
All being well, and youve made i
t this far ;-), if you arent already, become root (su -), and type make install. This puts all the compiled proggies into the right places on the system.
The mpd binary installs int
o /usr/local/bin and the relevent documents into /usr/share/doc/mpd. You now need to do a little bit of configging before trying out the program. The proggie need somewhere to store its database and it need
s a config file in /etc/mpd.conf , you will have to create these.
Still as root, cd to /usr/local and mkdir ./mpdvar , cd mpdvar and mkdir ./playlists then touch mpd.log and touch mpd.err ,
cd ../../ and chmod -R 777 ./mpdvar , This creates the necessary dir/file structure and allows open access to these dirs. You may want to change the access permissions later.
A sample con
fig script is included with the MPD. Its in /doc dir that comes with the package filename mpdconf.example , just copy this to /etc/mpd.conf and modify the top section as shown below:-
###
################# REQUIRED ###########################
port "6600"
music_directory "/home/sounds/mp3"
playlist_directory "/usr/local/mpdvar/play
lists"
log_file "/usr/local/mpdvar/mpd.log"
error_file "/usr/local/mpdvar/mpd.err"
##########################################################
Thats it !!
You should now have a working installation of the MPD.
Before running the proggie though you will have to create the Music Directory and populate
it with your collection of songs. You may already have some mp3s, but if not you can use GRIP or KAUDIOCREATOR to make some from your favourite CDs. You will need to run these apps on your desktop workstat
ion and transfer the resultant rips to the music dir on the server.
Once you have populated your music dir, you can run the MPD. It will do no more than create the database at the moment.
r
You can start the MPD by cding to /usr/local/bin and typing ./mpd
To make the system complete however, you will need the client program NCMPC.
This has to be com
piled with the same procedure, as outlined above, that you used to make the MPD.
The NCMPC is a console based jukebox commander. After compilation it installes into /usr/local/bin. By def
ault it is set up to address to localhost so you can run it directly on the music server, simply by typing ncmpc.
The Commander has three basic screens accessed with the F1, F2 and F3 keys
(also repeated on keys 1,2 & 3). 1 is the help screen, 2 the playlist and 3 the music browser. Its very intuitive to use just select the tracks from screen 3 using the spacebar. This puts them into the play
list. Change into the playlist and start the music by hi-lighting the first track and pressing the enter key. You will find that you can increase and decrease the volume with the + and - keys (put numlock o
n).
The commander interface is full featured allowing seeking within tracks, repeats, shuffles etc, in fact all the feature that you normally find on a standalone CD player.
A bonu
s feature is the Ctrl-U key which allows for updating of the music database after you have added new tracks to your collection.
To run the commander from a remote workstation simply copy th
e binary to the /usr/local/bin dir on your workstation and run it with an appropriate command.
e.g. ncmpc # host=musicserver # port=6600
However, as mentioned earlier, f
or desktop use you may prefer one of the graphical interfaces (such as the QT based MPD Commander or the php website scripts), available from http://www.musicpd.org Great programming fellas, keep up the good
work.
Enjoy.
|
|