Media Server Odyssey Part 1: The Architecture

This is part of my Media Server Project (odyssey!). You might want to start at the beginning.

It was only after I started thinking about this problem that I realised how complicated it could be. A media player actually has four separate components:

  1. The Storage, which holds the encoded music.
  2. The Decoder, to translate the stored music.
  3. The Renderer, which actually makes the noises. I guess a purist might separate this into amplifier and speakers.
  4. The Controller, which allows the user to choose the music. This usually includes a visual display and some buttons to press.

As an example, in an old-fashioned integrated CD player, the storage is a CD; the decoder is inside the device somewhere and it’s rendered through and internal amplifier and the speakers; the controller is probably an infra-red remote control but you also have some crappy LCD display telling you what track is playing and so-forth.

An iPod is actually pretty much the same – everything is contained in the fancy unit you buy from Apple. The only difference is that there is a degree of faffing to get your music (from CDs or the web) and then upload it onto the hard drive of the iPod. Also the controller part involves less manual changing of media (storage) than a CD player.

It’s only when you start to put one of these things together for yourself that you realise you are responsible not only for each component, but also for the linkage between components. In your integrated player this is all invisible inside the device but building your own means worrying about wires or wireless protocols connecting each piece and all the potential problems there can be at each stage.

At the storage stage, a digital media centre (thing) is probably based on a hard drive (or maybe SD card or SSD? That’s probably too small/expensive though). That’s great – now you need to plug the drive into something and serve it. In my case I’m going to use a Raspberry Pi running Linux of some kind, but I still need to export the files. I could do this with a Samba share but then I’ll need something that can mount that – probably another PC-grade device like another Pi. A better choice might be to export the files with uPnP or the more advanced/less general DLNA and then another device can consume those files. The auxiliary benefit of this is that I also serve media other than music, of which more later. Of course, there are then many choices of uPnP/DLNA servers that run on Linux.

Quite a few devices can consume music from uPnP, including a smart phone (I have a crappy old HTC Desire), tablet or even a fancy TV. Or, of course, another Pi – they only cost £30 after all. So I could serve the music and play it on my phone using a uPnP client like Bubble uPnP (which is a cool app by the way, although the search is a bit slow. Maybe that’s a server-side problem). Bubble uPnP has an interface to search, queue up and play music, so this use of uPnP has the phone doing the decoding and the controlling. Then I guess I could plug my phone into my old CD player. This would work, but if I’m going to have a device tethered to a CD player I might as well just use an iPod.

One alternative is to use XBMC, which is integrated media centre software that runs on Linux. There is even a Raspberry Pi XBMC distribution. It’s actually a very polished product and looks great, but as far as I could tell, it’s really not designed to run without a monitor (to do the “controller” part). You can download an XBMC remote control for Android and this thing confused me for a long time – it’s actually designed to operate a bit like a remote mouse to control what you can see on the XBMC interface. This makes perfect sense if you’re expecting the display to be on all the time, like if you’re XBMC device is supposed to be playing videos, but I would really like my Pi to be headless (no monitor), if possible. This is how you might expect a plastic-and-rubber remote control to work, but having a smart phone which has a screen and a keyboard work as just a cursor control seems to be missing an opportunity. Feel free to Email me and tell me I got it all wrong.

Anyway, my first design went like this:

  1. Raspberry Pi running Raspbian with a USB drive full of MP3s. There were some hardware complications with this, which I’ll come back to later.
  2. Minidlna to serve the files. I also tried MediaTomb, but I found it a bit slow and I thought the web interface was awful. I’m an old Linux nerd and I prefer text config and log files. The Pi with minidlna constitutes the storage.
  3. A reconditioned Galaxy Tab 2 Android tablet I got for £200 on eBay. I guess it must be one step behind the curve, because that seemed like a good price to me. I guess I’m just not sophisticated enough to know any better. This has Bubble uPnP installed on it, so it’s doing the decoding and controlling.
  4. A Creative ZiiSound D5x Bluetooth enabled speaker that was going cheap on Amazon. This is the renderer.

So as you can see, not only do we have quite a few technologies involved in the components, but we also have USB, WiFi and Bluetooth linking the components. Complicated. The good thing is that the whole thing is wireless, which is convenient. I can site the Pi wherever I want – in a cupboard or something – provided I can wire it into my home network, probably with wifi (more on that later). The only problem is that it’s not as flexible as I might like – if the tablet is reading and playing the music, it can’t be controlled unless you have the tablet. If the table runs out of batteries, it stops playing.

Did it work? Stay tuned.


One Response to “Media Server Odyssey Part 1: The Architecture”

  1. Media Centre Odyssey 3: Architecture Revision | Peter Saffrey's Weblog Says:

    […] original architecture used a uPnP Android device with Bubble uPnP and connected to my Bluetooth speaker. It seemed to […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: