Thursday, July 10, 2008



For the past few weeks I have been working on a project for Windows automation. The result is Launchorz, Powerful JavaScript libraries for Win32 automation.

Look at this!'notepad.exe')
Dialog.askYesNo('Question','Did you expect this to happen?');

LnzScript is the language of the Launchorz project. It is JavaScript (run locally, not in a web browser) with libraries for simulating keystrokes, mouse movements, working with files, and a lot more.

Read the actually substantial documentation:

Try it now! Download and get the source from Github:

Look at what it can do:

One cool aspect of the project: documentation is written inline with the C++ code. Then, a Python script creates an xml file from this documentation. This same xml file is used for reading by C++, C#, and even rendering to the browser! I wrote an xsl transform that renders the documentation, so that it can be seen in a browser. If you look at the source, you'll notice that it is xml.

AutoIt exists and is good at what it does. However, its syntax and minimal data structures will not do for non-trivial programs. More of my rational is given in the documentation.

Leave a comment, or send me an e-mail if you are interested in joining the project. Please try it and give feedback - I will consider feature requests.

Sunday, July 6, 2008


Here is another of my audio experiments, called Blinkbeat. It uses the Caps/Num/Scroll lock lights on your keyboard to blink along with the song you are playing! Click on the picture to see a video (Youtube):

The FFT is used to find the energy at different frequencies. What I display is kind of like a histogram of the frequencies.

I have also added a beat detection option, which is not finished but seems to do a decent job. For beat detection, I divide the song into short segments, and use the FFT to find the low-frequency energy in each segment. So, I now have another signal in time, which is the low-frequency-energy over time. Finally, I take a second FFT of this new signal, which is finding the frequencies in this signal. I estimate the rhythm of the song to be the peak in these results, and return the result in BPM.


Windows binary

Check out the source at GitHub, downpoured.

Known issues: The normalization of lengths isn't perfect. If you try to play a long clip, the lights and the audio will eventually lose sync. Also, I draw the bars by changing the dimensions of several button controls :).

WaveAudio Developments

I've also been working on the WaveAudio sound library in C#. It's pretty nice to be able to write:

Sine note = new Sine(440.0);
WaveAudio wave = note.CreateAudio(1.0); //1 second
AudioPlayer pl = new AudioPlayer();; // and now you hear it!
I spent a lot of time yesterday writing some really sweet code for synthesizing audio. By the end of the day I found out that what I had sounded a lot like the cheesy "choir" effect on old keyboards!! Still, this is pretty cool, and there are many more parameters to tweak. I'm owe thanks to Wikipedia and Wikibooks for giving me ideas.

I added an algorithm for autocorrelation pitch detection, which works pretty well. It can tell what pitch I'm singing, and works on various instruments as well.