Thursday, March 12, 2009

Harmonograph


Ever since reading the funny little book, "Harmonograph: A Visual Guide to the Mathematics of Music", I've been rather intrigued by the Harmonograph. A harmonograph is a music visualization tool that was first devised in Victorian times. It consists of two (or more) pendulums which oscillate with different frequencies and are both connected to a single pen or marker. By tuning the frequencies to various harmonic intervals (octaves, fifths, thirds, etc.), the pattern drawn out by the pen traces various intricately beautiful geometric shapes. Back in ye olde days, well-heeled toffs used to set up their harmonographs at dinner parties and everyone would get together and marvel at the trippy patterns it would create. Presumably they were all bombed on opium at the time...

Anyway, after reading the book, I realized that it would be reasonably simple to build my own "virtual" harmonograph. I started some Actionscript code to implement the equations of motion for the pen:
$P_x = sin(\omega_x t)$ and $P_y = sin(\omega_y t)$
where $\omega_x$ is the frequency of oscillation in the x-direction, corresponding to the first note in the interval. Thus, to plot the interval between A4 and A5, we set $\omega_x =$ 440Hz and $\omega_y =$ 880Hz. The resulting pattern looks like this:

The next step was to add the sound of the interval that is being plotted - this is something that the Victorian gadabouts couldn't do and I thought that it would really help to get some nice synesthesia going on. Enter Flash 10 and the new sound synthesis capabilities!

So, invite over your dandy friends, bust out the opium pipe and enjoy the virtual harmonograph!