Open Spark 2012

Here are my entries for the 2012 Open Spark Project. Two massive Tesla coils are controlled by MIDI sequences, and there's an audio channel for the background music.

First item: I really wanted to do an operatic duet, so I chose the Flower Duet from Lakmé, by Léo Delibes. The basis for this was an arrangement by George Pollen. I picked out the two main voices from amongst several instrument tracks. The remaining voices are synthesised to the audio track.

Second item: The song "Nikola Tesla", by Ben Folds, Neil Gaiman, Damian Kulash, and Amanda Palmer. An obvious choice, but a bit of a risk as I was unsure whether two Tesla coils could work as "backing vocals" when they the loudest freaking instruments in the place. I was gratified that Neil responded with a "glorious nerdy rush of pride". I hope you like it too.

LCD Multitouch Table Mark 1

Multitouch is cool, but its also becoming cheaper and more accessible thanks to the work of folks like Jeff Han, and communities like the NUI Group. Of course, devices like the iPhone have made many of these ideas mainstream, but not everyone wants to do multitouch on a tiny display. Multitouch surfaces have great potential as intuitive, multi-user, social computing environments.

I wanted to build a small, portable touch table that can be used by one or two people. The display surface is the horizontal table top, and people "play" at opposite sides. Its a bit like those old-style sit-down arcade games, though for the life of me I can't remember any games that were simultaneous two-player. Both users can touch the surface, but also maintain face-to-face interactions across the table. The device is designed particularly with kids in mind, for play between two children, or between a child and parent.

One of the main motivations for building this was to come up with an aid for educating kids as young as 2 years old. Some children struggle to learn stuff that most of us pick up effortlessly, like how to talk and interact socially. Very early intervention can make a huge difference for kids with conditions like autism and other language disabilities. While therapies like ABA can be very effective, they can also be gruelling and intense for both the child and the therapist (usually, the parent). If we can simplify this process using engaging interactive games, and by sharing and building resources collaboratively on-line, this has to be a good thing. More on this later...


There are many ways to do multitouch sensing, but the basic idea used here is to measure pressure optically with a camera. A great place to get some background is this thread at NUI group. Since I wanted to do fiducial tracking, I chose an approach based on diffuse illumination. This means that the display does not rely on a very tight coupling with the surface to illuminate objects.

I wanted my table to be small, cheap and robust, so I chose to use an LCD rather than a projector. LCDs don't transmit diffuse IR very well, so the illumination is provided by the surface itself (Diffuse Surface Illumination, or "DSI"). A special type of acrylic (called "Endlighten" or "DLux", depending on the manufacturer) is used as the top surface of the display. This has embedded particles which reflect light out the surface when lit from the side. This material is often used in display signs.

Parts List

  • LG W2252TQ-PFT 22" LCD Monitor
  • Unibrain Fire-i B/W Camera
  • 2.5mm focal length lens
  • Mac Mini
  • Firewire 9-pin to 6-pin cable
  • IR pass filter 850nm
  • Acrylic panel, 10mm "Endlighten"
  • IR LED strip illuminator
  • Power supply, 12V for illuminator
  • Misc hardware: MDF, wood screws, nut/bolts, square dowell, 1" aluminium angle, steel strip, T-nuts, hinge, construction adhesive, silicone sealant, magnetic catches, gaffa tape

I found a lot of useful information on-line, but much of it was fragmented. So here is an illustrated guide to how I built my system. Click on the images for higher resolution versions.
Continue reading ‘LCD Multitouch Table Mark 1’ »

A batch controller for Autostitch

Autostitch is an automatic 2D image stitcher. Give it a collection of partly overlapping images, and it will position and blend them into a seamless panorama. A demo version of Autostitch is available for free download. It has a simple GUI which can be used to select input images, and adjust parameters such as output resolution, cropping, and image rotation. However, the GUI interface is a little inconvenient when you have a large number of repetitive stitching tasks to perform, for example : panoramic video.

A panoramic video can be made by stitching each frame of an input video against a background panorama, as described in this earlier post. To do this we need to run thousands of separate stitching operations, each with different sets of images. Its too much to do by hand via the GUI, which is why I wrote this little batch controller for Autostitch.

The batch controller is a simple program that pretends to be a user, sending sequences of events to the GUI to simulate the normal operation of the program:

  1. In the Autostitch window, select menu File -> Open.
  2. When the open dialog appears, enter a set of image names into the edit control, and then press the "Open" button
  3. Wait for Autostitch to finish processing
  4. When Autostitch opens the preview window, close it. This makes Autostitch ready to perform the next stitching operation

Fortunately, this is not too hard to do using the Win32 API. FindWindow(NULL, name) gets us a top-level window with a given name (eg. "autostitch" or "Open"). The controls for a window can be recursively enumerated using EnumChildWindows(window, callback, data). We can use our own callback function to search based on the name or class of a control. Windows uses messages to communicate events to controls. We can generate the same messages using SendMessage. For example, to click a button:

  SendMessage(button, BM_CLICK, 0, 0);

or to enter text into an Edit control:

  SendMessage(edit, WM_SETTEXT, 0, (LPARAM) text);

If you want more details, check out the source from the download links below.


To use the batch controller, you need to first start Autostitch in the usual way. Autostitch must be "pointing" at the directory containing your source images. You can set this using the "File->Open" menu. Just select one or more images and press "Open" - it doesn't matter whether the result is successful or not. From the command-line, you can then stitch any set of images from that directory like this:

  stitch file1.jpg file2.jpg file3.jpg

This will stitch the images as usual, opening the result "pano.jpg" in the default image previewer. To run multiple stitches in sequence, the preview window must be closed before the next stitch can start. Request this by specifying -wait -close. For example:

  stitch -wait -close file1.jpg file2.jpg file3.jpg

To stitch a sequence of images, use the -template option, like this:

  stitch -template frame%03d.jpg 20 50 file1.jpg file2.jpg file3.jpg

This specifies a file name template (using sprintf syntax), and a range of file numbers. The example generates a sequence of names "frame020.jpg", "frame021.jpg", ..., "frame050.jpg". Each stitch operation combines one of the sequence names with the remaining arguments, and renames the output panorama (by default, to "out0020.jpg" ... "out0050.jpg"). Template mode automatically implies -wait -close.

Here are some simple examples using the Autostitch demo images:

  stitch -wait -close 100-0023_img.jpg 100-0024_img.jpg 100-0025_img.jpg

This stitches the bottom 3 images of the "mountain" panorama.

  stitch -path s:/stewart/programs/autostitch/images/test/ 
             -template 100-%04d_img.jpg 38 40 
             100-0023_img.jpg 100-0024_img.jpg 100-0025_img.jpg

This stitches each of the top three images (38..40) against the bottom three images, producing three outputs, "out0038.jpg" .. "out0040.jpg". (change the path to reflect your Autostitch installation).

There are a bunch of settings that you might need to change. For example, the system looks for the preview window using one of the standard applications ("pano.jpg - Windows Picture and Fax Viewer" or "Microsoft Photo Editor - [pano.jpg]"). If you have a different preview app, you'll need to change the title of the preview window using the -output option.

In "template" mode, the system renames each "pano.jpg" to a different file name using the sequence number, but to find the resulting file you need to specify the result directory using -path. Alternatively, run the stitch command from the directory containing the source images.

-help      Show help message and exit
-version   Show version and exit
-wait      Wait for Autostitch to complete (single stitch only)
-close     Close preview opened by Autostitch (single stitch only)
-template  temp start end Specify template for batch operation
           A range of images is processed for start <= id <= end. Use sprintf
           formatting (eg. id=23, temp='file%04d.jpg' -> 'file0023.jpg')
-dryrun    Just output batch image lists without calling Autostitch
-path      Path to image directory (for batch stitch). INCLUDE TRAILING '/'

Stuff you probably don't need to change:
-window    Name of Autostitch window (default: autostitch)
-status    Name of Autostitch status window (default: Status)
-output    Name of preview window (default: 'pano.jpg - Windows Picture and Fax Viewer')
-fileOpen  Menu name for File->Open dialog (default: 'File:Open')
-openTime  Delay (in ms) for open dialog to populate controls (default: 500)
-closeTime Delay (in ms) to wait before closing preview window (default: 2000)
-outjpg    Template (dir,id) for output files (default: '%sout%04d.jpg')
-outtxt    Template (dir,id) for output files (default: '%sout%04d.txt')


This app is fairly minimalist, but it should not be hard to modify if required. I used mingw + gcc which are available for free from

Have fun! And if you manage to create something interesting, please post a comment.

Check here for more fun with Autostitch.

Spooky Men of the West launch new album

"Created some time ago in 2005, The Spooky Men of the West is Stephen Taberner's twisted vision for the western chapter of the The Spooky Men's Chorale.

This now rogue chapter has expanded its repertoire with their own musical masterpieces, drawing on personal feelings and other things.

The Spooky men of the West seems to have been formed with no end in mind - luckily, cos there's no sign of stopping them now..."

"We never meant to come here" is the brand new EP from The Spooky Men of the West. A sixteen voice male acapella choir, the Spooky Men of the West explore (or should that be "subjugate"?) a range of musical styles from traditional Georgian table singing to contemporary and original works. Their sound has been said to be "gentle and sad, even sweet, but also sexy, powerful and unmistakably male". One newspaper report aptly describes them as "a group of wierdos who sing".

"We Never Meant to Come Here" includes six new songs that depart from Stephen Taberner's Spooky repertoire. "Navigation" is an original song by the Spooks, with music by Spookmeister Ryan Morrison. "Delilah" (Mason & Reed) and "When You Sleep" (CAKE) are surprisingly recognisable after being given a Spooky makeover. "Varjele" was written by Digby Hill, loosely based on a Finnish folk song, and "Mirangula" is a traditional Georgian lament. The "Norwegian Sailors Chorus" is Wagner as you have never heard him before, and possibly never want to hear him again.

Rather than trying to explain what this is about, check this out:

"When You Sleep" is Simon Nield's beautiful interpretation of the song by CAKE. To call it a cover is almost unfair because this version actually has a melody, something that is missing from the catchy but rather tuneless original. I guess this song appeals to my sense of strange, which makes it a personal favourite. Another stand-out track for me is Digby Hill's rousing arrangment of "Varjele", which perfectly sets the mood for marauding. And who else but the Spooks could turn a Wagnerian drinking chorus into a treatise on the demise of bathtime. I hope they're not suggesting we drink the bathwater...

I have just two tiny criticisms of this album. Firstly, the opening track "Navigation" is too short. Just as the song gathers momentum its finished - perhaps that's the point the song is making, but I felt I wanted more of the wonderful "home is where I hang my hat" motif. Secondly, while the CD sounds great it lacks some of the energy of the live performances, but I guess this is always the trade-off with studio recordings.

My advice is to get this CD but go see them live if you can, because part of the Spooky experience is that dissonance between the warm, wonderful evocative sound and their strange understated deadpan humour. If you're in Western Australia you can catch them at the upcoming Denmark Festival of Voice, and at the odd gig around Perth. For details and CDs, check their web site.

Repurposing a broken office chair

Cheap office chairs really aren't built to last.

Here's what usually goes wrong:

  • The arm rests are screwed into the plywood base of the seat. Any sort of load on the arm rests tends to split the whole side off the seat. Not good when you have kids about - they love to swing on these things which really hastens their demise.
  • The gas-lift stops working. These are not really repairable, although they can sometimes be replaced if you can find the right part.
  • The back adjustment works using a clutch-like mechanism. The clutch is made of thin steel plates which are welded to the base of the chair. These plates can snap off, and once they've all gone the back of the chair is completely floppy. In our chair, all of the plates have snapped of just before the weld with the base. Unfortunately, the mechanism is not replacable.

Rather than chucking it out, I tried to think of something I could do with the parts, most of which were still OK. The result looks something like this, and we'll come to what exactly it does later:

The conversion is pretty simple, though obviously it depends a bit on the chair and how its made. The first step is to remove the seat post and mechanism. On my chair, the seat post is a light steel tube which is press-fitted into the plastic caster base. Once you remove a locking bolt the post can be removed with a few belts of a mallet.

The seat and back are just bolted on to the main mechanism. Once these are removed you can check them for usability. To mount onto the caster base you want whichever one has the flattest back. On my chair this was the back rather than the seat, though this may vary between chairs.

To fix the seat/back onto the base, juggle the spacing until its right and then drill some holes through the caster base. I just used some large-gague self-tappers to hold the seat in position. If its curved you might need to add some spacers between the base and the seat (eg. using washers or cutting short lengths of tubing).

I thought this would be fun for the kids to play with, and indeed it was for a short while. Since then, I've found several other uses.

  • Moving potplants, or other heavy objects. Once you've lifted it on its pretty stable, though you may have to hold your load in place top stop it falling off.
  • Moving furniture. For items that are large but not too heavy (eg. sofas), you can lift one end onto the device, and then carry the other end yourself.
  • A foot-rest. My wife claims that this is the best foot-rest she has ever had, which given her initial skepticism is saying something. An added benefit is that she keeps it under her desk, so I don't have to find somewhere else to store it.
  • A cat throne. (suggested by Kathryn) Providing your cat somewhere to sit may stop it trying to sit in inconvenient places. If you're lucky, it may even scratch here rather than destroying the sofa.

Its pretty easy to get raw materials for these things. If you can't scavenge some broken chairs from a workplace, you can usually find them in kerb-side junk collections.

How to make a WiiFit Exercise Bike

Perhaps you too have an unused exercise bike languishing in a dark corner. Lets face it, its pretty boring exercising on one of these things. How to get motivated? Make it fun using WiiFit!

Here's what to do:

  1. Stick your bike in front of the TV.
  2. Fire up WiiFit, and select Jogging (under Training -> Aerobic Exercises -> Jogging).
  3. Attach the Wiimote to the lower part of your leg. Its normally meant to go in your hand or pocket so its pretty insensitive to orientation but does need a good amount of movement. If you're wearing socks, you can just slide the Wiimote in - remember to face the buttons away from your leg so you can press "A" through your sock. It also works to put it the cuff of track pants, though it tends to flop about too much for my liking.
  4. Press "A" and start riding. It can take a couple of seconds for the Wii to learn the motion pattern.

Wiifit gives you some nice visual feedback that helps you keep a constant cadence. As you ride, your avatar runs along a path, following your training guide. The landscape is quite pleasant, and you can see other runners and dogs exercising too. If you slow down, your avatar starts to lag behind your guide and it will prompt you to keep a steady pace. You can select your desired activity level as you start the game. If your bike has a variable load, you can adjust this if you find the jogging pace too easy.

Have fun!

Migrating to WordPress MU

Notice some activity in my RSS feed? No, don't get too excited - I'm not actually blogging. However, I did move my blog from WordPress to WordPress MU. Here are some thoughts on why and how to do this.

WordPress MU is the multi-user version of WordPress which is used for sites like and A single WordPress MU site can host many blogs at once. If you have more than one blog this simplifies the process of maintaining, updating, and backup because you can handle all your blogs in one hit. According to the official docs, a single box running both web server and MySQL will get you about 10-20 thousand blogs. currently has over 3 million blogs.

Continue reading ‘Migrating to WordPress MU’ »

Vote The Bastards Out

With the Australian Federal Election looming, Stephen Taberner, has hit the campaign trail with some advice for voters. Considering how hard it can be to sing outdoors, I think these "flash mob" choral performances are pretty good. Check out the original Spooky Men's Chorale version below, or on their album Tooled Up.

Well, if I wasn't convinced before I certainly am now...

Update: actually, we did vote the bastards out. The first acts of the new Rudd government were to ratify the Kyoto protocol, apologise to the Stolen Generations, and consult the people on the nation's future. Seems like a good start to me.

Free Album made with Tenori-On

Norman Fairbanks has released his latest album "7 Days Microsleep". Eight tracks are available for free download from his web site. Its pure electronica - calming, mellow, yet full of motion and melody. For some reason I'm reminded of gamelan.

What's unusual about these compositions is that they are produced entirely on Yamaha's new gesture-based synth, the Tenori-On. Designed by Toshio Iwai, the Tenori-On is a hand-held device boasting a 256 pixel (16x16) LED display. By touching the display in different ways, the performer can build sequences of sounds that can be layered into complex soundscapes. The novelty of the interface is that it allows relatively complex sequences to be controlled through intuitive gestures. Unlike a traditional multitrack sequencer, the Tenori-On is a live performance instrument. This stuff is all real-time.

This video shows some of the different gestures that can be used to generate tone sequences : Score Mode, Push Mode, Changing Loop Points, Bounce Mode, and Solo Mode. Yamaha have some neat videos explaining these and other interactions here. Some technical details are available in this NIME06 paper.

I was quite intrigued by this gadget when it was released earlier this year, but I admit to being underwhelmed by some of the demo music I heard. Having listened to Norman's album a couple of times now its definitely growing on me. The standout tracks for me are "The Glam Machines Arrive" and "The Freedom Loop", but all the tracks have something to offer, sharing a unique tranquil hypnotic style. If you like this sort of thing, or are simply intrigued by the possibilities of this instrument, give "7 Days Microsleep" a try. A brief interview with Norman Fairbanks is available at Create Digital Music.

Viddler drops streaming playback

I've been using Viddler a fair bit to host videos of talks from local events such as Perth Barcamp and Podcamp. You can check out these and other offerings at my Viddler page.

For long videos Viddler offered several advantages over sites like Youtube.

  • Viddler supports videos longer that 10 minutes, and up to 500mb in size.
  • Viddler has timed comments, which allow you to annotate important moments in the video
  • Viddler had streaming playback, which allowed you to jump to arbitrary times by clicking in the seek bar. Also, you could click on a comment and jump to that point in the playback. This is very useful for picking out highlights.

Since I originally compared Viddler and Youtube in September 2007, several things have happened. Firstly, Youtube added support for seekable playback. Download is still "progressive" but can be restarted at any point by clicking in the seek bar. Recently Viddler turned off streaming support in their player, saying that it was "expensive and unreliable". They plan to move to a progressive seek player similar to those now offered by Youtube and Google.

So while Viddler still supports timed comments, its no longer possible to jump to the comment time. This was a very useful feature and IMO a key differentiator between their offerings and the many other video sharing sites out there. Lets hope they get this fixed soon.

Update: Viddler have added progressive seek to their player, so you can now jump to any time in a video. It does seem to be more stable than the old streaming player.