Orion's Windows Tuner


Download the Tuner

This program uses your computer's microphone to tune a musical instrument (or your voice). The outer dial reads the name of the musical pitch, and the inner dial reads the mistuning from that pitch. This can be used to tune a piano or guitar, improve technique and intonation on wind instruments, and is just a generally interesting thing to see.

The sample readout above shows the program hearing a C note which is just a bit sharp (too high). The dial updates about 5 times per second on my P-166.

Geek Speak:

This program is just one of the many fun and useful things you can do with the Fast Fourier Transform. The FFT converts time-domain samples (like the sound pressure values from a microphone) into freqency-domain samples (like a freqency list). The FFT is also one of those unexpected and beautiful applications of complex variables.

2048 8-bit mono samples are read at 22.050 kHz. These are DC-centered, FFT'd, and the freqency bins are converted to decibel power. The peak bin is identified, and interpolated to sub-bin accuracy. This gives a freqency peak, in Hz, which is converted via the formula:

     log(freq)/log(2)*12-log(440.0)/log(2)*12

into a musical note (in half-steps) in the equal- tempered scale. The mistuning, in half-steps, is just the distance to the nearest integral note.

This was my first-ever foray into Windows programming, and was written for the ACM Quest for Windows CE in late 1998. Hence, the code (included in the zip above) is fairly tough to read.


Back to Orion's Oeuvre.
Back to Orion's Home Page.