Category Archives: Technology

Made a controllable iPhone robot face!

Isn’t the internet a wonderful place?

The other day, I stumbled across instructions on how to make an iPhone robot face called Mimbo!   Here’s my finished result:

Little Miss 10 helped me cut out the cardboard template.  Unfortunately we ran into a few small issues:

* We started folding the robot cardboard body together BEFORE we cut out its eyes – bad move – it’s easier to cut the eyes out first!

* There is no mouth on the PDF template!  In the end, I cut one out, but then realised that the eyes and mouth didn’t match the iPhone face later on.   I moved the eyes and mouth around to fit.

* I spent a couple of hours wondering what to do with the .pde file!  After much Googling I found that you need to install Processing, which is a program which provides a programming and application platform.    You can download Processing from here:

* I followed the advanced instructions and got it working with FaceOSC.   What this does is let you control whether the robot smiles depending on whether you’re smiling or not!  It’s pretty cool!  I discovered that there’s a whole community around FaceOSC and interfacing it with other software (in particular music performance software) that I’ll have to explore another day.   It was refreshing to see that Osculator found FaceOSC with no problems.  However, it didn’t seem to be routing any events to Processing.   After some mucking around, I found that in Osculator, you can click the Parameters button, and then set up where to route OSC events.   It seems mine was being routed directly to my iPhone instead of through Processing.   Just click “OSC Routing”, then enter in localhost:8000 to route OSC events to port 8000, which will be picked up by the Processing script.

Definitely a very good introduction into TouchOSC.  Now to try to hook up TouchOSC to other things like Traktor!

Instructions here:

Siri – a week later and my next killer Siri app idea

It’s now been nearly a week since my wife got her iPhone 4S.  I’m surprised that the way she uses her phone has changed slightly.  All because of Siri.

I’ve caught her talking to that Siri person, even late at night.  And I know she’s been talking to Siri in the car.  Why is she talking so much with this person?

It just so happens that it’s much faster to say “Remind me to call the dentist at 9 tomorrow” than to pull up the Reminders, click the +, give it a title, select a time, etc. 

It’s just so much faster to say “What’s the weather tomorrow?” than to find a weather app, click on it, etc.

It’s just so much faster to say “Play Fix You” than to click the Music icon, scroll up and type out “Fix You” using the keyboard.

But I now wish that Siri could connect and be used by apps.  

On the theme of “Personal Assistant”, my killer idea for today is to integrate Siri with shopping list intelligence.  Imagine how useful Siri could be if you could dictate your shopping list throughout the week.  If you run out of something during the week, just tell Siri “Remind me to buy toothpaste”.   Or if you’re looking up a recipe to cook up, just dictate what you need to get like “Add onions, garlic and tomatos to my shopping list”.  Then when you get to the shops, it can remind you to buy those items.   That would be absolutely brilliant.

Or all TomTom or other GPS app interaction should be by voice like “Drive me home” or “I wanna go home”, or if you’re on a long roadtrip with the kids, “Navigate to the nearest McDonald’s” or “We need to get a toilet quick!”


Thoughts on Siri and Artificial Intelligence

When I was at Uni, I did some work that covered a bit of Artificial Intelligence.  Now AI is a huge field, but my project was on a basic speech recognition engine.  There are many areas being researched in AI, but one large problem is “learning”.   If we could train an AI system by feeding it more input, and if it can continually get better at categorising/recognising/classifying the input, then it would appear to be get more “intelligent”.

One problem is getting enough input.  For my speech recognition project at Uni, I had access to a CD with a handful of sound samples – of different people saying the same set of words.  The idea is, the more it heard different people saying, eg. the number “One”, then it should get eventually be able to recognise anyone saying “One”.   It would have been wonderful to record everyone in my unit, or even everyone doing Engineering as input to my project – but the logistics were too hard.

The problem of getting a large bank of input is not just for my speech recognition project – it’s for any AI learning system.

And that’s one thing that I’m so excited about for Siri – the new Personal Assistant Application on the iPhone 4S.

Imagine this – you gather over 300 researchers from 25 of the top research institutions in the world to work on an Artificial Intelligence project to build an AI assistant.   Then you put the findings and results of their work into a common handheld device, combine it with a voice recognition system, and unleash it to millions of people around the world who might be using it regularly, if not just to play with for novelty’s sake.

That is one MASSIVE bank of input data from an Artificial Intelligence point of view.

Just imagine the amount of new input data that is being received and processed.  On one hand, I wonder if Apple are collecting and storing the phrases people are saying into Siri and the privacy concerns around this.  But on the other hand, if Apple are using this data for Siri to continually improve its responses and intelligence, then you’d hope that it will get better at producing more useful results as time moves on.

The other thing I’m excited about (wow, readers must think I’m a real Apple fanboy), is that, yes, even though speech/voice recognition is not new by any means, Siri’s conversational interface is in line with the touch UI of the Apple iPad/iPhone – in that user’s shouldn’t need to THINK about HOW to interact with the technology, it should just work naturally.

All those patents about how the iPhone touch interface bounces at the end of scrolling, and how it slows down – those are concepts to make the screen appear and act like a physical object with momentum and inertia – it makes it seem more “real”.   And so with Siri – I know it’s not perfect, but the user doesn’t have to remember some strange sequence of words or to re-work sentences into specific structures, or speak slowly one syllable or word at a time to make it understand you.   You should be able to talk to it like any other person, and it should just understand.   I like where Apple is heading with this – where technology really is there to “assist” humans when required, and us “humans” don’t need to try to translate our intentions into the computer’s view of the world.

Applescript to bulk transcode video files using Handbrake

Real life has taken over my life recently so my blog is feeling a little neglected.

However, thought I’d share something I’ve been working on for the last week.

After buying a bigger hard drive, I’ve finally got all my M2TS files from my Sony HDR-SR7 video camera consolidated together in one spot.  But so far, I’ve been using iMovie to capture and organise all my other home video footage from Video8 and miniDV tapes.

I know I can get the AVCHD (M2TS and MTS) files into iMovie by converting them with Voltaic first into a QuickTime MOV file (encoded using the Apple Intermediate Codec), or by opening up the MTS files as a camera archive.

However, one thing that the family have been bugging me for so far is to get them into a format that’s easy for the rest of the family to view.  iMovie is not exactly a media player.  Nor is using Finder with Voltaic easy for the family.

My plan was to transcode all the raw footage into something that can be viewed either on the PS3 or iPad.

Luckily Handbrake is able to transcode M2TS files into any other format.  But I had a few hundred files to process, and even though Handbrake has a queue for processing, it doesn’t have the ability to submit a bulk set of files to transcode at once.

So I ventured into AppleScript land!   I’m a professional programmer and familiar with DOS batch files, VBScript and javascript – but all really on a Windows platform.   What is this AppleScript thing?

After some mucking around, I’ve written an AppleScript which can be run, or be saved as a droplet and files or folders drag and dropped to it, which will convert the files to MP4 using Handbrake.

To help everyone else, here it is!

To use, just:

  1. Copy and paste the code below
  2. Open up Applications -> Utilities -> AppleScript Editor
  3. Paste into a new document
  4. Then either
    1. Click Run to run the script immediately    OR
    2. Save somewhere (e.g. the Desktop) with type of Application, then drag and drop the folders you want to transcode onto the icon

Sorry about the formatting – once you paste into AppleScript Editor it should look all nice again 🙂

** This droplet will convert any file/folder dropped onto it or selected to the Apple Universal format using Handbrake.
** It currently will reuse the same filename for all files except MTS files, with which it will rename using the file’s creation timestamp.
** by Jason Chong
** Revision Description
** 1.0 Initial version

property type_list : {} — e.g.: {“PICT”, “JPEG”, “TIFF”, “GIFf”}
property extension_list : {“m2ts”, “mts”, “mov”, “avi”, “mpg”, “mkv”, “dv”} — e.g.: {“txt”, “text”, “jpg”, “jpeg”}, NOT: {“.txt”, “.text”, “.jpg”, “.jpeg”}
property typeIDs_list : {} — e.g.: {“public.jpeg”, “public.tiff”, “public.png”}

** This function is called if the script is run by executing the script directly.
on run
set these_items to choose folder with prompt “Select a folder to convert:” with multiple selections allowed
set dest_folder to choose folder with prompt “Select a destination folder:”
repeat with one_item in these_items
process_item(one_item, dest_folder)
end repeat
end run

** This function is called if the script is run by dropping files/folders onto the item
on open these_items
set dest_folder to choose folder with prompt “Select a destination folder:”
repeat with one_item in these_items
process_item(one_item, dest_folder)
end repeat
end open

** This function does the high level processing of the items chosen
on process_item(the_item, dest_folder)
set the item_info to info for the_item
if folder of the item_info is true then
— If a folder then call this function recursively for each item within
set these_items to list folder the_item without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((the_item as Unicode text) & (item i of these_items))
process_item(this_item, dest_folder)
end repeat
— If not a folder then check the extension, file type, etc
set this_extension to the name extension of item_info
on error
set this_extension to “”
end try
set this_filetype to the file type of item_info
on error
set this_filetype to “”
end try
set this_typeID to the type identifier of item_info
on error
set this_typeID to “”
end try
— Only process if meets all criteria
if (package folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the type_list) or (this_extension is in the extension_list) or (this_typeID is in typeIDs_list)) then
convert_video(the_item, dest_folder)
end if
end if
end process_item

** This procedure does the actual conversion of video files using Handbrake
on convert_video(this_item, dest_folder)
log “Processing file: ” & this_item as string
with timeout of (720 * 60) seconds
tell application “Finder”
if (label index of this_item is 0) then

— Set to gray label to indicate processing
set label index of this_item to 7

— Set original file name
set origFilepath to this_item as string
set origFilepathPOSIX to quoted form of POSIX path of origFilepath

if name extension of this_item is “MTS” then
— If MTS then make destination filename equal to YYYYMMDDHHMMSS.MP4
set origFileCreationDate to creation date of this_item
set newFilepathPOSIX to POSIX path of dest_folder
set newFilepathPOSIX to (newFilepathPOSIX & (getDateAsString of me from (origFileCreationDate))) & “.mp4”
set newFilepathPOSIX to quoted form of newFilepathPOSIX

— For all other files, keep destination filename the same (assume it’s already in YYYYMMDDHHMMSS format)
set nameWithExtension to name of this_item
set nameWithoutExtension to getBaseName of me from (nameWithExtension)
set newFilepathPOSIX to POSIX path of dest_folder
set newFilepathPOSIX to newFilepathPOSIX & nameWithoutExtension & “.mp4”
set newFilepathPOSIX to quoted form of newFilepathPOSIX

end if

— Start the conversion
— Refer to and
— for HandBrakeCLI presets
set shellCommand to “nice /Applications/HandBrakeCLI -i ” & origFilepathPOSIX & ” -o ” & newFilepathPOSIX & ” –preset=\”Universal\””

— display dialog shellCommand — uncomment for troubleshooting
log “Executing command: ” & shellCommand
tell current application
do shell script shellCommand — comment out for debugging
end tell

— Set the label to green in case file deletion fails
set label index of this_item to 6
log “Successfully converted item: ” & this_item as string

— Remove the old file
— set shellCommand to “rm -f ” & origFilepath
— do shell script shellCommand

log “Skipping already processed item: ” & this_item as string
end if

on error errmsg
— Set the label to red to indicate failure
set label index of this_item to 2
log “Failed to convert item: ” & this_item as string

end try
end tell
end timeout
end convert_video

to getDateAsString from t
set creationDateString to year of t as string
set creationDateString to creationDateString & text -2 thru -1 of (“0” & getMonthNum(t) as string)
set creationDateString to creationDateString & text -2 thru -1 of (“0” & day of t as string)
set creationDateString to creationDateString & text -2 thru -1 of (“0” & hours of t as string)
set creationDateString to creationDateString & text -2 thru -1 of (“0” & minutes of t as string)
set creationDateString to creationDateString & text -2 thru -1 of (“0” & seconds of t as string)
return creationDateString
end getDateAsString

on getMonthNum(theDate)
— French Vanilla, by Emmanuel Lévy
— set theDate to the current date –or any other date
copy theDate to b
set the month of b to January
set monthNum to (1 + (theDate – b + 1314864) div 2629728)
return monthNum
end getMonthNum

to getBaseName from t
— by Kai Edwards
set d to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “.” — separated at periods
if (count t’s text items) > 1 then set t to t’s text 1 thru text item -2
set t to t’s text items — splits t into a list again at the periods
tell t to set t to beginning & ({“”} & rest) — puts it back together to
set AppleScript’s text item delimiters to d — always set them back again!
return t
end getBaseName

Getting rid of the duplicate JPEGs of raw files

I don’t know why I chose this option, but a few years ago when I moved from JPEG to shooting RAW, I decided to choose the RAW+JPEG option on my Nikon camera.   I guess I thought it would be handy having a lower resolution JPEG just in case I wanted to email it off or view it straight away on some device or software program that didn’t support Nikon raw files.

Well, it turns out, I never have used the JPEG.   I always do some post processing on my photos and if I wanted to blog or email or upload a photo, I’d always process the raw file (NEF) and then convert it to JPEG.  Plus I think most photo library or processing programs support raw files nowadays.

Unfortunately the workflow I used was to import both the JPEG and NEF files from my camera to my photo storage folder – resulting in 2 files for every photo.   No real problem right?

Well, for applications like Lightroom that are intelligent – no real problem, Lightroom knows that cameras can do this and if you have the right option turned on, it will treat the JPEG and NEF together as one – practically “hiding” the JPEG.

But for iPhoto, it’s not so clever so I ended up with two of every image.  And since the JPEG is slightly processed by the camera, they look different (different temperature, etc).   (Why do I use iPhoto too?  Because it’s the easiest way for my wifey and kids to see ALL our family photos, select them into albums, email them, etc).

Also it bugged me that I had all these JPEGs lying around on my hard disk, taking up space, slowing down my Lightroom and iPhoto libraries.  On my camera, I now use just RAW with no JPEG option.

So I started a project last week to get rid of these JPEGs.  But how?

After some messing around, I found these steps to work:

1) In Lightroom, turn on the option to treat the JPEG and RAW as separate photos.   This effectively turns Lightroom into the dumb iPhoto and you’ll end up seeing two photos now – one for the JPEG and one for the RAW.

2) In Finder (I use a Mac), I actually manually deleted all the JPEG’s that were duplicates of the RAW file.   I know – TEDIOUS!  I could have written a script to see if filenames were the same, if the raw file (NEF for my Nikon camera) existed, then delete the JPG.  But I was so paranoid that a script may just delete some required files that I decided to do this by hand instead.  In reality, with proper sorting of files, it didn’t take too long.

3) Now – I’m in a state where I’ve pulled the rug out from under the feet of iPhoto and Lightroom.  It’s time to get their databases back in a valid state.

4) For Lightroom, just go to the Library module, then right click on a folder and choose “Synchronize Folder…”.  This will prompt Lightroom to look at the folder and match them up – import any photos that are on disk but not in Lightroom, and remove any photos from Lightroom that are not on the disk anymore.

5) For iPhoto, unfortunately there is no synchronize option.   However, I did find a post on a blog called Phil at Warrimoo who posted an Applescript that walks through photos in iPhoto and deletes them from the iPhoto library if they don’t exist on disk.  It does work, although a little slowly and I had to tweak it to work for iPhoto libraries where the photos aren’t copied into the iPhoto library.

Hope this helps someone out there!

D700 Unboxing


I finally ordered a D700 from T-Dimension a week ago.

And then, as a nerdy nerd, I tracked its progress every hour across the globe..  well, from Hong Kong, to China, to Singapore then to Perth.

And then I waited as it got held up in customs.

And then I rang Fedex, bugging them about why it’s been sitting in Perth for a day without me hearing anything.

And then I decided to drive TO the Fedex depot in Perth, and just demand that I want to pick up my camera.

And after paying the import duty, I had to wait nearly 30 minutes whilst they tried to locate my parcel.

And then it was IN MY HANDS!

Even though I missed out on getting it cheaper, I’m glad I did, because I’ve since found out that many Hong Kong (and probably other) stores have a very small supply of Nikon gear in their inventory, and that’s it – they don’t know when they will get more from Nikon because there’s a worldwide shortage due to the earthquake and tsunami.

After unboxing, the things I immediately noticed:

It was REALLY HEAVY!  I thought, “How am I going to lug this thing around?”  I can’t even hold it with one hand easily!!  I think I nearly strained my wrist holding it with one hand.   Heavy is good for one thing though – it’ll help you steady the camera when hand holding a shot.   Besides that, the only other positive I can think of is it’ll help me burn more calories when I take photos due all the lifting I have to do!

It was BIG!  Well, bigger than the D80 I was using before.  Definitely not inconspicuous at all.  With a small 50mm or 85mm on there, it’s OK.  But I dread to think how big it will be with a 24-70 zoom.  Luckily it still fits into my camera bag.

It felt PRO!  The rubbery texture, the metal housing, the number of buttons and dials.   The lack of “scene” modes like Portrait, Landscape, Sports – that’s right – no more hand-holding.  You need to be comfortable with Aperture Priority, Shutter Priority, Program and Manual modes.   And then going through the menus – the sheer number of configurable items – do we need ALL these things to be configurable?

One of the first things I did was put on my 50mm f/1.2 manual non-CPU lens.  Amazingly, the D700 can automatically set exposure for the lens, and although there is no autofocus, the in-focus indicator in the viewfinder works which helps report if the camera thinks the image at the focus point is in focus.  Sweeet!

A more detailed review with some shots to follow…

Online resources for NZ quake info

I can’t stop thinking about the destruction and loss of life in Christchurch due to the large earthquake yesterday.

Is it just me, or has 2011 seemed to have started with an unusually large number of natural disasters?   Cyclones and flooding in Queensland, cyclones up in the North West of WA, flooding in the Eastern States, large storms in rural WA, bush fires in Perth, and now major earthquake damage in our neighbour New Zealand.    The loss of life and injuries, the impact on people’s lives, families, work and income is terrible and saddening.   However, all these events are making me appreciate how precious life is and how insignificant we, as a “species” inhabiting this planet, are. 

The surreal images, personal stories and news footage coming from New Zealand is sad and scary.   My thoughts and prayers go out to all affected and to all those in the search and rescue efforts.  

Initially I had thought there was just one major earthquake/aftershock from the big one last year, but no…   that area of New Zealand is currently experiencing an extremely large number of aftershocks. 

Here are some internet sites that help put the seriousness and instability of the land in more perspective:

Christchurch Quake Map – lets you play back all the recent quakes for a specified day and plotted out on a map in accelerated time.  

QuakeMap NZ – plots out all the latest quakes statically on a Google map.   Yep, there’s a stack of them all centered around Christchurch.  

GeoNet – has a list of the latest quakes

And Google has a Christchurch Earthquake Crisis Response page that lets you find missing friends/relatives, keep up to date with the latest information and has emergency numbers.   Good if you have internet connection, but for those in Christchurch with no power, water and congested mobile networks, not so good.