Ubuntu + mpd + Jinzora + Hi-Fi == ACE
Ok, so here’s the problem:
- I have a decrepit old PC that I need to find a job for or it’s destined to sit on a scrapheap biodegrading over the next 10,000 years.
- We don’t have room to have all our CDs anywhere near handy so have to listen to our music on the computer speakers.
- We have a very good and very expensive hi-fi seperates system going to waste.
Here are contributing issues:
- Despite having a nice hi-fi, we’re not too bothered about the loss of quality of playing stuff via MP3 because we rarely get a chance to actually sit and listen these days – it’s generally background.
- We don’t like have cables stretched across the room and the PC is too far from the hi-fi to have a cable run.
So here’s the solution.
First of all, nab a copy of Ubuntu Server from http://www.ubuntu.com. Ubuntu is a Linux distribution based on Debian and is free software.
Next, we need to stick in a big enough disk to hold all the MP3s. In our case, I put in two disks in a RAID1 (mirrored) configuration cos I really don’t want to have to rip all those CDs again if we lose the disk.
Now then – time to get the “server” out of the middle of the living room before my lovely wife batters me – it’s duly lugged behind the TV unit (where the hi-fi is) and the sound output connected to the amplifier. Also, this particular machine has a USB wifi dongle plugged in (Thanks Dad!) so there’s no need for trailing network cables.
So, boot it up and off it goes. When installing Ubuntu, I told it I wanted a LAMP (Linux, Apache, MySQL, PHP) machine – it’s easy enough to set up normally, but Ubuntu does it all for you. I also installed openssh-server so I can actually log in to the thing.
Next thing I need are a couple of extra pieces of software:
- GD PHP extensions – for manipulating images from PHP scripts.
- MPD – the music player daemon. This little wonder sits on a network port and waits to be told what to play.
- MPDscribble – an optional one this, but it basically submits everything played by MPD to my Last.FM profile, so you can see it listed on the right of this site.
- Some extra codecs – Ubuntu, by default, doesn’t provide support for restricted formats like MP3. As it happens, I wanted to check that the audio was all working so installed mp3blaster – that pulled in all the restricted modules as dependencies so IÃ‚Â didn’t have to specify them manually. I also needed a mixer program to make sure the volumes were set properly.
The following terminal command does all that:
sudo apt-get install php5-gd mpd mpdscribble mp3blaster rexima
Grind crunch grind all done. First of all I ran rexima to set the mixer volumes. ACE.
Now then – time to get some music on it. I scp’d my MP3 files to /home/jmd/music. MPD, by default (on Ubuntu at least) looks in /var/lib/mpd/music for music files. I have the choice of either changing /etc/mpd.conf to point to /home/jmd/music or replace /var/lib/mpd/music with a symlink back to /home/jmd/music. I did the latter cos it’s a bit neater. Then I made sure that /home/jmd/music was readable by the apache user. One restart of mpd later and it can find all my music. ACE.
Now then – how will I control the thing remotely? The answer is via a web browser. Remember we told Ubuntu to set up a LAMP server? Well, it was off to http://www.jinzora.org to download the latest release. Jinzora is a full-featured web based jukebox which, as well as providing an interface to a local mpd instance, can also stream music from the server over the internet. I’m not interested in the streaming part (although it might be useful for listening to The Goons in my bed via my wireless Ubuntu laptop :)), just the mpd jukebox part.
So, download Jinzora, untar it and copy the contents to /var/www, followed by a quick chown www-user:www-user of the files so it can modify itself, and then follow the instructions.
The result – I can play, update, organise and manage our music collection via a web browser and it plays back via the hi-fi. ACE.
I’ve done this kind of set up before so it took my literally 15 minutes (excluding the time taken to copy 40Gb of MP3s over the network) to set up – I reckon a first time user could do it in less than an hour.
Now begins the tweaking!