Members
..:: Login

Features
..:: Articles
..:: Wallpapers
..:: Linux Tutorial
..:: Mobile
..:: Motorola A1200 Hacks
How-to: MPD, Music Player Daemon
by djlosch
Since MythTV's music player has an incredibly embarassing interface, and I still like to use my stereo system for my music, I clearly had a problem. The solution is MPD: Music Player Daemon, as suggested by Kevin72594, from Gentoo OTW. MPD is a service that accepts various clients and plays music files on the host computer. This is NOT a program to stream media to the desktop which you're using. It is designed to control a central server. The particular client I'm interested in was a web based client. This way, anyone on my network could control my music with their laptop.

..:: Software Summary

Title: MPD (Music Player Daemon) and MPC (Music Player Client)
Type: media service daemon
Purpose: control central audio server
Tested OS: Ubuntu 6.10
Screenshots: via [ MPD clients | djlosch UI ]

..:: Installation

Here's how to install in Ubuntu Edgy. First, make sure you have proper ubuntu repositories (I think only universe and multiverse are needed for this).
sudo apt-get install mpd mpc
Then edit /etc/mpd.conf. You'll need to uncomment one of the audio output sections. I use the OSS output with the default settings.
audio_output {
type "oss"
name "my OSS sound card"
device "/dev/dsp" # optional
format "44100:16:2" #optional
}
Also set the playlist and music directory at the top. I pointed the music link at my monster drive that has all of my music on it, and then I save my playlists in my home directory.

..:: Install the Web Client

The web client will allow you to visit your box through any web browser and control your box. You will need apache and php already installed, so get them if you don't have them yet.
sudo apt-get install apache2 php5 libapache2-mod-php5
Then install the mp2 web client.
sudo wget http://mercury.chem.pitt.edu/~shank/phpMp2-0.11.0.tar.bz2 -O /var/www/phpMp2-0.11.0.tar.bz2
cd /var/www
sudo tar --use-compress-program bzip2 -xvf phpMp2-0.11.0.tar.bz2
sudo chmod 755 phpMp2 -R

..:: Customize the Client

Here's the stock screenshot from the mp2 client page.


Open up your web browser and navigate to the box running MPD (localhost if you're on the server right now, or most likely some address on your network like http://192.168.1.200). Once there, click the Update button in the top right to scan for your music. Changing the settings through the Options tab doesn't seem to save them permanently -- only for the current session. I'm about to hit you with a bunch of changes, so you may just want to get my copy of the config file, but read on for an explanation of changes.
sudo wget http://www.djlosch.com/source/phpMp2_config.phptxt -O /var/www/phpMp2/config.php
I personally like size 8 font and the ember theme with the classic layout. To make these changes permanent, open the file /var/www/phpMp2/config.php. Go through and change the font_size to 8, layout to classic, and style to ember. I also vigorously maintain my mp3's ID3 tags, but I don't ever bother with the track number or album tags, so change the song_display_format, the column_files, and the sort variables to remove the Track and Album tags.

With these changes, this is what my UI looks like:

..:: Amazing Remote

If you have a cell phone, tablet, or PDA with wifi, you can control your music server from ANYWHERE that you get a wireless signal. This is awesome because then you don't have to worry about bluetooth applications with piss poor interfaces or transfer methods. I personally just use my laptop right now, but I'll definitely be moving to a smaller device soon.

..:: Streaming and Icecast2

MPD only plays music on the served box. You can also use MPD to serve files up to Icecast2, the internet radio streamer, but that's another how-to.

Post Last Updated: Nov 22, 2006 10:22 am
Related Articles
..:: An In Depth Look: DRM is About Far More Than Piracy - Feb 10, 2007 8:59 pm
Social Bookmarking (?)

StumbleUpon

Comments
Redplanet wrote on Wednesday, 3 January '07 - 5:49:25 PM -0500 [reply]
Hi, where do i become the packages?
Wehn i want to install them (sudo apt-get install mpd mpc), it doesn't find them.

Redplanet wrote on Wednesday, 3 January '07 - 6:56:29 PM -0500 [reply]
ok, i solved the problem already, i had to put the universe/multiverse packages in my sourcelist.

RandomGuy wrote on Saturday, 20 January '07 - 12:19:46 AM -0500 [reply]
you don't have to worry about bluetooth applications with piss poor interfaces or transfer methods.
sounds like you might not have experienced them before, but bluetooth works great for this. my setup was itunes on a macmini with my cellphone+bluetooth. it shows the album art, song progress and other info (artist/etc) all on my cell screen. no lag, no delay, quick response.
i have yet to try mpd, but will be giving it a shot as i'm done with itunes.

djlosch wrote on Sunday, 21 January '07 - 10:24:44 AM -0500 [reply]
My issues with bluetooth (now that I got a dongle) are:
-- lack of support for Mass Storage Device mode
-- horrible scripting options
-- feature lock-out by wireless carriers

Even if I change my box to allow my gf or friends to use their phone to control my system, many wireless carriers lock out bluetooth usage for anything but wireless headsets. I was incredibly surprised to find that I could send an mp3 phone from my A1200 (unlocked) to my gf's LG CU500 (cingular locked).

Apple may make things very easy and pretty, but they also charge a hefty premium for it.

T-Roy wrote on Sunday, 18 March '07 - 11:54:14 PM -0400 [reply]
Nice how-to on MPD. I saw your comment on moving to a smaller device and,ironically, Linux Journal magazine has an article this month (March 2007) about this setup. They use a music client machine running Gentoo and MPD that plays music from a central server. The controller device was a Nokia 770.

Kate wrote on Saturday, 21 April '07 - 11:39:17 PM -0400 [reply]
Awesome - I am a linux newbie (ubuntu of course) and was looking into jinzora but it seemed difficult. I followed your instructions and within 10 minutes I was accessing my music with my new T-Mobile Dash using the wi-fi (great phone BTW). Bluetooth may be okay but you have to be near the server, no? With this setup, I can be out on the deck accessing my music library to output to our outside speakers. Sah-weet.

Kate wrote on Wednesday, 25 April '07 - 10:33:40 AM -0400 [reply]
Question - my cell phone does not have a touchscreen and is running Windows Mobile 5.0 - how do I control the volume without the abilty to click and drag?
Awesome application and instructions!

Add Comment
Name:

Comment:


Please do leave a comment as I love to get feedback from visitors.
  • All fields are required, but your real name is not required.
  • Plain URLs (once again, no HTML or BBcode) will change to clickable links after 72 hours.
  • Comments are of the opinion of their author, not myself, and are not endorsed by myself.
  • Spam will immediately call upon the wrath of the BanHammer.