Internet Radio Project Part 2
I’ve started to receive my parts and have cleaned up my music collection using Beets, well I say cleaned up, I’ve actually got about half of it nicely sorted and half of it is just a bunch of random MP3’s or rips of old “Best Of” CD’s from Woolworths circa 1990! I’ve installed MPC and MPD, setup autofs to mount the NFSv4 fileserver, and got playback working from the 3.5mm jack by running:
amixer cset numid=3 1
Or set it back to HDMI using:
amixer cset numid=3 0
I sent one set of USB speakers back and got a new set that are much better, albeit larger, the sound from the 3.5mm jack is incredibly quiet though, so I look forward to receiving my DAC.
I’m not a big fan of how complex it is to manage MPC via the commandline – like having to add directories or URL’s before playing them, and switching between playing MP3’s and radios is too much hassle (stop MP3, clear playlist, add URL, play radio) and the Gtk+/Qt4 GUI’s seem like overkill, MPDroid is pretty good as a basic remote control; so I will still probably be writing my own basic web frontend or looking at the existing ones. Essentially I need the following capabilities:
- Play a directory of MP3’s (and therefore select it from a list)
- Play an internet radio URL (selected from a predefined list stored in a textfile which I can manually edit over SSH, no need for a fancy GUI)
- Stop playback (this could double as Play if playback is already stopped and vice versa)
- Skip to next track
- Display info on LCD
I don’t really need to control the volume, I could just use the speaker knobs. So really only five basic functions, probably a lot more complexity under the hood though.
The parts list so far is:
- 7 port USB powered hub £3.93 (they sent me a 500mA PSU not the 2A one!)
- USB powered speakers £4.90
- USB powered speakers £3.69
- PCM2704 USB DAC £9.56
- Micro USB cable 99p
- Soldering iron kit £9.98
- Pin headers £1.95
- HD44780 16×2 LCD £1.62
- Nano wifi dongle £4.89
- Breadboard cables £1.96
Plus the breadboard, 8Gb SDcard and electronic components I’ve already got, comes to about £35 so far (plus either £29.95 for a Model B or £18.88 for a Model A) still well under half the price of a SqueezeBox or MusicPal.
Update: if I do write a web interface, I don’t think I’ll be doing it in PHP, I’ve just looked at the latest PHP5 docs and it seems to have turned into Java with all the “public static class extends…” crap. I might use it as an excuse to try mod_wsgi in Python. I may possibly write a little client in PyQt although it seems that still has the licensing bullshit and is a bit dead, plus when I’ve used it before the Python wrapper seemed so much like C++ and un-Pythonic you might as well use C++, so maybe I’ll have a go at PyGObject for Gnome3 as I’ve not tried that since PyGtk for Gnome2.
Update 2: I’ve been thinking about the client, and I’d actually like to be able to use any of the multitude of clients available, as well as possibly my own, but be able to drive the LCD from them all rather than just mine. So I’m going to have to write some sort of daemon to monitor MPD, probably running mpc current
once a second or so to update the LCD.
If I go with hardware buttons for previous/next, then I can make those send a message to the daemon to do an instant update rather than wait a second. This chap seems to have come to the same conclusion. I don’t believe MPD has any kind of notification system like a DBus interface or anything that could be used, as that would be nicer than timed polling in a loop.
I’ve pretty much decided not to do a web client as I don’t want the extra load on the Pi, in case I go for a Model-A