(Notes - in progress. I'll clean them up shortly.)
Contents |
Parts of the following (namely the replacement of firmware) require a certain amount of knowledge and risk. Don't hold me responsible if you damage your firmware or equipment!
I managed to build a decent streaming interface to my stereo with a NSLU2, Slimserver and MPD. It can play local and remote MP3's, in addition to certain streams.
Also, please note that this is an ipkg install. If you're interested in building MPD from scratch, these notes are probably what you're looking for.
1) NSLU2 (AKA the Slug, once you've reflashed the firmware) 2) AudioAdvantage Micro USB Audio Interface 3) 1GB thumb drive (acts as the disk drive for the Slug) 4) Mini-DIN to RCA stereo cable (usually comes with some of the lower-end home theater speaker systems) 5) My desktop system, of course
You can use a smaller thumb drive. It's just what I had on hand. For me, this install used 138 MB. Your mileage may vary.
1) On the Slug: MPD 2) On the desktop: ncmpd, SlimServer
SlimServer is the Slim Devices software that streams audio to that $300 SqueezeBox interface for your stereo. (Thank you Logitech!) I saved a few hundred bucks by recycling my NSLU2 and using it in place of a SqueezeBox. I don't have all of the functionality (no remote!) of a SqueezeBox but I do have music!
ncmpd is a command line remote control (AKA a "client") for MPD. You'll need a client such as ncmpd (on the desktop) or mpc (on the Slug) to set up the initial connection from the MPD daemon to the SlimServer. You'll also need it if MPD "forgets" what it was last doing (e.g., you mess with the state file or a power outage).
There's really nothing out of the ordinary as far as installation. You should:
1) Install Slug via these instructions (moderately difficult) 2) Install MPD on the Slug via "ipkg install mpd" (easy) 3) Install SlimServer on your Linux desktop system. (moderately difficult)
Here's my "/etc/mpd.conf":
port "6600" music_directory "~/music" playlist_directory "~/.mpd/playlists" db_file "~/.mpd/mpd.db" log_file "~/.mpd/mpd.log" error_file "~/.mpd/mpd.error" state_file "~/.mpd/state" ao_driver "oss" audio_output_format "44100:16:2" ao_driver_options "dev=hw:0,0" mixer_type "oss" mixer_device "/dev/mixer" mixer_control "Vol"
The really powerful line is the "state_file" line. It causes MPD to resume whatever it was doing when it was interrupted (shutdowns, reboots, etc.)
I had an issue in getting the sound to work after every reboot. Turns out it wasn't loading the snd-pcm-oss module. I cheated and added it to my startup script (/etc/rcS.d/S99zzLast):
#!/bin/sh modprobe snd-pcm-oss mpd /etc/mpd.conf
I use ncmpc and/or a modification of Thomas Morgan's Client::MPD web-based remote control for MPD. Some other clients that you can use are listed here.
Whatever you use, have it point MPD at http://192.168.1.175:9000/stream.mp3 (or whatever IP your desktop is). After that, point your browser at http://127.0.0.1:9000 (or whatever IP your desktop is) to access Slimserver. Then just pick songs or a stream, add them to the playlist and hit "Play". With this set up, there'll be a 5-10 second delay depending on what you're playing. This delay can be caused by one or more of the following (I'm guessing): SlimServer buffering input from the outside world, SlimServer transcoding a stream, and/or MPD buffering the stream from SlimServer.
What's really nice about this (if you don't mind lack of exact synchronization), you can connect multiple Slugs (and/or SqueezeBoxes) to the same SlimServer.
Since the tool to manage the audio sources (SlimServer) is web-based, I figured that a web interface to MPD wouldn't be too much more trouble. Basically, all you need is something tell MPD to start playing the stream. Just about the most basic MPD web client is Thomas Morgan's Client::MPD. Installation is straight forward (follow the docs)(remember to edit the host entries in index.php and playlist.php!). If you don't mind the interface provided by the software (basically text links on a web page), there's nothing else needed.
Me? I was annoyed by the text interface so I replaced the text in the links with graphics (borrowed from the Internet and prettified with Gimp), added a meta-refresh and came up with the following:
The modifications are quite simple. They amount to:
print <<<BLK2 <table border=1><tr><td> <table border=0 cellpadding=0 cellspacing=0 bgcolor=white> <tr> <td><a href="$me?$rnd" accesskey="*"><img src="/mpr/buttons/refresh.gif"></a></td> <td><a href="playlist.php?$rnd" accesskey=\"1\"><img src="/mpr/buttons/list.gif"></a></td> <td><a href="$me?stovr&$rnd" accesskey="0"><img src="/mpr/buttons/seek.gif"></a></td> </tr></table> </td><td> <table border=0 cellpadding=0 cellspacing=0 bgcolor=white> <td><a href="$me?voldn&$rnd" accesskey="7"><img src="/mpr/buttons/down.gif"></a></td> <td><a href="$me?volup&$rnd" accesskey="9"><img src="/mpr/buttons/up.gif"></a></td> </tr></table> </td><td> <table border=0 cellpadding=0 cellspacing=0 bgcolor=white> <td valign="center"><a href="$me?prev&$rnd" accesskey="4" alink="#FFFFFF"><img src="/mpr/buttons/prev.gif"></a></td> <td><a href="$me?stop&$rnd" accesskey="8"><img src="/mpr/buttons/stop.gif"></a></td> <td><a href="$me?pause&$rnd" accesskey="2"><img src="/mpr/buttons/pause.gif"></a></td> <td><a href="$me?play&$rnd" accesskey="5"><img src="/mpr/buttons/play.gif"></a></td> <td><a href="$me?next&$rnd" accesskey="6"><img src="/mpr/buttons/next.gif"></a></td> </tr> </table> </td></tr></table><br/> BLK2;
Yell if you want a copy of the index.php file.
Minor complaint: 32kbs streams are not usuable (they play too quickly). You have to watch out for them when you're choosing ShoutCast streams.
Minor complaint: There's about a 5-second lag between making a change and it occurring. Only noticeable when you're starting/stopping/changing the station/changing the volume.