961 words on earthlingsoft
Roughly two weeks ago the initial version (v2) of SkipChecker was released. It let you skip songs in iTunes by slapping the computer, even execute arbitrary scripts depending on the direction those slaps came from and enjoy a pointless animation. For just being a silly application with an ugly icon it got a surprising number of downloads. I sneaked in an slightly updated v3 shortly afterwards and then started looking into the next bits of fun for v4 of Skip Checker which was released today.
So what’s new in there? The first thing which haunts every sudden motion sensor based application I have seen so far is that the sudden motion sensors of different computer models give greatly varying values. There are at least two ways out of that dilemma. The really elegant one would be that the application carefully monitors the values it receives from the motion sensor and then tries to extrapolate which are the ‘neutral’ ones that should be used to gauge the sensor. Doing that would probably require not-trivial or a least significant programming and I suspect it would be bound to fail rather quickly. As software that tries to be clever frequently does. As I’m not into programming anyway – ditched that method by virtue of my lazyness straight away and wend for the dumb method:
There’s a calibration button now. You hit it, the computer annoys you by giving you a little countdown (there’s a ‘good’ and an ‘embarrassing’ reason for that countdown if anybody dares to ask) and then just assumes the values it measured to be the neutral ones which will be subtracted from any future readings. Pretty un-magic. But it works quite well. Unfortunately there was no
[NSComputer MACAddressForEthernetInterface] method in Cocoa and I was too lazy and scared by the low level stuff to find out the Ethernet MAC address myself, so I couldn’t store the calibration on a per computer basis (you know for those 0,3 users who will actually use this on several computers with synchronised preference files). Ah well, that much for calibration.
The actually big new feature is a new section called ‘Sound’. It’ll turn the computer into a musical instrument. You get two sine waves for which you can set a base frequency. One of the frequency can be varied by tilting the computer back and forth while the other can be varied by tilting it to the left and right. There are also options to adjust the relative mixing of those waves and the total volume – which can be influenced by up and down motions. A fun toy… with not exactly the best UI on the planet.
One thing I couldn’t resist doing was to play with Cocoa’s value transformers and make one that converts the frequency of the sine wave to the name of the matching note… a fun exercise in musical computations, the addition of Unicode strings and – of course – keeping things localisable (B, for example is called H in German and B♭ is called B – and don’t they use the Do-Re-Mi… names in French and Italian?). Not that localisation actually mattered for this monolingually English application. Of course these note name transformations are somewhat critical. If I only displayed the name when the relevant frequency is matched, you’d never actually see them, so I had to introduce some quasi-arbitrary margin of error which will assign a name to all frequencies that are up to 10% above or below the correct note. I wonder how awful people with perfect pitch will find that (cue some Dr. Howard Bannister quote here…).
As I couldn’t decide which names to give to the demi notes – G♯ or A♭? etc. – I settled for using the ♯ when slightly below the target frequency and the ♭ one when slightly above it. That seemed to make sense to me, although I’m not 100% sure. (There’s this thing with people who don’t use the well-tempered scale that there should be differences between these notes, but I’m not really sure whether I got them right this way. Come and complain if I got it wrong and you know how to do this right!)
And, yeah, I fixed a few bugs - the icon for saved files should actually appear now and I might be able to add the great advertising line ‘50% faster’ which would be the marketing translation for ‘not being a complete dumb-ass who accidentally instantiated the class for reading the motion sensor twice’. Finally, a lot of the inner structure of the application was cleaned up and structured a bit more nicely.
And once again I got to fight the ‘inner beauty’ of Bindings. Possibly I’m doing odd things, but let me mention two things that irritated me: The first was that when I’m having two objects that are instantiated in my nib file and one of them binds to the other, then it seems to be entirely possible that on closing the application one of them is deallocated before the bindings from the other have been undone – giving a nice exception or crash situation. A workaround for this is to put an additional retain on the bound object when instantiating the other object and release on deallocation. The bottom line being that it was quite nonsensical to instantiate the extra object in the nib file to begin with as I could have just done that in a line of code (unless I wanted to set some outlets that is). The second thing was my struggle with Key-Value-Coding. There seems to be no key path for an object to point to itself. Which I consider to be a shame.
It would be pretty cool if the program could play/pause rather than just skip to the next song - (but im new to the program so it may already do just that - I don’t know)
You can use the Advanced tab to do just this (and much more).
Just decide for the direction that should trigger the play/pause action and enter the following script in its field:
tell application “iTunes” to playpause
LOL this is my favorite application ever.
Received data seems to be invalid. The wanted file does probably not exist or the guys at last.fm changed something.