FlatFeetPete's Music Box

THIS DOCUMENT IS A WORK IN PROGRESS!!! Pictures and a movies at the bottom of this page.

**NEW** Other people are doing similar things. Well one person anyway.

Short Description

There's two main parts.

Each card is printed sideways with album cover art, artist, title and track listing. A barcode on both sides of the card uniquely identifies it. When inserted the PC analyzes the image to pick out the barcode. The barcode is linked to a playlist, which is played when the card is inserted.

The need it addresses

For a while I've been trying to work out a solution listening to my mp3 collection. When I moved in with my better half Jess, I ripped all of her CD's onto my PC, the plan being we could listen to the tunes using the PC in my front room instead of using CD's. This would also mean our music collections would both be in one place.

This was fine, and it was cool that it was all digitized, but there a few issues that popped up.

How it came about

So I started thinking, and being a software nerd I tried to think of a software solution. I had a vague memory of Clutter for Mac OSX, and was thinking of making something similar for the PC, but as a browser instead of a desktop addition (my windows desktop's a mess as it is). This resulted in an OpenGL app with many CD cover images bouncing around. This was ok to start with, but even with a texture cache startup times were slow. [Screenshot coming soon].

I also thought it was a pity that covers like this on the iTunes music store wouldn't be seen in the flesh. I guess I mean in the card.

So the issue was left fermenting in my mind until I read the leaflet that came along with the game Apples to Apples (top game). Available to order were these blank cards, especially designed for use with an online system that would generate a pdf for you if you entered a few key phrases. It got me thinking that it would be nice to have the CD collection on cards like this, especially with all the cover art.

The next steps were a case of just trying to work out how to get stuff to work. I wanted magic cards that would play CD's, so I thought of a holder with an electrical reader based on optical sensors. This would mean delving into electronics and device construction but before that I wanted to get an idea of how the device might feel. This led to simplifications for the sake of prototype development speed. A webcam and software replaced the electrical reader.

This left the issue of how to mount the webcam. I originally had ideas involving cutting up plastic and losing fingers trying to use a dremel, but then Jess had the excellent idea of using lego, so we bought one $20 basic box of lego (which I wouldn't recommend really really strongly as it contains a lot of the smaller bricks) and built the contraption you can see at the bottom of the page.

Initial Software

All software involved was hacked together using MFC and various open source libs. There's currently two applications involved.

PDF Generator

The PDFGen app generates PDF's to be printed on Avery style business card sheets. Each card includes:

The cover art was sourced mainly from walmart and amazon. The artist, album and track data was extracted using id3lib. This allowed me to use existing tagging programs to get the songs metadata right.

I've got a fairly strict Artist/Album/Tracks directory structure so PDFGen uses a simple directory search to get a list of albums and creates playlists for each album. The barcode is auto generated using a system that's currently fairly dumb.

All these elements are pulled together into a pdf using the open source ClibPDF library. It has a nice "make this text smaller till it all fits in this box function". The barcode is generated using a Code39 font from IDAutomation. I would have used this totally free Code 39 font, but PDF's need a different type of font. To be honest they're so simple I've been thinking about just drawing them myself with boxes anyway.


The Barcode Decoding Algorithm was originally developed using MATLAB. A screenshot of the matlab in use is here. I like MATLAB's simple visualisation features, and the fact that I could play with ideas as I learnt about the properties of Code 39 barcodes.

The matlab source code used is here (pretty print, raw). Comments are more than welcome. I stopped playing with this as soon as I had something working, so it may be inefficient. I've added a few comments to describe what's going on.

Being a typical programmer the app that I used as a harness for the C++ version of the decoding routine has become the app that decodes the barcodes, and plays the appropriate CD. Although I've got mp3 players running in other apps, for now I've elected to use ShellExecute on the appropriate m3u playlist. I've currently got this set up to launch winamp, although it would fire up windows media player if thats what m3u files usually launched.

Current Plans


Software Development

The MATLAB shot mentioned above.

Rev 1



Click the video to watch it at youtube.com with annotations.

Rev 2


Lee Holmes has created a similar project thats innovative in a few interesting ways. He's also much more organised so he's able to be generous and offer a download on the project's page.


Compiled from e-mails

How does the card stock hold up?

All the cards seem to be holding up great. The avery B&W laser smooth edge cards don't take to well to very highly saturated color laser printing, but I have to fess up that I tried this after the nice lady at 1-800-GO-AVERY had warned me that it might.

Why not just use a CueCat?

I had a webcam, I didn't have any CueCats.

Also I wanted to keep the new physical cards available. One physical item, one CD. The temptation with a cuecat would be to print entire albums on one sheet, maybe in a booklet. Some how little piles of cards seems less intimidating than a book. I'm remembering hearing about a technique used by door-to-door carpet salesmen where people would give householders a heavy samples book to anchor them down so they couldn't usher the salesmen out. Having said that the 3-400 cards I have now can be fairly intimidating. I've been considering some kind of ranking or favourites marking system. Maybe genre icons, I'm not sure.

Saying that, if the cuecat was wireless and the codes and covers were prinited on the wall that would simultaneously be a cool wall covering and a good way to index the music. But a cameraphone seems more likely to work than a cue cat here.

Also CueCats are not as cool as lego.

I was also originally planning to use a 2D barcode, but that's fallen by the wayside.

I want to make one with a CueCat, any chance of getting the PDF generation stuff?

The code currently has a few issues:

All these things should be fixable fairly easily, but I'm neck deep in other projects at the moment. If someone's got the energy then get in touch and maybe we can work out a sourceforge project or something.


©2004 Peter Bradshaw
Comments and questions welcome: