Monday, June 28, 2010

Visualisation tools - Part I, resonance

For several years now, I've had the notion of writing a discussion of the characteristics of various musical instruments, with a particular focus on the primary resonator (string, air column, whatever) and ignoring, at least in the first instance, the effect of the modes of vibration of other bits of the structure (because that's complicated).

I plan, as a starting point, to consider a string, pinned at both ends. This has an infinite number of potential modes and which ones are excited depends on the mode of excitation: a guitar string starts with a displacement function and zero velocity; a piano string starts with zero displacement and a velocity that I suspect can be fairly well approximated by a Dirac delta function; I don't know about a violin string.

I'll then go on to discuss wind instruments, particularly flute and saxophone (because I have them lying about the house), before dealing with the most difficult of all, the humble harmonica. That's difficult because, even using the simplest Euler-Bernoulli model, you have to deal with hyperbolic functions.

An optional extra module will serve as a prequel to all of this - explaining Fourier analysis and synthesis.

I've been wondering how best to do the graphics. The two obvious candidates are VPython and Easy Java Simulations (EJS) - there's a good comparison at the brilliant Dot Physics. I've been using Python a lot lately, especially with NumPy, SciPy and matplotlib, and with all those great libraries it gives you essentially a free MATLAB. On the other hand, the fact that Java can run on pretty much any machine (except the IPhone), means EJS wins hands-down for an online demo.