Wednesday, September 7, 2005

mpd as a communal stereo solution

In our computer lab we have a communal stereo system which enables people to play their personal MP3s through the speakers at one end of the lab. This has greatly reduced the music mayhem that previously occurred when people w/o headphones wanted to listen to music, or people wanted a way to listen to music together. The system consists of a program called mpd the Music Player Daemon running on the lab's intranet server combined with four other programs used to control it.

First, a program called ampache is used to manage playlists and sets of music sources. Users can register the folder containing their music with it enabling the songs to be served up to the Music Player Daemon. This utility has good support for mp3 files and allows all users to create playlists spanning multiple users' libraries.

The next program that is used to control the system is mpc, the Music Player Client. This is a simple command line utility that can modify the mpd's playlist, playback volume, etc. Its two most useful commands are mpc next and mpc volume +n. The first skips the current song and the second adjusts the volume up or down (with -). This tool can be used from the command line by anyone to tweak the volume.

Finally I use the grifcat utility to monitor a number of Griffin PowerMates sprinkled around the lab. These knobs allow anyone in the lab to remotely control volume as well as the current song. Since the lab is a communal environment, it is possible that individuals in the lab may not particularly like other's song selections. Therefore if the knob is pressed, the current song in the playlist is skipped. Grifcat's output is captured by a perl script that translates knob twists into calls to the mpc program adjusting volume and skipping songs.