Sunday, 2 June 2013

iTunes IR Remote music rating

Pierre Wolfer ( by-nd)
I use a Logitech Harmony One IR remote to control my various home entertainment systems which includes a mac running iTunes. Most of my smart playlists select tracks based in part on the ratings of each track. To help encourage myself to rate more of the tracks I've create a small utility called Iris.

Iris works in conjunction with the Harmony One remote (and potentially many other smart remotes) to allow the currently playing track to be rated by pressing 1..5 or 0 to clear the rating. In addition the "info" button will speak the current track or album rating. This is handy for re-rating a song I've lost interest in so that it doesn't get included quite as often.

As a large part of my library is currently unrated, Iris will optionally announce at the start of each track if the track is "unrated".

Whilst the iOS remote apps allow checking and changing the rating of the current track, I find it a little slow to use and changing a rating whilst a track is playing often causes the track to be removed from my smart playlists that do live updating. Iris solves this problem by delaying the rating change until the track finishes. In addition picking up the remote and pressing 1-5 is much quicker than unlocking the iPhone, waiting for the remote app to reconnect and then navigating to the ratings panel.

There's still a few features needed to make the app a little more user friendly and useful, it doesn't even save your preferences yet :) However, it's usable and doing the job I needed it for so I thought I'd make it available to anyone who wants it.

Source code for Iris can be found on Bit Bucket along with a pre built OSX 10.7+ binary of Iris Version 0.2
SHA1: 6c0aefb8afb49743f2b8dafbec245d40047a52a0

Iris is a free utility released under the GPLv3.

Saturday, 27 October 2012

The wonderful thing about Tiggers

Tigger with Flashing Pumpkin
It's nearly Halloween and my family have been digging out Halloween decorations which is how a broken Tigger toy landed on my desk.

Opening the pumpkin and exposing the internal circuit/wires showed the source of the problem. Three of the power wires connected to the LEDs had snapped along with a battery ground wire on the original circuit board and both of the resistors each had a snapped leg.

The original control circuit is located inside the pumpkin, as shown in the photo below. The 5 LEDs fastened to the pumpkin eyes,nose,mouth are wired in parallel giving independent control over each LED. In addition the green stem on the top of the pumpkin is a push to close switch, I'm not sure the function it served with the original Tigger, possibly waking it up or changing the LED sequence?

Original control circuit
Swapping out the resistors and reconnecting the power lines probably wouldn't have taken long, but where's the fun in that. Tigger was showing his age and in need of minor surgery.

The plan was to replace the existing circuit board with a new pic based controller, a motion detection circuit and speaker. However with Halloween just a few days away, reality took hold and I decided to swap out just the LED controller. Motion/speech can wait for another year.
Breadboard prototype

A quick bit of breadboarding with the lowest pin count PIC I had available, PIC12F1822 resulted in a simple circuit with 5 LEDs independently controlled and a nMCLR pin repurposed as a switch to cycle through the LED sequences.

The new LED control circuit photo shows the PIC based LED controller soldered onto stripboard along with an ICSP header for future updates. Although a little longer than the SMT based original, it fit nicely inside the re-stuffed pumpkin.
New LED control circuit


To save time I knocked up a quick bit of firmware in C rather than asm. The PIC is set to run at its lowest internal clock speed 32kHz and run one of 6 sequences. Pressing the green switch at the top of the pumpkin will interrupt the current sequence and cycle through the available ones.

To add a little variation to the 3 fixed sequences, I appropriated the PRNG used in Elite.

void cycleSeed(void)
   uint16_t sum = sgSeed.w0 + sgSeed.w1 + sgSeed.w2;
   sgSeed.w0 = sgSeed.w1;
   sgSeed.w1 = sgSeed.w2;
   sgSeed.w2 = sum;

the high bits of w2 are used whenever a random byte is required.

Tigger now supports 3 different fixed flashing sequences as well as 3 random sequences demonstrated in the video below.
  1. Random flashing of LEDs with a random delay
  2. All LEDs flash on and off
  3. Random flashing with a slower delay
  4. Cycling LEDs in order
  5. Random flashing with a faster delay
  6. Random cycling of eyes only
The three random sequences use cycleSeed to obtain a new pseudo-random byte which determines which of the 5 LEDs to light. In addition, the delay between moving to the next random set of LEDs is itself randomised. The slower and faster variants will generate delays in the range 1-500ms or 1-1000ms between each change.

The first sequence will also delay in the range 1-500ms between each change, however it will remain at a given delay speed for a short amount of time before randomly generating a new speed. Unlike the slow/fast variants which use a new random delay for each change.

Flashing an LED is perhaps one of the simplest circuits you can make and doing so in a sequence is not a lot more involved, but sometimes, simple is all that's needed. That said, it's tempting to make a new circuit for next Halloween with a larger pin count pic a speaker and motion detection. Then it'd be possible to write some more interesting firmware that plays games.

Monday, 13 August 2012

Content aware fills

Whilst going through some holiday snaps to fix the mess I made of the white balance due to an uncalibrated monitor, I was reminded of an overhanging support beam that was spoiling a photo I took of the Indiana Jones show at Hollywood Studios.

The beam can be seen creeping into the top right corner, it was actually much worse but a little cropping took care of most of it. To fully remove it would have meant either losing the tips of the explosion and cutting off the trees to the left, or cutting off most of the fuel truck and barrels.

A few years ago I watched a video on content aware fills, but what I hadn't realised is just how well the Gimp implementation of it worked. Select the area to remove using the lasso selection mask and run the Heal option under filters and magic happens.

If only my photography skills were as impressive as the content aware fill tech.

Tuesday, 17 April 2012

Neutron Flux for iPad

Our first iPad game, Neutron Flux, is available on the App Store

Neutron Flux is a game of simple rules. Place atoms until you reach a cell's limit, cause explosions/chain reactions and capture your opponents squares. Capture all the squares to win the game.

You can find a little more information on the Burnt Wasp

Tuesday, 22 February 2011

Page Turner Mk II

Using an LCD monitor + computer for sheet music display along with the first version of Page Turner has turned out to be a much nicer experience than struggling to page turn manually. However, the iPad lacks a serial port yet it makes for a great portable sheet music display.

Enter Page Turner Mk II, a USB device that plugs into the iPad's camera connection kit and identifies itself as a USB keyboard device. It sends a page forward/backward keypress depending on which foot pedal is pressed.

The USB port shown in the photos is used to connect a standard USB cable to the iPad via the camera connection kit, as far as the iPad is concerned this is a normal USB keyboard. The two jack sockets on the opposite side of the box accept 3/4" foot pedal jacks to allowing both forward and reverse page turns.

Holding the "forward" pedal down and plugging the device into a a PC will cause the bootloader to enter flashing mode, allowing new firmware to be downloaded to the device.

Internally the device makes use of a PIC 18F4550 which includes a USB module and corresponding stack which avoids interfacing with a separate FTDI chip. A lower pin count PIC could have been used, but I had the 18F4550 spare at the time. Hardware wise, the device is pretty simple with just a few decoupling capacitors, a crystal to drive the PIC and interface connections for the two switches plus USB socket.

Since making this, the AirTurn bluetooth model is now on sale in the EU, I had planned to buy one when they became available, however I'm now tempted to make Page Turner Mk III with bluetooth instead :)

Thursday, 14 January 2010

MX716/7C and SXV 64 Bit CCD Drivers

Last year I switched over to a 64bit operating system and realised there were no 64bit drivers available for the MX716 CCD camera I use for astrophotography. Unable to pass up the opportunity to learn about windows driver programming I spent a bit of spare time creating two drivers for the camera (firmware loader and blockIO driver).

The driver supports both the original StarlightXpress software, AstroArt and MaximDL. In addition, the MaximDL universal firmware may be used (see installation instructions for details).

I've also created 64bit drivers for the newer Lodestar guiding camera and SXV USB2 range of CCDs. Both the SXV and older MX716 drivers are now available for download direct from the Starlight Xpress site.

My thanks to Terry from StarlightXpress for his assistance and openness on the SX hardware.

Monday, 24 August 2009

Page Turner

Its about a year and a half since I bought a Digital Piano and finally started practicing daily. In that time I've progressed quite well and the pieces I'm able to play (albeit still at the late-elementary / early intermediate level) are finally starting to increase in length to a few pages.

This has brought about a problem I'd not really considered up to this point that I'm sure plagues all pianists. How to turn the page without interrupting your playing. Given time I'm sure I could get used to reaching up and turning the page and make do with copying a few measures from the next page to get me to a suitable place to turn the page, but I'd rather not :)

A product called the AirTurn provides a solution to this problem. However, as a hardware hobbiest I decided to roll my own. Using a Laptop or LCD monitor to display the scores in either Adobe Reader or Music Reader and a serial connected foot pedal to fire off a PG Down event.

Above is a picture of the final device and a screen shots of the pedal turner .NET application which monitors the serial port and sends out PAGE DOWN keyboard events to the activate application whenever the pedal is pushed down.

The application and documentation, which also includes brief instructions on how to build your own serial connector (it's pretty simple!) can be downloaded here

As a side benefit to going digital, there's no more printing out digital music from the various on-line stores and no more hunting around for a specific score amongst the thousands of downloadable public domain scores.

With PDF Annotator or MusicReader, it's also possible to annotate the scores, adding fingering information and highlighting practice sections. Plus re-ordering pages so they're out of sequence is great for handling all those jumps back and forth in a piece. [Shortly after writing this blog I purchased MusicReader and have not regreted it.]

I've demo'd several other apps, but mostly they're related to music notation rather than playing from a score. Theres some pretty cool OCR software available for music that'll scan a score, convert it to various formats including MusicXML and allow you to play it back. Unfortunately, all the apps that include that kind of feature do not seem to offer any kind of library management nor are they as suited to playing from and annotating scores as MusicReader is.

From what little I've used of MusicReader so far, one feature I'd like to see added is a layer option. Having the ability to erase all annotations on a given layer whilst keeping marks made on other layers rather than having to be careful what you erase. Plus an option to toggle the visible layers.

I guess I can't discuss paperless playing without mentioning Hugh Sung, who's blog and youtube videos put me onto MusicReader and the pedal page turning idea in the first place. His company produce the AirTurn, which is a USB device that allows you to connect a set of pedals to your PC without wires. His site is also responsible for the expensive notion of buying a table PC that I now have stuck in my head, hopefully the idea will remain there and not make it to my credit card ;)